Fix cursed locker collision (#3759)

This commit is contained in:
metalgearsloth
2021-04-01 18:46:23 +11:00
committed by GitHub
parent 5ecb5b9c34
commit b6f337f7f8

View File

@@ -279,17 +279,8 @@ namespace Content.Server.GameObjects.Components.Items.Storage
return false;
}
}
if (Contents.CanInsert(entity))
{
Contents.Insert(entity);
entity.Transform.LocalPosition = Vector2.Zero;
if (entityPhysicsComponent != null)
{
entityPhysicsComponent.CanCollide = false;
}
return true;
}
return false;
return Contents.CanInsert(entity) && Insert(entity);
}
public virtual Vector2 ContentsDumpPosition()
@@ -365,7 +356,14 @@ namespace Content.Server.GameObjects.Components.Items.Storage
return true;
}
return Contents.Insert(entity);
if (!Contents.Insert(entity)) return false;
entity.Transform.LocalPosition = Vector2.Zero;
if (entity.TryGetComponent(out IPhysBody? body))
{
body.CanCollide = false;
}
return true;
}
/// <inheritdoc />