Revert "Purge uses of TransformComponent.Anchored.set. Also adds parentheses." (#35332)

This commit is contained in:
metalgearsloth
2025-02-21 00:12:12 +11:00
committed by GitHub
parent a4001fba1b
commit fa35c9623d
22 changed files with 34 additions and 35 deletions

View File

@@ -181,14 +181,14 @@ namespace Content.IntegrationTests.Tests.Disposal
}); });
// Can't insert, unanchored and unpowered // Can't insert, unanchored and unpowered
xformSystem.Unanchor((unitUid, entityManager.GetComponent<TransformComponent>(unitUid))); xformSystem.Unanchor(unitUid, entityManager.GetComponent<TransformComponent>(unitUid));
UnitInsertContains(disposalUnit, unitComponent, false, disposalSystem, human, wrench, disposalUnit, disposalTrunk); UnitInsertContains(disposalUnit, unitComponent, false, disposalSystem, human, wrench, disposalUnit, disposalTrunk);
}); });
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
// Anchor the disposal unit // Anchor the disposal unit
xformSystem.AnchorEntity((unitUid, entityManager.GetComponent<TransformComponent>(unitUid))); xformSystem.AnchorEntity(unitUid, entityManager.GetComponent<TransformComponent>(unitUid));
// No power // No power
Assert.That(unitComponent.Powered, Is.False); Assert.That(unitComponent.Powered, Is.False);

View File

@@ -421,7 +421,7 @@ public sealed partial class AdminVerbSystem
{ {
var xform = Transform(args.Target); var xform = Transform(args.Target);
var fixtures = Comp<FixturesComponent>(args.Target); var fixtures = Comp<FixturesComponent>(args.Target);
_transformSystem.Unanchor((args.Target, xform)); // Just in case. xform.Anchored = false; // Just in case.
_physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics); _physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics);
_physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir); _physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir);
_physics.WakeBody(args.Target, manager: fixtures, body: physics); _physics.WakeBody(args.Target, manager: fixtures, body: physics);
@@ -456,7 +456,7 @@ public sealed partial class AdminVerbSystem
{ {
var xform = Transform(args.Target); var xform = Transform(args.Target);
var fixtures = Comp<FixturesComponent>(args.Target); var fixtures = Comp<FixturesComponent>(args.Target);
_transformSystem.Unanchor((args.Target, xform)); xform.Anchored = false; // Just in case.
_physics.SetBodyType(args.Target, BodyType.Dynamic, body: physics); _physics.SetBodyType(args.Target, BodyType.Dynamic, body: physics);
_physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir); _physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir);

View File

@@ -40,7 +40,7 @@ public sealed class PipeRestrictOverlapSystem : EntitySystem
if (HasComp<AnchorableComponent>(ent) && CheckOverlap(ent)) if (HasComp<AnchorableComponent>(ent) && CheckOverlap(ent))
{ {
_popup.PopupEntity(Loc.GetString("pipe-restrict-overlap-popup-blocked", ("pipe", ent.Owner)), ent); _popup.PopupEntity(Loc.GetString("pipe-restrict-overlap-popup-blocked", ("pipe", ent.Owner)), ent);
_xform.Unanchor((ent, Transform(ent))); _xform.Unanchor(ent, Transform(ent));
} }
} }

View File

@@ -522,7 +522,7 @@ namespace Content.Server.Cargo.Systems
var item = Spawn(order.ProductId, spawn); var item = Spawn(order.ProductId, spawn);
// Ensure the item doesn't start anchored // Ensure the item doesn't start anchored
_transformSystem.Unanchor((item, Transform(item))); _transformSystem.Unanchor(item, Transform(item));
// Create a sheet of paper to write the order details on // Create a sheet of paper to write the order details on
var printed = EntityManager.SpawnEntity(paperProto, spawn); var printed = EntityManager.SpawnEntity(paperProto, spawn);

View File

@@ -11,8 +11,8 @@ namespace Content.Server.Construction.Completions
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager) public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{ {
var transformSystem = entityManager.System<SharedTransformSystem>(); var transform = entityManager.GetComponent<TransformComponent>(uid);
transformSystem.TrySetAnchor(uid, Value); transform.Anchored = Value;
} }
} }
} }

View File

