Fix removing items from inventory dropping them too.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user