]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Purge uses of TransformComponent.Anchored.set. Also adds parentheses. (#34938)
authorTemporalOroboros <TemporalOroboros@gmail.com>
Thu, 20 Feb 2025 12:06:39 +0000 (04:06 -0800)
committerGitHub <noreply@github.com>
Thu, 20 Feb 2025 12:06:39 +0000 (23:06 +1100)
22 files changed:
Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs
Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs
Content.Server/Atmos/EntitySystems/PipeRestrictOverlapSystem.cs
Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Content.Server/Construction/Completions/SetAnchor.cs
Content.Server/Construction/ConstructionSystem.Graph.cs
Content.Server/Defusable/Systems/DefusableSystem.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Content.Server/Holosign/HolosignSystem.cs
Content.Server/Nuke/NukeSystem.cs
Content.Server/Procedural/DungeonJob/DungeonJob.PostGenBiome.cs
Content.Server/Procedural/DungeonJob/DungeonJob.PostGenBiomeMarkerLayer.cs
Content.Server/Procedural/DungeonSystem.Rooms.cs
Content.Server/Rotatable/RotatableSystem.cs
Content.Shared/Blocking/BlockingSystem.cs
Content.Shared/Construction/EntitySystems/AnchorableSystem.cs
Content.Shared/Construction/SharedConstructionSystem.cs
Content.Shared/Magic/SharedMagicSystem.cs
Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs
Content.Shared/Security/Systems/DeployableBarrierSystem.cs
Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs
Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs

index 9109fdbe4f7638a4ce6f98bc61713b108814bb4d..8c087fcb25418de78b449bbfdff63ac63b613306 100644 (file)
@@ -181,14 +181,14 @@ namespace Content.IntegrationTests.Tests.Disposal
                 });
 
                 // 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);
             });
 
             await server.WaitAssertion(() =>
             {
                 // Anchor the disposal unit
-                xformSystem.AnchorEntity(unitUid, entityManager.GetComponent<TransformComponent>(unitUid));
+                xformSystem.AnchorEntity((unitUid, entityManager.GetComponent<TransformComponent>(unitUid)));
 
                 // No power
                 Assert.That(unitComponent.Powered, Is.False);
index ed46412a084ff4130d4cec795a9833f186cdd862..4ea15ced85e1c04aac86638d3d7c1e85aaa4cd13 100644 (file)
@@ -421,7 +421,7 @@ public sealed partial class AdminVerbSystem
                 {
                     var xform = Transform(args.Target);
                     var fixtures = Comp<FixturesComponent>(args.Target);
-                    xform.Anchored = false; // Just in case.
+                    _transformSystem.Unanchor((args.Target, xform)); // Just in case.
                     _physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics);
                     _physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir);
                     _physics.WakeBody(args.Target, manager: fixtures, body: physics);
@@ -456,7 +456,7 @@ public sealed partial class AdminVerbSystem
                 {
                     var xform = Transform(args.Target);
                     var fixtures = Comp<FixturesComponent>(args.Target);
-                    xform.Anchored = false; // Just in case.
+                    _transformSystem.Unanchor((args.Target, xform));
 
                     _physics.SetBodyType(args.Target, BodyType.Dynamic, body: physics);
                     _physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir);
index c2ff87ca79c3af3a03d5a262bad559b3d27b8701..032e86389335a65b9fb73913f53b98eb915f1a2e 100644 (file)
@@ -40,7 +40,7 @@ public sealed class PipeRestrictOverlapSystem : EntitySystem
         if (HasComp<AnchorableComponent>(ent) && CheckOverlap(ent))
         {
             _popup.PopupEntity(Loc.GetString("pipe-restrict-overlap-popup-blocked", ("pipe", ent.Owner)), ent);
-            _xform.Unanchor(ent, Transform(ent));
+            _xform.Unanchor((ent, Transform(ent)));
         }
     }
 
index 2c86a5590a5625151bc74b02e72ad3c7174db2ff..9a8480dd3aa05796d493eaf9dd705dd010bc5a1e 100644 (file)
@@ -522,7 +522,7 @@ namespace Content.Server.Cargo.Systems
             var item = Spawn(order.ProductId, spawn);
 
             // 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
             var printed = EntityManager.SpawnEntity(paperProto, spawn);