@@ -364,7 +364,7 @@ namespace Content.Server.Construction
var newTransform = Transform(newUid); var newTransform = Transform(newUid);
TransformSystem.AttachToGridOrMap(newUid, newTransform); // in case in hands or a container TransformSystem.AttachToGridOrMap(newUid, newTransform); // in case in hands or a container
newTransform.LocalRotation = transform.LocalRotation; newTransform.LocalRotation = transform.LocalRotation;
TransformSystem.SetAnchor((newUid, newTransform), transform.Anchored); newTransform.Anchored = transform.Anchored;
// Container transferring. // Container transferring.
if (containerManager != null) if (containerManager != null)

View File

@@ -133,7 +133,7 @@ public sealed class DefusableSystem : SharedDefusableSystem
var xform = Transform(uid); var xform = Transform(uid);
if (!xform.Anchored) if (!xform.Anchored)
_transform.AnchorEntity((uid, xform)); _transform.AnchorEntity(uid, xform);
SetBolt(comp, true); SetBolt(comp, true);
SetActivated(comp, true); SetActivated(comp, true);
@@ -203,7 +203,7 @@ public sealed class DefusableSystem : SharedDefusableSystem
comp.Bolted = false; comp.Bolted = false;
if (xform.Anchored) if (xform.Anchored)
_transform.Unanchor((uid, xform)); _transform.Unanchor(uid, xform);
_appearance.SetData(uid, DefusableVisuals.Active, comp.Activated); _appearance.SetData(uid, DefusableVisuals.Active, comp.Activated);
} }

View File

@@ -149,7 +149,7 @@ namespace Content.Server.Explosion.EntitySystems
if (xform.Anchored) if (xform.Anchored)
return; return;
_transformSystem.AnchorEntity((uid, xform)); _transformSystem.AnchorEntity(uid, xform);
if (component.RemoveOnTrigger) if (component.RemoveOnTrigger)
RemCompDeferred<AnchorOnTriggerComponent>(uid); RemCompDeferred<AnchorOnTriggerComponent>(uid);

View File

@@ -54,7 +54,7 @@ public sealed class HolosignSystem : EntitySystem
var holoUid = EntityManager.SpawnEntity(component.SignProto, args.ClickLocation.SnapToGrid(EntityManager)); var holoUid = EntityManager.SpawnEntity(component.SignProto, args.ClickLocation.SnapToGrid(EntityManager));
var xform = Transform(holoUid); var xform = Transform(holoUid);
if (!xform.Anchored) if (!xform.Anchored)
_transform.AnchorEntity((holoUid, xform)); // anchor to prevent any tempering with (don't know what could even interact with it) _transform.AnchorEntity(holoUid, xform); // anchor to prevent any tempering with (don't know what could even interact with it)
args.Handled = true; args.Handled = true;
} }

View File

@@ -181,7 +181,7 @@ public sealed class NukeSystem : EntitySystem
var xform = Transform(uid); var xform = Transform(uid);
if (xform.Anchored) if (xform.Anchored)
{ {
_transform.Unanchor((uid, xform)); _transform.Unanchor(uid, xform);
_itemSlots.SetLock(uid, component.DiskSlot, true); _itemSlots.SetLock(uid, component.DiskSlot, true);
} }
else else
@@ -203,7 +203,7 @@ public sealed class NukeSystem : EntitySystem
} }
_transform.SetCoordinates(uid, xform, xform.Coordinates.SnapToGrid()); _transform.SetCoordinates(uid, xform, xform.Coordinates.SnapToGrid());
_transform.AnchorEntity((uid, xform)); _transform.AnchorEntity(uid, xform);
_itemSlots.SetLock(uid, component.DiskSlot, false); _itemSlots.SetLock(uid, component.DiskSlot, false);
} }
@@ -490,7 +490,7 @@ public sealed class NukeSystem : EntitySystem
if (!nukeXform.Anchored) if (!nukeXform.Anchored)
{ {
// Admin command shenanigans, just make sure. // Admin command shenanigans, just make sure.
_transform.AnchorEntity((uid, nukeXform)); _transform.AnchorEntity(uid, nukeXform);
} }
component.Status = NukeStatus.ARMED; component.Status = NukeStatus.ARMED;

View File

