fix borgs getting deleted by salvage magnets (#29006)

This commit is contained in:
Nemanja
2024-06-15 09:19:23 -04:00
committed by GitHub
parent e16bf41da1
commit 31d1d3b6e7

View File

@@ -130,17 +130,20 @@ public sealed partial class SalvageSystem
} }
// Uhh yeah don't delete mobs or whatever // Uhh yeah don't delete mobs or whatever
var mobQuery = AllEntityQuery<HumanoidAppearanceComponent, MobStateComponent, TransformComponent>(); var mobQuery = AllEntityQuery<MobStateComponent, TransformComponent>();
_detachEnts.Clear(); _detachEnts.Clear();
while (mobQuery.MoveNext(out var mobUid, out _, out _, out var xform)) while (mobQuery.MoveNext(out var mobUid, out _, out var xform))
{ {
if (xform.GridUid == null || !data.Comp.ActiveEntities.Contains(xform.GridUid.Value) || xform.MapUid == null) if (xform.GridUid == null || !data.Comp.ActiveEntities.Contains(xform.GridUid.Value) || xform.MapUid == null)
continue; continue;
if (_salvMobQuery.HasComp(mobUid))
continue;
// Can't parent directly to map as it runs grid traversal. // Can't parent directly to map as it runs grid traversal.
_detachEnts.Add(((mobUid, xform), xform.MapUid.Value, _transform.GetWorldPosition(xform))); _detachEnts.Add(((mobUid, xform), xform.MapUid.Value, _transform.GetWorldPosition(xform)));
_transform.DetachParentToNull(mobUid, xform); _transform.DetachEntity(mobUid, xform);
} }
// Go and cleanup the active ents. // Go and cleanup the active ents.