index 989ecc99bda6299e2ff85d31dca9b749faeeb1cb..b82db0339bf099461f114392bfc07d468ee29bd4 100644 (file)
@@ -11,8 +11,8 @@ namespace Content.Server.Construction.Completions
 
         public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
         {
-            var transform = entityManager.GetComponent<TransformComponent>(uid);
-            transform.Anchored = Value;
+            var transformSystem = entityManager.System<SharedTransformSystem>();
+            transformSystem.TrySetAnchor(uid, Value);
         }
     }
 }
index 4c73cef703d60e55c3668752310cbf2b9433df1d..fb513b6f6b7d1473f3e60a9f15695916c055f9e2 100644 (file)
@@ -364,7 +364,7 @@ namespace Content.Server.Construction
             var newTransform = Transform(newUid);
             TransformSystem.AttachToGridOrMap(newUid, newTransform); // in case in hands or a container
             newTransform.LocalRotation = transform.LocalRotation;
-            newTransform.Anchored = transform.Anchored;
+            TransformSystem.SetAnchor((newUid, newTransform), transform.Anchored);
 
             // Container transferring.
             if (containerManager != null)
index 1e9caece9456792c8750e4e6b4cb9f22ed0cb518..58a08bf91d949a68814c379af56c198df6a0ef0d 100644 (file)
@@ -133,7 +133,7 @@ public sealed class DefusableSystem : SharedDefusableSystem
 
         var xform = Transform(uid);
         if (!xform.Anchored)
-            _transform.AnchorEntity(uid, xform);
+            _transform.AnchorEntity((uid, xform));
 
         SetBolt(comp, true);
         SetActivated(comp, true);
@@ -203,7 +203,7 @@ public sealed class DefusableSystem : SharedDefusableSystem
         comp.Bolted = false;
 
         if (xform.Anchored)
-            _transform.Unanchor(uid, xform);
+            _transform.Unanchor((uid, xform));
 
         _appearance.SetData(uid, DefusableVisuals.Active, comp.Activated);
     }
index 53f6dfacf85960cab701195019418a6f9e1ff52d..8db161eeb62015fc539420af72955f0b2141301b 100644 (file)
@@ -149,7 +149,7 @@ namespace Content.Server.Explosion.EntitySystems
             if (xform.Anchored)
                 return;
 
-            _transformSystem.AnchorEntity(uid, xform);
+            _transformSystem.AnchorEntity((uid, xform));
 
             if (component.RemoveOnTrigger)
                 RemCompDeferred<AnchorOnTriggerComponent>(uid);
index b63a54598983168bdd10eb8dc641fdb8828fa009..13886ac69f20d869768284749ffc517e5271da8d 100644 (file)
@@ -54,7 +54,7 @@ public sealed class HolosignSystem : EntitySystem
         var holoUid = EntityManager.SpawnEntity(component.SignProto, args.ClickLocation.SnapToGrid(EntityManager));
         var xform = Transform(holoUid);
         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;
     }
index 84118931b109793fbaa8be38fedb6835db618d62..9c0b14ea4e1579760ce3f9a1a2438e7fa04c41b7 100644 (file)
@@ -181,7 +181,7 @@ public sealed class NukeSystem : EntitySystem
         var xform = Transform(uid);
         if (xform.Anchored)
         {
-            _transform.Unanchor(uid, xform);
+            _transform.Unanchor((uid, xform));
             _itemSlots.SetLock(uid, component.DiskSlot, true);
         }
         else
@@ -203,7 +203,7 @@ public sealed class NukeSystem : EntitySystem
             }
 
             _transform.SetCoordinates(uid, xform, xform.Coordinates.SnapToGrid());
-            _transform.AnchorEntity(uid, xform);
+            _transform.AnchorEntity((uid, xform));
             _itemSlots.SetLock(uid, component.DiskSlot, false);
         }
 
@@ -490,7 +490,7 @@ public sealed class NukeSystem : EntitySystem
         if (!nukeXform.Anchored)
         {
             // Admin command shenanigans, just make sure.
-            _transform.AnchorEntity(uid, nukeXform);
+            _transform.AnchorEntity((uid, nukeXform));
         }
 
         component.Status = NukeStatus.ARMED;
