Another QSI Fix About Things Being in Places they Should not (#30241)
* Another QSI Fix About Things Being in Places they Should not * cleanup
This commit is contained in:
@@ -150,8 +150,11 @@ public sealed class SwapTeleporterSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var (teleEnt, cont) = GetTeleportingEntity((uid, xform));
|
||||
var (otherTeleEnt, otherCont) = GetTeleportingEntity((linkedEnt, Transform(linkedEnt)));
|
||||
var teleEnt = GetTeleportingEntity((uid, xform));
|
||||
var otherTeleEnt = GetTeleportingEntity((linkedEnt, Transform(linkedEnt)));
|
||||
|
||||
_container.TryGetOuterContainer(teleEnt, Transform(teleEnt), out var cont);
|
||||
_container.TryGetOuterContainer(otherTeleEnt, Transform(otherTeleEnt), out var otherCont);
|
||||
|
||||
if (otherCont != null && !_container.CanInsert(teleEnt, otherCont) ||
|
||||
cont != null && !_container.CanInsert(otherTeleEnt, cont))
|
||||
@@ -195,20 +198,18 @@ public sealed class SwapTeleporterSystem : EntitySystem
|
||||
DestroyLink(linked, user); // the linked one is shown globally
|
||||
}
|
||||
|
||||
private (EntityUid, BaseContainer?) GetTeleportingEntity(Entity<TransformComponent> ent)
|
||||
private EntityUid GetTeleportingEntity(Entity<TransformComponent> ent)
|
||||
{
|
||||
var parent = ent.Comp.ParentUid;
|
||||
if (_container.TryGetOuterContainer(ent, ent, out var container))
|
||||
parent = container.Owner;
|
||||
|
||||
if (HasComp<MapGridComponent>(parent) || HasComp<MapComponent>(parent))
|
||||
return (ent, container);
|
||||
return ent;
|
||||
|
||||
if (!_xformQuery.TryGetComponent(parent, out var parentXform) || parentXform.Anchored)
|
||||
return (ent, container);
|
||||
return ent;
|
||||
|
||||
if (!TryComp<PhysicsComponent>(parent, out var body) || body.BodyType == BodyType.Static)
|
||||
return (ent, container);
|
||||
return ent;
|
||||
|
||||
return GetTeleportingEntity((parent, parentXform));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user