Fix removing items from inventory dropping them too.

This commit is contained in:
Pieter-Jan Briers
2019-03-22 23:53:43 +01:00
parent 5b0f49bab7
commit 58e8aef5d8

View File

@@ -61,17 +61,16 @@ 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))