Fix EmptyContainer properly.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@@ -26,8 +27,13 @@ namespace Content.Server.Construction.Completions
|
|||||||
if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) ||
|
if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) ||
|
||||||
!containerManager.TryGetContainer(Container, out var container)) return;
|
!containerManager.TryGetContainer(Container, out var container)) return;
|
||||||
|
|
||||||
container.EmptyContainer(true, entity.Transform.Coordinates);
|
// TODO: Use container helpers.
|
||||||
entity.Transform.AttachToGridOrMap();
|
foreach (var contained in container.ContainedEntities.ToArray())
|
||||||
|
{
|
||||||
|
container.ForceRemove(contained);
|
||||||
|
contained.Transform.Coordinates = entity.Transform.Coordinates;
|
||||||
|
contained.Transform.AttachToGridOrMap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user