@@ -31,7 +31,7 @@ public sealed partial class DungeonJob
if (reservedTiles.Contains(node)) if (reservedTiles.Contains(node))
continue; continue;
if (dunGen.TileMask is not null) if (dunGen.TileMask is not null)
{ {
if (!dunGen.TileMask.Contains(((ContentTileDefinition) _tileDefManager[tileRef.Value.Tile.TypeId]).ID)) if (!dunGen.TileMask.Contains(((ContentTileDefinition) _tileDefManager[tileRef.Value.Tile.TypeId]).ID))
@@ -59,7 +59,7 @@ public sealed partial class DungeonJob
if (!xform.Comp.Anchored) if (!xform.Comp.Anchored)
{ {
_transform.AnchorEntity((ent, xform)); _transform.AnchorEntity(ent, xform);
} }
// TODO: Engine bug with SpawnAtPosition // TODO: Engine bug with SpawnAtPosition

View File

@@ -94,7 +94,7 @@ public sealed partial class DungeonJob
var xform = xformQuery.Get(ent); var xform = xformQuery.Get(ent);
if (!xform.Comp.Anchored) if (!xform.Comp.Anchored)
_transform.AnchorEntity((ent, xform)); _transform.AnchorEntity(ent, xform);
await SuspendDungeon(); await SuspendDungeon();
if (!ValidateResume()) if (!ValidateResume())

View File

@@ -195,7 +195,7 @@ public sealed partial class DungeonSystem
if (anchored && !childXform.Anchored) if (anchored && !childXform.Anchored)
_transform.AnchorEntity((ent, childXform), (gridUid, grid)); _transform.AnchorEntity((ent, childXform), (gridUid, grid));
else if (!anchored && childXform.Anchored) else if (!anchored && childXform.Anchored)
_transform.Unanchor((ent, childXform)); _transform.Unanchor(ent, childXform);
} }
// Load decals // Load decals

View File

@@ -21,7 +21,6 @@ namespace Content.Server.Rotatable
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly SharedInteractionSystem _interaction = default!; [Dependency] private readonly SharedInteractionSystem _interaction = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -113,7 +112,7 @@ namespace Content.Server.Rotatable
var entity = EntityManager.SpawnEntity(component.MirrorEntity, oldTransform.Coordinates); var entity = EntityManager.SpawnEntity(component.MirrorEntity, oldTransform.Coordinates);
var newTransform = EntityManager.GetComponent<TransformComponent>(entity); var newTransform = EntityManager.GetComponent<TransformComponent>(entity);
newTransform.LocalRotation = oldTransform.LocalRotation; newTransform.LocalRotation = oldTransform.LocalRotation;
_transform.Unanchor((entity, newTransform)); newTransform.Anchored = false;
EntityManager.DeleteEntity(uid); EntityManager.DeleteEntity(uid);
} }

View File

@@ -189,7 +189,7 @@ public sealed partial class BlockingSystem : EntitySystem
} }
//Don't allow someone to block if they're somehow not anchored. //Don't allow someone to block if they're somehow not anchored.
_transformSystem.AnchorEntity((user, xform)); _transformSystem.AnchorEntity(user, xform);
if (!xform.Anchored) if (!xform.Anchored)
{ {
CantBlockError(user); CantBlockError(user);
@@ -259,7 +259,7 @@ public sealed partial class BlockingSystem : EntitySystem
&& TryComp<PhysicsComponent>(user, out var physicsComponent)) && TryComp<PhysicsComponent>(user, out var physicsComponent))
{ {
if (xform.Anchored) if (xform.Anchored)
_transformSystem.Unanchor((user, xform)); _transformSystem.Unanchor(user, xform);
_actionsSystem.SetToggled(component.BlockingToggleActionEntity, false); _actionsSystem.SetToggled(component.BlockingToggleActionEntity, false);
_fixtureSystem.DestroyFixture(user, BlockingComponent.BlockFixtureID, body: physicsComponent); _fixtureSystem.DestroyFixture(user, BlockingComponent.BlockFixtureID, body: physicsComponent);

View File

@@ -114,7 +114,7 @@ public sealed partial class AnchorableSystem : EntitySystem
var xform = Transform(uid); var xform = Transform(uid);
RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, used)); RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, used));
_transformSystem.Unanchor((uid, xform)); _transformSystem.Unanchor(uid, xform);
RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, used)); RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, used));
_popup.PopupClient(Loc.GetString("anchorable-unanchored"), uid, args.User); _popup.PopupClient(Loc.GetString("anchorable-unanchored"), uid, args.User);
@@ -165,7 +165,7 @@ public sealed partial class AnchorableSystem : EntitySystem
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, used)); RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, used));
if (!xform.Anchored) if (!xform.Anchored)
_transformSystem.AnchorEntity((uid, xform)); _transformSystem.AnchorEntity(uid, xform);
RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, used)); RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, used));

View File

