Fix position swapping with QSI and artifacts (#26364)

This commit is contained in:
Nemanja
2024-04-29 05:11:07 -04:00
committed by GitHub
parent 569253940f
commit e2087115af
3 changed files with 8 additions and 21 deletions

View File

@@ -145,27 +145,14 @@ public sealed class SwapTeleporterSystem : EntitySystem
}
var teleEnt = GetTeleportingEntity((uid, xform));
var teleEntXform = Transform(teleEnt);
var otherTeleEnt = GetTeleportingEntity((linkedEnt, Transform(linkedEnt)));
var otherTeleEntXform = Transform(otherTeleEnt);
_popup.PopupEntity(Loc.GetString("swap-teleporter-popup-teleport-other",
("entity", Identity.Entity(linkedEnt, EntityManager))),
otherTeleEnt,
otherTeleEnt,
PopupType.MediumCaution);
var pos = teleEntXform.Coordinates;
var otherPos = otherTeleEntXform.Coordinates;
if (_transform.ContainsEntity(teleEnt, (otherTeleEnt, otherTeleEntXform)) ||
_transform.ContainsEntity(otherTeleEnt, (teleEnt, teleEntXform)))
{
Log.Error($"Invalid teleport swap attempt between {ToPrettyString(teleEnt)} and {ToPrettyString(otherTeleEnt)}");
return;
}
_transform.SetCoordinates(teleEnt, otherPos);
_transform.SetCoordinates(otherTeleEnt, pos);
_transform.SwapPositions(teleEnt, otherTeleEnt);
}
/// <remarks>