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,20 +61,19 @@ namespace Content.Server.GameObjects.EntitySystems
var msg = (EntParentChangedMessage) args; var msg = (EntParentChangedMessage) args;
// entity is no longer a child of OldParent, therefore it cannot be in the hand of the parent // 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); handsComp.RemoveHandEntity(msg.Entity);
} }
// deleted entities will not pass this test if (msg.Entity.Deleted)
if (!msg.Entity.TryGetComponent(out ITransformComponent transform))
return; return;
// if item is in a container // if item is in a container
if (transform.IsMapTransform) if (msg.Entity.Transform.IsMapTransform)
return; return;
if(!msg.Entity.TryGetComponent(out PhysicsComponent physics)) if (!msg.Entity.TryGetComponent(out PhysicsComponent physics))
return; return;
// set velocity to zero // set velocity to zero