From 58e8aef5d852a2e37ee72e835d8c189bb4cf7805 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Fri, 22 Mar 2019 23:53:43 +0100 Subject: [PATCH] Fix removing items from inventory dropping them too. --- Content.Server/GameObjects/EntitySystems/HandsSystem.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index d23bbed4bb..aed2d6decb 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -61,20 +61,19 @@ namespace Content.Server.GameObjects.EntitySystems var msg = (EntParentChangedMessage) args; // entity is no longer a child of OldParent, therefore it cannot be in the hand of the parent - if (msg.OldParent != null && msg.OldParent.IsValid() && msg.OldParent.TryGetComponent(out IHandsComponent handsComp)) + if (msg.OldParent != null && msg.OldParent.IsValid() && msg.OldParent.Transform != msg.Entity.Transform.Parent && msg.OldParent.TryGetComponent(out IHandsComponent handsComp)) { handsComp.RemoveHandEntity(msg.Entity); } - // deleted entities will not pass this test - if (!msg.Entity.TryGetComponent(out ITransformComponent transform)) + if (msg.Entity.Deleted) return; // if item is in a container - if (transform.IsMapTransform) + if (msg.Entity.Transform.IsMapTransform) return; - if(!msg.Entity.TryGetComponent(out PhysicsComponent physics)) + if (!msg.Entity.TryGetComponent(out PhysicsComponent physics)) return; // set velocity to zero