@@ -8,7 +8,7 @@ namespace Content.Shared.Construction
{ {
public abstract class SharedConstructionSystem : EntitySystem public abstract class SharedConstructionSystem : EntitySystem
{ {
[Dependency] protected readonly IMapManager MapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!; [Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!; [Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
@@ -20,7 +20,7 @@ namespace Content.Shared.Construction
if (!canBuildInImpassable) if (!canBuildInImpassable)
return null; return null;
if (!MapManager.TryFindGridAt(coords, out _, out var grid)) if (!_mapManager.TryFindGridAt(coords, out _, out var grid))
return null; return null;
var ignored = grid.GetAnchoredEntities(coords).ToHashSet(); var ignored = grid.GetAnchoredEntities(coords).ToHashSet();

View File

@@ -546,7 +546,7 @@ public abstract class SharedMagicSystem : EntitySystem
var xform = Transform(ev.Target); var xform = Transform(ev.Target);
var fixture = fixtures.Fixtures.First(); var fixture = fixtures.Fixtures.First();
_transform.Unanchor((ev.Target, xform)); _transform.Unanchor(ev.Target);
_physics.SetCanCollide(ev.Target, true, true, false, fixtures, physics); _physics.SetCanCollide(ev.Target, true, true, false, fixtures, physics);
_physics.SetCollisionMask(ev.Target, fixture.Key, fixture.Value, (int)CollisionGroup.FlyingMobMask, fixtures, physics); _physics.SetCollisionMask(ev.Target, fixture.Key, fixture.Value, (int)CollisionGroup.FlyingMobMask, fixtures, physics);
_physics.SetCollisionLayer(ev.Target, fixture.Key, fixture.Value, (int)CollisionGroup.FlyingMobLayer, fixtures, physics); _physics.SetCollisionLayer(ev.Target, fixture.Key, fixture.Value, (int)CollisionGroup.FlyingMobLayer, fixtures, physics);

View File

@@ -146,7 +146,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem
var xform = Transform(uid); var xform = Transform(uid);
if (xform.Anchored) if (xform.Anchored)
_xform.Unanchor((uid, xform)); _xform.Unanchor(uid, xform);
else else
_xform.AnchorEntity((uid, xform)); _xform.AnchorEntity((uid, xform));
@@ -241,7 +241,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem
var xform = Transform(ent); var xform = Transform(ent);
xform.NoLocalRotation = false; xform.NoLocalRotation = false;
_xform.Unanchor((ent, xform)); _xform.Unanchor(ent, xform);
Del(ent.Comp.Disguise); Del(ent.Comp.Disguise);
RemComp<ChameleonDisguisedComponent>(ent); RemComp<ChameleonDisguisedComponent>(ent);

View File

@@ -43,13 +43,13 @@ public sealed class DeployableBarrierSystem : EntitySystem
if (isDeployed && transform.GridUid != null) if (isDeployed && transform.GridUid != null)
{ {
_transform.AnchorEntity((uid, transform)); _transform.AnchorEntity(uid, transform);
if (fixture != null) if (fixture != null)
_physics.SetHard(uid, fixture, true); _physics.SetHard(uid, fixture, true);
} }
else else
{ {
_transform.Unanchor((uid, transform)); _transform.Unanchor(uid, transform);
if (fixture != null) if (fixture != null)
_physics.SetHard(uid, fixture, false); _physics.SetHard(uid, fixture, false);
} }

View File

@@ -47,7 +47,7 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem
if (comp.UnanchorOnHit && HasComp<AnchorableComponent>(hit)) if (comp.UnanchorOnHit && HasComp<AnchorableComponent>(hit))
{ {
_transform.Unanchor((hit, Transform(hit))); _transform.Unanchor(hit, Transform(hit));
} }
RemComp<MeleeThrownComponent>(hit); RemComp<MeleeThrownComponent>(hit);

View File

@@ -207,7 +207,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
_appearance.SetData(gunUid, ToggleableLightVisuals.Enabled, true, appearance); _appearance.SetData(gunUid, ToggleableLightVisuals.Enabled, true, appearance);
// Target updates // Target updates
TransformSystem.Unanchor((target, targetXform)); TransformSystem.Unanchor(target, targetXform);
component.Tethered = target; component.Tethered = target;
var tethered = EnsureComp<TetheredComponent>(target); var tethered = EnsureComp<TetheredComponent>(target);
_physics.SetBodyStatus(target, targetPhysics, BodyStatus.InAir, false); _physics.SetBodyStatus(target, targetPhysics, BodyStatus.InAir, false);