From dae3ed30063f31cae547b2aeda3bb3c45c458674 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sat, 16 Oct 2021 05:56:20 -0700 Subject: [PATCH] Fix chemmaster UI and eating pills (#4900) --- .../Chemistry/Components/ChemMasterComponent.cs | 14 +++++--------- .../Entities/Objects/Specific/chemistry.yml | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Content.Server/Chemistry/Components/ChemMasterComponent.cs b/Content.Server/Chemistry/Components/ChemMasterComponent.cs index 8ae20e0ec1..d3b6040f6f 100644 --- a/Content.Server/Chemistry/Components/ChemMasterComponent.cs +++ b/Content.Server/Chemistry/Components/ChemMasterComponent.cs @@ -177,16 +177,14 @@ namespace Content.Server.Chemistry.Components private ChemMasterBoundUserInterfaceState GetUserInterfaceState() { var beaker = BeakerContainer.ContainedEntity; - EntitySystem.Get().TryGetSolution(beaker, SolutionName, out var beakerSolution); - // TODO this is just a guess - if (beaker == null || beakerSolution == null) + if (beaker is null || !beaker.TryGetComponent(out FitsInDispenserComponent? fits) || + !EntitySystem.Get().TryGetSolution(beaker, fits.Solution, out var beakerSolution)) { return new ChemMasterBoundUserInterfaceState(Powered, false, ReagentUnit.New(0), ReagentUnit.New(0), "", Owner.Name, new List(), BufferSolution.Contents, _bufferModeTransfer, BufferSolution.TotalVolume); } - return new ChemMasterBoundUserInterfaceState(Powered, true, beakerSolution.CurrentVolume, beakerSolution.MaxVolume, beaker.Name, Owner.Name, beakerSolution.Contents, BufferSolution.Contents, _bufferModeTransfer, @@ -228,10 +226,8 @@ namespace Content.Server.Chemistry.Components if (!HasBeaker && _bufferModeTransfer) return; var beaker = BeakerContainer.ContainedEntity; - if (beaker is null) - return; - - if (!EntitySystem.Get().TryGetSolution(beaker, SolutionName, out var beakerSolution)) + if (beaker is null || !beaker.TryGetComponent(out FitsInDispenserComponent? fits) || + !EntitySystem.Get().TryGetSolution(beaker, fits.Solution, out var beakerSolution)) return; if (isBuffer) @@ -342,7 +338,7 @@ namespace Content.Server.Chemistry.Components var bufferSolution = BufferSolution.SplitSolution(actualVolume); - var pillSolution = EntitySystem.Get().EnsureSolution(pill, "pill"); + var pillSolution = EntitySystem.Get().EnsureSolution(pill, "food"); EntitySystem.Get().TryAddSolution(pill.Uid, pillSolution, bufferSolution); //Try to give them the bottle diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml index eee2944fae..bafe7c0e0a 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml @@ -240,5 +240,5 @@ eatMessage: food-swallow - type: SolutionContainerManager solutions: - pill: + food: maxVol: 50