Fix chemmaster UI and eating pills (#4900)

This commit is contained in:
ShadowCommander
2021-10-16 05:56:20 -07:00
committed by GitHub
parent 6f63e5a888
commit dae3ed3006
2 changed files with 6 additions and 10 deletions

View File

@@ -177,16 +177,14 @@ namespace Content.Server.Chemistry.Components
private ChemMasterBoundUserInterfaceState GetUserInterfaceState() private ChemMasterBoundUserInterfaceState GetUserInterfaceState()
{ {
var beaker = BeakerContainer.ContainedEntity; var beaker = BeakerContainer.ContainedEntity;
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker, SolutionName, out var beakerSolution); if (beaker is null || !beaker.TryGetComponent(out FitsInDispenserComponent? fits) ||
// TODO this is just a guess !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker, fits.Solution, out var beakerSolution))
if (beaker == null || beakerSolution == null)
{ {
return new ChemMasterBoundUserInterfaceState(Powered, false, ReagentUnit.New(0), ReagentUnit.New(0), return new ChemMasterBoundUserInterfaceState(Powered, false, ReagentUnit.New(0), ReagentUnit.New(0),
"", Owner.Name, new List<Solution.ReagentQuantity>(), BufferSolution.Contents, _bufferModeTransfer, "", Owner.Name, new List<Solution.ReagentQuantity>(), BufferSolution.Contents, _bufferModeTransfer,
BufferSolution.TotalVolume); BufferSolution.TotalVolume);
} }
return new ChemMasterBoundUserInterfaceState(Powered, true, beakerSolution.CurrentVolume, return new ChemMasterBoundUserInterfaceState(Powered, true, beakerSolution.CurrentVolume,
beakerSolution.MaxVolume, beakerSolution.MaxVolume,
beaker.Name, Owner.Name, beakerSolution.Contents, BufferSolution.Contents, _bufferModeTransfer, beaker.Name, Owner.Name, beakerSolution.Contents, BufferSolution.Contents, _bufferModeTransfer,
@@ -228,10 +226,8 @@ namespace Content.Server.Chemistry.Components
if (!HasBeaker && _bufferModeTransfer) return; if (!HasBeaker && _bufferModeTransfer) return;
var beaker = BeakerContainer.ContainedEntity; var beaker = BeakerContainer.ContainedEntity;
if (beaker is null) if (beaker is null || !beaker.TryGetComponent(out FitsInDispenserComponent? fits) ||
return; !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker, fits.Solution, out var beakerSolution))
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker, SolutionName, out var beakerSolution))
return; return;
if (isBuffer) if (isBuffer)
@@ -342,7 +338,7 @@ namespace Content.Server.Chemistry.Components
var bufferSolution = BufferSolution.SplitSolution(actualVolume); var bufferSolution = BufferSolution.SplitSolution(actualVolume);
var pillSolution = EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(pill, "pill"); var pillSolution = EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(pill, "food");
EntitySystem.Get<SolutionContainerSystem>().TryAddSolution(pill.Uid, pillSolution, bufferSolution); EntitySystem.Get<SolutionContainerSystem>().TryAddSolution(pill.Uid, pillSolution, bufferSolution);
//Try to give them the bottle //Try to give them the bottle

View File

@@ -240,5 +240,5 @@
eatMessage: food-swallow eatMessage: food-swallow
- type: SolutionContainerManager - type: SolutionContainerManager
solutions: solutions:
pill: food:
maxVol: 50 maxVol: 50