From 71e46de0fc9fa889b3254f05017f9d467451cd6d Mon Sep 17 00:00:00 2001 From: Illiux Date: Wed, 14 Sep 2022 17:10:12 -0700 Subject: [PATCH] Rework the ChemMaster's output handling (#11207) * Fix doc comment on FitsInDispenserComponent It's clearly intended to be a doc comment, but wasn't. * Allow the ChemMaster to accept canisters and bottles * Give the ChemMaster an output container slot * Tweak ChemMaster UI layout * Make more ChemMaster UI tweaks * Update ChemMaster SpinBox max handling * Rework the ChemMaster * Apply suggestions from code review Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com> * Implement PR feedback * Switch ChemMaster to a tabbed UI layout * Rename Amount to Dosage for clarity * Replace Amount with Dosage in messages * Clarify dose in UI Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com> --- .../UI/ChemMasterBoundUserInterface.cs | 18 +- .../Chemistry/UI/ChemMasterWindow.xaml | 178 +++++++++------ .../Chemistry/UI/ChemMasterWindow.xaml.cs | 184 +++++++++------ .../Components/ChemMasterComponent.cs | 7 +- .../EntitySystems/ChemMasterSystem.cs | 216 +++++++++++++----- .../Components/FitsInDispenserComponent.cs | 2 + Content.Shared/Chemistry/SharedChemMaster.cs | 94 +++++--- .../components/chem-master-component.ftl | 9 +- .../Structures/Machines/chem_master.yml | 11 +- 9 files changed, 472 insertions(+), 247 deletions(-) diff --git a/Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs b/Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs index 5df7a61836..25604a881f 100644 --- a/Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs +++ b/Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs @@ -37,11 +37,19 @@ namespace Content.Client.Chemistry.UI _window.OnClose += Close; // Setup static button actions. - _window.EjectButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(SharedChemMaster.ContainerSlotName)); - _window.BufferTransferButton.OnPressed += _ => SendMessage(new ChemMasterSetModeMessage(ChemMasterMode.Transfer)); - _window.BufferDiscardButton.OnPressed += _ => SendMessage(new ChemMasterSetModeMessage(ChemMasterMode.Discard)); - _window.CreatePillButton.OnPressed += _ => SendMessage(new ChemMasterCreatePillsMessage(((uint)_window.PillAmount.Value), _window.LabelLine)); - _window.CreateBottleButton.OnPressed += _ => SendMessage(new ChemMasterCreateBottlesMessage(((uint)_window.BottleAmount.Value), _window.LabelLine)); + _window.InputEjectButton.OnPressed += _ => SendMessage( + new ItemSlotButtonPressedEvent(SharedChemMaster.InputSlotName)); + _window.OutputEjectButton.OnPressed += _ => SendMessage( + new ItemSlotButtonPressedEvent(SharedChemMaster.OutputSlotName)); + _window.BufferTransferButton.OnPressed += _ => SendMessage( + new ChemMasterSetModeMessage(ChemMasterMode.Transfer)); + _window.BufferDiscardButton.OnPressed += _ => SendMessage( + new ChemMasterSetModeMessage(ChemMasterMode.Discard)); + _window.CreatePillButton.OnPressed += _ => SendMessage( + new ChemMasterCreatePillsMessage( + (uint)_window.PillDosage.Value, (uint)_window.PillNumber.Value, _window.LabelLine)); + _window.CreateBottleButton.OnPressed += _ => SendMessage( + new ChemMasterOutputToBottleMessage((uint)_window.BottleDosage.Value, _window.LabelLine)); for (uint i = 0; i < _window.PillTypeButtons.Length; i++) { diff --git a/Content.Client/Chemistry/UI/ChemMasterWindow.xaml b/Content.Client/Chemistry/UI/ChemMasterWindow.xaml index 57bdd1e805..af15fe4684 100644 --- a/Content.Client/Chemistry/UI/ChemMasterWindow.xaml +++ b/Content.Client/Chemistry/UI/ChemMasterWindow.xaml @@ -1,76 +1,106 @@ - - -