index 9e5f3bdcfc166216ee3069b37c6a2143e5ef4d6a..4f419110d569937804c67e67d1357e59023f1dd4 100644 (file)
@@ -31,7 +31,7 @@ public sealed partial class DungeonJob
 
             if (reservedTiles.Contains(node))
                 continue;
-            
+
             if (dunGen.TileMask is not null)
             {
                 if (!dunGen.TileMask.Contains(((ContentTileDefinition) _tileDefManager[tileRef.Value.Tile.TypeId]).ID))
@@ -59,7 +59,7 @@ public sealed partial class DungeonJob
 
                 if (!xform.Comp.Anchored)
                 {
-                    _transform.AnchorEntity(ent, xform);
+                    _transform.AnchorEntity((ent, xform));
                 }
 
                 // TODO: Engine bug with SpawnAtPosition
index fb0eaa01573e5196b5baa7cec30a0911296524d7..cf6a4e1794e414f6c37262938f6581067176c8f8 100644 (file)
@@ -94,7 +94,7 @@ public sealed partial class DungeonJob
                 var xform = xformQuery.Get(ent);
 
                 if (!xform.Comp.Anchored)
-                    _transform.AnchorEntity(ent, xform);
+                    _transform.AnchorEntity((ent, xform));
 
                 await SuspendDungeon();
                 if (!ValidateResume())
index f74868bb52af10bd0ce8fca9812578429c7711b4..09aad2de1ffa538a136fdfd61f225d021cb62bca 100644 (file)
@@ -195,7 +195,7 @@ public sealed partial class DungeonSystem
             if (anchored && !childXform.Anchored)
                 _transform.AnchorEntity((ent, childXform), (gridUid, grid));
             else if (!anchored && childXform.Anchored)
-                _transform.Unanchor(ent, childXform);
+                _transform.Unanchor((ent, childXform));
         }
 
         // Load decals
index 63b5e44c3d27f4bf4515de9e58503b055543682d..d516560ab9838a5a862106ecdec9e4047ca4c380 100644 (file)
@@ -21,6 +21,7 @@ namespace Content.Server.Rotatable
         [Dependency] private readonly PopupSystem _popup = default!;
         [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
         [Dependency] private readonly SharedInteractionSystem _interaction = default!;
+        [Dependency] private readonly SharedTransformSystem _transform = default!;
 
         public override void Initialize()
         {
@@ -112,7 +113,7 @@ namespace Content.Server.Rotatable
             var entity = EntityManager.SpawnEntity(component.MirrorEntity, oldTransform.Coordinates);
             var newTransform = EntityManager.GetComponent<TransformComponent>(entity);
             newTransform.LocalRotation = oldTransform.LocalRotation;
-            newTransform.Anchored = false;
+            _transform.Unanchor((entity, newTransform));
             EntityManager.DeleteEntity(uid);
         }
 
index 594d1baf6c61049254a404575f57deb9053a135c..47f137032ac46ffdbbbc89619003a851ff95b964 100644 (file)
@@ -189,7 +189,7 @@ public sealed partial class BlockingSystem : EntitySystem
             }
 
             //Don't allow someone to block if they're somehow not anchored.
-            _transformSystem.AnchorEntity(user, xform);
+            _transformSystem.AnchorEntity((user, xform));
             if (!xform.Anchored)
             {
                 CantBlockError(user);
@@ -259,7 +259,7 @@ public sealed partial class BlockingSystem : EntitySystem
                                                      && TryComp<PhysicsComponent>(user, out var physicsComponent))
         {
             if (xform.Anchored)
-                _transformSystem.Unanchor(user, xform);
+                _transformSystem.Unanchor((user, xform));
 
             _actionsSystem.SetToggled(component.BlockingToggleActionEntity, false);
             _fixtureSystem.DestroyFixture(user, BlockingComponent.BlockFixtureID, body: physicsComponent);
index 9c3d6fc9fb3245cdb01595993d862e57f64274f7..183727775ed5eefc6f99c2d7708823a181f9a76c 100644 (file)
@@ -114,7 +114,7 @@ public sealed partial class AnchorableSystem : EntitySystem
         var xform = Transform(uid);
 
         RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, used));
