diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs index 85caf70269..fa3a65e6c5 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs @@ -109,7 +109,7 @@ namespace Content.Server.GameObjects.Components.Chemistry switch (msg.Button) { case UiButton.Eject: - TryEject(); + TryEject(obj.Session.AttachedEntity); break; case UiButton.Clear: TryClear(); @@ -189,14 +189,22 @@ namespace Content.Server.GameObjects.Components.Chemistry /// /// If this component contains an entity with a , eject it. + /// Tries to eject into user's hands first, then ejects onto dispenser if both hands are full. /// - private void TryEject() + private void TryEject(IEntity user) { - if (!HasBeaker) return; + if (!HasBeaker) + return; + + var beaker = _beakerContainer.ContainedEntity; Solution.SolutionChanged -= HandleSolutionChangedEvent; _beakerContainer.Remove(_beakerContainer.ContainedEntity); - UpdateUserInterface(); + + if(!user.TryGetComponent(out var hands) || !beaker.TryGetComponent(out var item)) + return; + if (hands.CanPutInHand(item)) + hands.PutInHand(item); } ///