Fix quantum dispose (#24772)

* Fix quantum disposable issue

* remove force

* Iterate over all the disposal holder children instead of contained ones
This commit is contained in:
Kot
2024-02-05 00:10:30 +04:00
committed by GitHub
parent aa86b93add
commit 50e38cbd21

View File

@@ -36,8 +36,6 @@ namespace Content.Server.Disposal.Unit.EntitySystems
private EntityQuery<PhysicsComponent> _physicsQuery;
private EntityQuery<TransformComponent> _xformQuery;
private List<EntityUid> _entList = new();
public override void Initialize()
{
base.Initialize();
@@ -119,15 +117,17 @@ namespace Content.Server.Disposal.Unit.EntitySystems
}
}
_entList.Clear();
_entList.AddRange(holder.Container.ContainedEntities);
foreach (var entity in _entList)
// We're purposely iterating over all the holder's children
// because the holder might have something teleported into it,
// outside the usual container insertion logic.
var children = holderTransform.ChildEnumerator;
while (children.MoveNext(out var entity))
{
RemComp<BeingDisposedComponent>(entity);
var meta = _metaQuery.GetComponent(entity);
_containerSystem.Remove((entity, null, meta), holder.Container, reparent: false, force: true);
if (holder.Container.Contains(entity))
_containerSystem.Remove((entity, null, meta), holder.Container, reparent: false, force: true);
var xform = _xformQuery.GetComponent(entity);
if (xform.ParentUid != uid)