Actors inside storage containers are now centered on the container.

This commit is contained in:
Acruid
2020-01-03 17:28:16 -08:00
parent d98ce413bb
commit 89745202f5

View File

@@ -203,7 +203,15 @@ namespace Content.Server.GameObjects.Components
{
// Because Insert sets the local position to (0,0), and we want to keep the contents spread out,
// we re-apply the world position after inserting.
var worldPos = entity.Transform.WorldPosition;
Vector2 worldPos;
if (entity.HasComponent<IActorComponent>())
{
worldPos = Owner.Transform.WorldPosition;
}
else
{
worldPos = entity.Transform.WorldPosition;
}
Contents.Insert(entity);
entity.Transform.WorldPosition = worldPos;
return true;