-        _transformSystem.Unanchor(uid, xform);
+        _transformSystem.Unanchor((uid, xform));
         RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, used));
 
         _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));
 
         if (!xform.Anchored)
-            _transformSystem.AnchorEntity(uid, xform);
+            _transformSystem.AnchorEntity((uid, xform));
 
         RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, used));
 
index a2b647ae927861ae44d2e35d6b39d2c6e96cb937..6d09b131d497ed57e3b63603dd14628d4fb3f1c9 100644 (file)
@@ -8,7 +8,7 @@ namespace Content.Shared.Construction
 {
     public abstract class SharedConstructionSystem : EntitySystem
     {
-        [Dependency] private readonly IMapManager _mapManager = default!;
+        [Dependency] protected readonly IMapManager MapManager = default!;
         [Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
         [Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
 
@@ -20,7 +20,7 @@ namespace Content.Shared.Construction
             if (!canBuildInImpassable)
                 return null;
 
-            if (!_mapManager.TryFindGridAt(coords, out _, out var grid))
+            if (!MapManager.TryFindGridAt(coords, out _, out var grid))
                 return null;
 
             var ignored = grid.GetAnchoredEntities(coords).ToHashSet();
index 0be5646f4b2535130dea0d6684c8ba8303b652d1..35eef77be396d8a95834b82e6d762c676f3e0799 100644 (file)
@@ -546,7 +546,7 @@ public abstract class SharedMagicSystem : EntitySystem
         var xform = Transform(ev.Target);
         var fixture = fixtures.Fixtures.First();
 
-        _transform.Unanchor(ev.Target);
+        _transform.Unanchor((ev.Target, xform));
         _physics.SetCanCollide(ev.Target, true, true, false, 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);
index 99737996b0873de7e8399016847f5a61ffb108d1..0d2641ae6b230c3132eb453774afd19e60d5a633 100644 (file)
@@ -146,7 +146,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem
 
         var xform = Transform(uid);
         if (xform.Anchored)
-            _xform.Unanchor(uid, xform);
+            _xform.Unanchor((uid, xform));
         else
             _xform.AnchorEntity((uid, xform));
 
@@ -241,7 +241,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem
 
         var xform = Transform(ent);
         xform.NoLocalRotation = false;
-        _xform.Unanchor(ent, xform);
+        _xform.Unanchor((ent, xform));
 
         Del(ent.Comp.Disguise);
         RemComp<ChameleonDisguisedComponent>(ent);
index 622edc4b62ecd4595856ab5e55111d4cc23d57ec..4aed7b87309bbe936ca03286909abc20c0a8e05e 100644 (file)
@@ -43,13 +43,13 @@ public sealed class DeployableBarrierSystem : EntitySystem
 
         if (isDeployed && transform.GridUid != null)
         {
-            _transform.AnchorEntity(uid, transform);
+            _transform.AnchorEntity((uid, transform));
             if (fixture != null)
                 _physics.SetHard(uid, fixture, true);
         }
         else
         {
-            _transform.Unanchor(uid, transform);
+            _transform.Unanchor((uid, transform));
             if (fixture != null)
                 _physics.SetHard(uid, fixture, false);
         }
index 7886356233034f7448e9a5c485aa2a9a37d729ea..20857770c70eed2ed406843cc3f033a8a707f3f6 100644 (file)
@@ -47,7 +47,7 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem
 
             if (comp.UnanchorOnHit && HasComp<AnchorableComponent>(hit))
             {
-                _transform.Unanchor(hit, Transform(hit));
+                _transform.Unanchor((hit, Transform(hit)));
             }
 
             RemComp<MeleeThrownComponent>(hit);
index 3d7f9df458ef98a3ebdf1679127f7737aa54c4a3..49096bfbdcfdc5ff35e780c64429b4db80f36295 100644 (file)
@@ -207,7 +207,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
         _appearance.SetData(gunUid, ToggleableLightVisuals.Enabled, true, appearance);
 
         // Target updates
-        TransformSystem.Unanchor(target, targetXform);
+        TransformSystem.Unanchor((target, targetXform));
         component.Tethered = target;
         var tethered = EnsureComp<TetheredComponent>(target);
         _physics.SetBodyStatus(target, targetPhysics, BodyStatus.InAir, false);