From 90798ef922333a9b2049ace0c60529c867630759 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 16:57:34 -0800 Subject: [PATCH 01/33] Fix warnings in SharedJointSystem --- Robust.Shared/Physics/Systems/SharedJointSystem.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Robust.Shared/Physics/Systems/SharedJointSystem.cs b/Robust.Shared/Physics/Systems/SharedJointSystem.cs index ed021620710..eed28dfa50c 100644 --- a/Robust.Shared/Physics/Systems/SharedJointSystem.cs +++ b/Robust.Shared/Physics/Systems/SharedJointSystem.cs @@ -17,6 +17,7 @@ namespace Robust.Shared.Physics.Systems; public abstract partial class SharedJointSystem : EntitySystem { [Dependency] private readonly SharedContainerSystem _container = default!; + [Dependency] private readonly SharedTransformSystem _xform = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; @@ -246,7 +247,7 @@ public DistanceJoint CreateDistanceJoint( anchorA ??= Vector2.Zero; anchorB ??= Vector2.Zero; - var length = Vector2.Transform(anchorA.Value, xformA.WorldMatrix) - Vector2.Transform(anchorB.Value, xformB.WorldMatrix); + var length = Vector2.Transform(anchorA.Value, _xform.GetWorldMatrix(xformA)) - Vector2.Transform(anchorB.Value, _xform.GetWorldMatrix(xformB)); var joint = new DistanceJoint(bodyA, bodyB, anchorA.Value, anchorB.Value, length.Length()); id ??= GetJointId(joint); @@ -342,7 +343,7 @@ private Vector2 GetLocalVector2(EntityUid uid, Vector2 worldVector, TransformCom if (!Resolve(uid, ref xform)) return Vector2.Zero; - return Physics.Transform.MulT(new Quaternion2D((float) xform.WorldRotation.Theta), worldVector); + return Physics.Transform.MulT(new Quaternion2D((float)_xform.GetWorldRotation(xform).Theta), worldVector); } #endregion From af6958d5d5b60fe0c6daa1996bf0563d9a0edc95 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:02:17 -0800 Subject: [PATCH 02/33] Fix reference to EC TransformComponent method Replaces call to TransformComponent.GetMapUid with SharedTransformSystem.GetMap --- Robust.Shared/Physics/Systems/SharedPhysicsSystem.Velocities.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Velocities.cs b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Velocities.cs index c607ad5c991..2c03a26b6bc 100644 --- a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Velocities.cs +++ b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Velocities.cs @@ -45,7 +45,7 @@ public Vector2 GetMapLinearVelocity(EntityCoordinates coordinates) if (!coordinates.IsValid(EntityManager)) return Vector2.Zero; - var mapUid = coordinates.GetMapUid(EntityManager); + var mapUid = _transform.GetMap(coordinates); var parent = coordinates.EntityId; var localPos = coordinates.Position; From f26225b42b7071d52f930580fc6548217b243227 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:07:27 -0800 Subject: [PATCH 03/33] Fix obsolete calls in SharedPhysicsSystem.Contacts.cs Fixes a couple calls to obsolete varients of SetAwake and an obsolete call to RegenerateContacts by converting them to their Entity varients --- .../Physics/Systems/SharedPhysicsSystem.Contacts.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Contacts.cs b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Contacts.cs index 8523aa61832..9074f130e1c 100644 --- a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Contacts.cs +++ b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Contacts.cs @@ -646,8 +646,8 @@ private void BuildManifolds(Contact[] contacts, int count, ContactStatus[] statu var aUid = contact.EntityA; var bUid = contact.EntityB; - SetAwake(aUid, bodyA, true); - SetAwake(bUid, bodyB, true); + SetAwake((aUid, bodyA), true); + SetAwake((bUid, bodyB), true); } ArrayPool.Shared.Return(wake); @@ -773,7 +773,7 @@ public void RegenerateContacts(Entity entity) if (!PhysicsQuery.Resolve(entity.Owner, ref entity.Comp)) return; - _broadphase.RegenerateContacts(entity.Owner, entity.Comp); + _broadphase.RegenerateContacts(entity); } /// From 4ad6cb10bc3c923778a50975b3a744d6acf9ab60 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:09:26 -0800 Subject: [PATCH 04/33] Fix obsolete call in SharedPhysicsSystem.Components.cs Adds one set of parenthesis to convert a 'uid, comp, comp, comp' call to an 'Entity call. --- Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs index 1592d23160a..d0f9f5e93d7 100644 --- a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs +++ b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs @@ -535,7 +535,7 @@ public void SetBodyType(EntityUid uid, BodyType value, FixturesComponent? manage DirtyFields(uid, body, null, nameof(PhysicsComponent.Force), nameof(PhysicsComponent.Torque)); } - _broadphase.RegenerateContacts(uid, body, manager, xform); + _broadphase.RegenerateContacts((uid, body, manager, xform)); if (body.Initialized) { From 1a286297faf6e83e78cab16a013d3acdf4808f00 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:11:33 -0800 Subject: [PATCH 05/33] Removes unused local var Removes an unused list of broadphases that was being allocated in TryCollideRect --- Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs index 4e1eb5e651f..f1f3017c173 100644 --- a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs +++ b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs @@ -35,7 +35,6 @@ public partial class SharedPhysicsSystem public bool TryCollideRect(Box2 collider, MapId mapId, bool approximate = true) { var state = (collider, mapId, found: false); - var broadphases = new ValueList>(); _broadphase.GetBroadphases(mapId, collider, From fff345da1f8e1191c811350e57226f858a76b094 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:20:34 -0800 Subject: [PATCH 06/33] One-line fixes in SharedPhysicsSystem.Islands.cs Fixes all of the easy warnings regarding physics island processing, the rest require more complicated changes than a simple argument rearrangement --- .../Physics/Systems/SharedPhysicsSystem.Island.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Island.cs b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Island.cs index b3fbc3b344c..4dc01f99867 100644 --- a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Island.cs +++ b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Island.cs @@ -357,7 +357,7 @@ private void Solve(EntityUid uid, PhysicsMapComponent component, float frameTime if (body.BodyType == BodyType.Static) continue; // As static bodies can never be awake (unlike Farseer) we'll set this after the check. - SetAwake(bodyUid, body, true, updateSleepTime: false); + SetAwake((bodyUid, body), true, updateSleepTime: false); var node = body.Contacts.First; @@ -976,7 +976,7 @@ private void FinalisePositions(int start, int end, int offset, List Date: Wed, 5 Feb 2025 17:27:38 -0800 Subject: [PATCH 07/33] Fix obsolete method call in SharedMapSystem --- .../GameObjects/Systems/SharedMapSystem.Coordinates.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs index 288d42f7a6c..7ff85746be3 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Coordinates.cs @@ -23,7 +23,7 @@ public EntityCoordinates AlignToGrid(EntityCoordinates coordinates) } // Check if mappos intersects a grid. - var mapPos = coordinates.ToMap(EntityManager, _transform); + var mapPos = _transform.ToMapCoordinates(coordinates); if (_mapInternal.TryFindGridAt(mapPos, out var gridUid, out gridComponent)) { From 392fd380647bffbe48f67c0537142c76335680d2 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:29:56 -0800 Subject: [PATCH 08/33] Fix a few obsolete ToMap calls in EntityLookup.Queries --- .../GameObjects/Systems/EntityLookup.Queries.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs index 79622432b32..f09a41fe35d 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs @@ -429,7 +429,7 @@ public IEnumerable GetEntitiesInArc( float arcWidth, LookupFlags flags = DefaultFlags) { - var position = coordinates.ToMap(EntityManager, _transform); + var position = _transform.ToMapCoordinates(coordinates); return GetEntitiesInArc(position, range, direction, arcWidth, flags); } @@ -632,7 +632,7 @@ public bool AnyEntitiesIntersecting(EntityCoordinates coordinates, LookupFlags f if (!coordinates.IsValid(EntityManager)) return false; - var mapPos = coordinates.ToMap(EntityManager, _transform); + var mapPos = _transform.ToMapCoordinates(coordinates); return AnyEntitiesIntersecting(mapPos, flags); } @@ -641,13 +641,13 @@ public bool AnyEntitiesInRange(EntityCoordinates coordinates, float range, Looku if (!coordinates.IsValid(EntityManager)) return false; - var mapPos = coordinates.ToMap(EntityManager, _transform); + var mapPos = _transform.ToMapCoordinates(coordinates); return AnyEntitiesInRange(mapPos, range, flags); } public HashSet GetEntitiesIntersecting(EntityCoordinates coordinates, LookupFlags flags = DefaultFlags) { - var mapPos = coordinates.ToMap(EntityManager, _transform); + var mapPos = _transform.ToMapCoordinates(coordinates); return GetEntitiesIntersecting(mapPos, flags); } @@ -660,7 +660,7 @@ public HashSet GetEntitiesInRange(EntityCoordinates coordinates, floa public void GetEntitiesInRange(EntityCoordinates coordinates, float range, HashSet entities, LookupFlags flags = DefaultFlags) { - var mapPos = coordinates.ToMap(EntityManager, _transform); + var mapPos = _transform.ToMapCoordinates(coordinates); if (mapPos.MapId == MapId.Nullspace) return; From 0a432a4cfc8ea276dae97ea8f6012ca972c69127 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:35:46 -0800 Subject: [PATCH 09/33] Fix calls to obsolete EntityCoordinate methods in SharedMapSystem.Grids --- Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs index 7af2d9cb4ca..55ec9627493 100644 --- a/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs +++ b/Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs @@ -1217,7 +1217,7 @@ public Vector2i TileIndicesFor(EntityUid uid, MapGridComponent grid, EntityCoord { #if DEBUG var mapId = _xformQuery.GetComponent(uid).MapID; - DebugTools.Assert(mapId == coords.GetMapId(EntityManager)); + DebugTools.Assert(mapId == _transform.GetMapId(coords)); #endif return SnapGridLocalCellFor(uid, grid, LocalToGrid(uid, grid, coords)); @@ -1427,7 +1427,7 @@ public Vector2i CoordinatesToTile(EntityUid uid, MapGridComponent grid, EntityCo { #if DEBUG var mapId = _xformQuery.GetComponent(uid).MapID; - DebugTools.Assert(mapId == coords.GetMapId(EntityManager)); + DebugTools.Assert(mapId == _transform.GetMapId(coords)); #endif var local = LocalToGrid(uid, grid, coords); @@ -1449,7 +1449,7 @@ public Vector2 LocalToGrid(EntityUid uid, MapGridComponent grid, EntityCoordinat { return position.EntityId == uid ? position.Position - : WorldToLocal(uid, grid, position.ToMapPos(EntityManager, _transform)); + : WorldToLocal(uid, grid, _transform.ToMapCoordinates(position).Position); } public bool CollidesWithGrid(EntityUid uid, MapGridComponent grid, Vector2i indices) From 96437ee40132e7bc14b90ccf38f8f7cf1a63846f Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:36:58 -0800 Subject: [PATCH 10/33] Fix calls to obsolete EntityCoordinate methods in SharedLookupSystem.ComponentQueries --- .../GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs index 02a27db41e9..ea14f1f3a87 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs @@ -627,7 +627,7 @@ public void GetEntitiesIntersecting(MapId mapId, TShape shape, Transf public void GetEntitiesInRange(EntityCoordinates coordinates, float range, HashSet> entities, LookupFlags flags = DefaultFlags) where T : IComponent { - var mapPos = coordinates.ToMap(EntityManager, _transform); + var mapPos = _transform.ToMapCoordinates(coordinates); GetEntitiesInRange(mapPos, range, entities, flags); } From 3937c583f5b36caff616cbccde5508611e108d6b Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:53:31 -0800 Subject: [PATCH 11/33] Fix a few obsolete method calls in entity spawning --- Robust.Shared/GameObjects/EntityManager.Spawn.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Robust.Shared/GameObjects/EntityManager.Spawn.cs b/Robust.Shared/GameObjects/EntityManager.Spawn.cs index 2739308fa9a..74ff674efc3 100644 --- a/Robust.Shared/GameObjects/EntityManager.Spawn.cs +++ b/Robust.Shared/GameObjects/EntityManager.Spawn.cs @@ -79,7 +79,7 @@ public virtual EntityUid SpawnAttachedTo(string? protoName, EntityCoordinates co throw new InvalidOperationException($"Tried to spawn entity {protoName} on invalid coordinates {coordinates}."); var entity = CreateEntityUninitialized(protoName, coordinates, overrides, rotation); - InitializeAndStartEntity(entity, coordinates.GetMapId(this)); + InitializeAndStartEntity(entity, _xforms.GetMapId(coordinates)); return entity; } @@ -100,7 +100,7 @@ public virtual EntityUid Spawn(string? protoName, MapCoordinates coordinates, Co [MethodImpl(MethodImplOptions.AggressiveInlining)] public EntityUid SpawnAtPosition(string? protoName, EntityCoordinates coordinates, ComponentRegistry? overrides = null) - => Spawn(protoName, coordinates.ToMap(this, _xforms), overrides); + => Spawn(protoName, _xforms.ToMapCoordinates(coordinates), overrides); public bool TrySpawnNextTo( string? protoName, From f8685486983380388adb7359a1b71a92754aa809 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:55:55 -0800 Subject: [PATCH 12/33] Fix obsolete method calls in MapLoaderSystem --- Robust.Server/GameObjects/EntitySystems/MapLoaderSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Robust.Server/GameObjects/EntitySystems/MapLoaderSystem.cs b/Robust.Server/GameObjects/EntitySystems/MapLoaderSystem.cs index c956a9c975f..1898df9b292 100644 --- a/Robust.Server/GameObjects/EntitySystems/MapLoaderSystem.cs +++ b/Robust.Server/GameObjects/EntitySystems/MapLoaderSystem.cs @@ -844,7 +844,7 @@ private void StartupEntities(MapData data) if (xformQuery.TryGetComponent(rootEntity, out var xform) && IsRoot(xform, mapQuery) && !HasComp(rootEntity)) { - _transform.SetLocalPosition(xform, Vector2.Transform(xform.LocalPosition, data.Options.TransformMatrix)); + _transform.SetLocalPosition(rootEntity, Vector2.Transform(xform.LocalPosition, data.Options.TransformMatrix), xform); xform.LocalRotation += data.Options.Rotation; } } @@ -979,7 +979,7 @@ private void WriteMetaSection(MappingDataNode rootNode, EntityUid uid) meta.Add("format", MapFormatVersion.ToString(CultureInfo.InvariantCulture)); var xform = Transform(uid); - var isPostInit = _mapManager.IsMapInitialized(xform.MapID); + var isPostInit = _mapSystem.IsInitialized(xform.MapID); meta.Add("postmapinit", isPostInit ? "true" : "false"); } From f35984c10a044f1fee2e7baa2ac05c845e333d15 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 17:57:25 -0800 Subject: [PATCH 13/33] Fix obsolete method call in GridFixtureSystem --- Robust.Server/Physics/GridFixtureSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Robust.Server/Physics/GridFixtureSystem.cs b/Robust.Server/Physics/GridFixtureSystem.cs index 30d956c7683..e3f79a4dd10 100644 --- a/Robust.Server/Physics/GridFixtureSystem.cs +++ b/Robust.Server/Physics/GridFixtureSystem.cs @@ -268,8 +268,8 @@ private void CheckSplits(EntityUid uid, HashSet dirtyNodes) newGrids[i] = newGridUid; // Keep same origin / velocity etc; this makes updating a lot faster and easier. - _xformSystem.SetWorldPosition(newGridXform, gridPos); - _xformSystem.SetWorldPositionRotation(newGridUid, gridPos, gridRot, newGridXform); + _xformSystem.SetWorldPosition((newGridUid, newGridXform), gridPos); + _xformSystem.SetWorldPositionRotation(newGridUid, gridPos, gridRot, newGridXform); // Why do we set this twice??? var splitBody = _bodyQuery.GetComponent(newGridUid); _physics.SetLinearVelocity(newGridUid, mapBody.LinearVelocity, body: splitBody); _physics.SetAngularVelocity(newGridUid, mapBody.AngularVelocity, body: splitBody); From 4141ff1c8867badc290baf7ce6973eade519527b Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 18:01:02 -0800 Subject: [PATCH 14/33] Fix obsolete IsMapInitialized call in SaveMap command --- Robust.Server/Console/Commands/MapCommands.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Robust.Server/Console/Commands/MapCommands.cs b/Robust.Server/Console/Commands/MapCommands.cs index 83a1bcf4769..6a92783fd8c 100644 --- a/Robust.Server/Console/Commands/MapCommands.cs +++ b/Robust.Server/Console/Commands/MapCommands.cs @@ -195,7 +195,8 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) return; } - if (_map.IsMapInitialized(mapId) && + var _mapSystem = _system.GetEntitySystem(); + if (_mapSystem.IsInitialized(mapId) && ( args.Length < 3 || !bool.TryParse(args[2], out var force) || !force)) { shell.WriteError(Loc.GetString("cmd-savemap-init-warning")); From e05e02331b57d899e04494045edc6173f91bfd10 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 18:34:47 -0800 Subject: [PATCH 15/33] Fix obsolete MapPosition reference in Client.EyeSystem --- Robust.Client/GameObjects/EntitySystems/EyeSystem.cs | 2 +- Robust.Shared/GameObjects/Systems/SharedEyeSystem.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Robust.Client/GameObjects/EntitySystems/EyeSystem.cs b/Robust.Client/GameObjects/EntitySystems/EyeSystem.cs index f2a7bba70c6..75679f820ee 100644 --- a/Robust.Client/GameObjects/EntitySystems/EyeSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/EyeSystem.cs @@ -62,7 +62,7 @@ public override void FrameUpdate(float frameTime) eyeComponent.Target = null; } - eyeComponent.Eye.Position = xform.MapPosition; + eyeComponent.Eye.Position = TransformSystem.GetMapCoordinates(xform); } } } diff --git a/Robust.Shared/GameObjects/Systems/SharedEyeSystem.cs b/Robust.Shared/GameObjects/Systems/SharedEyeSystem.cs index 2ef8538794f..483d9b21eaa 100644 --- a/Robust.Shared/GameObjects/Systems/SharedEyeSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedEyeSystem.cs @@ -9,6 +9,7 @@ namespace Robust.Shared.GameObjects; public abstract class SharedEyeSystem : EntitySystem { [Dependency] private readonly SharedViewSubscriberSystem _views = default!; + [Dependency] protected readonly SharedTransformSystem TransformSystem = default!; public override void Initialize() { From e1699e0a19135ea0c352cf62b76e117a98019647 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 18:36:36 -0800 Subject: [PATCH 16/33] Fix obsolete EntitySystem.Get references in DebugLightTreeSystem --- .../GameObjects/EntitySystems/DebugLightTreeSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs b/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs index 042ac093473..cc41a5482ee 100644 --- a/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/DebugLightTreeSystem.cs @@ -26,10 +26,10 @@ public bool Enabled if (_enabled) { _lightOverlay = new DebugLightOverlay( - EntitySystem.Get(), + EntityManager.System(), IoCManager.Resolve(), IoCManager.Resolve(), - Get()); + EntityManager.System()); overlayManager.AddOverlay(_lightOverlay); } From 2731fcac7fc99cfb32c91af03e4d6cf07bbf5d6e Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 18:38:25 -0800 Subject: [PATCH 17/33] Fix obsolete EntitySystem.Get reference in DebugEntityLookup command --- .../GameObjects/EntitySystems/DebugEntityLookupSystem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs b/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs index b8f4c8a0546..f8a6894617d 100644 --- a/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs @@ -15,11 +15,13 @@ namespace Robust.Client.GameObjects; public sealed class DebugEntityLookupCommand : LocalizedCommands { + [Dependency] private readonly IEntityManager _entityManager = default!; + public override string Command => "togglelookup"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get().Enabled ^= true; + _entityManager.System().Enabled ^= true; } } From 37b8a2ee650a79b7d4992f300a2c03936f329a7c Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 18:47:30 -0800 Subject: [PATCH 18/33] Fix obsolete method calls in SpriteBoundsOverlay Slightly more complicated than the rest, but it's really just changing an unused dependency over to use SharedTransformSystem --- .../Components/Renderable/SpriteBoundsOverlay.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs index 9a2a528b6ba..ac047782f07 100644 --- a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs +++ b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs @@ -16,13 +16,15 @@ public sealed class ShowSpriteBBCommand : LocalizedCommands public override void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get().Enabled ^= true; + IoCManager.Resolve() + .System() + .Enabled ^= true; } } public sealed class SpriteBoundsSystem : EntitySystem { - [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly SharedTransformSystem _xformSystem = default!; [Dependency] private readonly IOverlayManager _overlayManager = default!; [Dependency] private readonly SpriteTreeSystem _spriteTree = default!; @@ -40,7 +42,7 @@ public bool Enabled if (_enabled) { DebugTools.AssertNull(_overlay); - _overlay = new SpriteBoundsOverlay(_spriteTree, _entityManager); + _overlay = new SpriteBoundsOverlay(_spriteTree, _xformSystem); _overlayManager.AddOverlay(_overlay); } else @@ -59,13 +61,13 @@ public sealed class SpriteBoundsOverlay : Overlay { public override OverlaySpace Space => OverlaySpace.WorldSpace; - private readonly IEntityManager _entityManager; + private readonly SharedTransformSystem _xformSystem; private SpriteTreeSystem _renderTree; - public SpriteBoundsOverlay(SpriteTreeSystem renderTree, IEntityManager entityManager) + public SpriteBoundsOverlay(SpriteTreeSystem renderTree, SharedTransformSystem xformSystem) { _renderTree = renderTree; - _entityManager = entityManager; + _xformSystem = xformSystem; } protected internal override void Draw(in OverlayDrawArgs args) @@ -76,7 +78,7 @@ protected internal override void Draw(in OverlayDrawArgs args) foreach (var (sprite, xform) in _renderTree.QueryAabb(currentMap, viewport)) { - var (worldPos, worldRot) = xform.GetWorldPositionRotation(); + var (worldPos, worldRot) = _xformSystem.GetWorldPositionRotation(xform); var bounds = sprite.CalculateRotatedBoundingBox(worldPos, worldRot, args.Viewport.Eye?.Rotation ?? default); // Get scaled down bounds used to indicate the "south" of a sprite. From 1e96ccc77e26eae9e6949f94ab313ff809e526ad Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 18:50:14 -0800 Subject: [PATCH 19/33] Remove unused IClyde references from controls LineEdit and TextEdit never use their IClyde dependencies and it generates a warning so yeet --- Robust.Client/UserInterface/Controls/LineEdit.cs | 1 - Robust.Client/UserInterface/Controls/TextEdit.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/Robust.Client/UserInterface/Controls/LineEdit.cs b/Robust.Client/UserInterface/Controls/LineEdit.cs index 2007a3395b1..dd3a49a85f3 100644 --- a/Robust.Client/UserInterface/Controls/LineEdit.cs +++ b/Robust.Client/UserInterface/Controls/LineEdit.cs @@ -21,7 +21,6 @@ namespace Robust.Client.UserInterface.Controls [Virtual] public class LineEdit : Control { - [Dependency] private readonly IClyde _clyde = default!; [Dependency] private readonly IConfigurationManager _cfgManager = default!; [Dependency] private readonly IGameTiming _timing = default!; diff --git a/Robust.Client/UserInterface/Controls/TextEdit.cs b/Robust.Client/UserInterface/Controls/TextEdit.cs index a714f72cb93..9781fa287bc 100644 --- a/Robust.Client/UserInterface/Controls/TextEdit.cs +++ b/Robust.Client/UserInterface/Controls/TextEdit.cs @@ -38,7 +38,6 @@ namespace Robust.Client.UserInterface.Controls; public sealed class TextEdit : Control { [Dependency] private readonly IClipboardManager _clipboard = null!; - [Dependency] private readonly IClyde _clyde = null!; // @formatter:off public const string StylePropertyCursorColor = "cursor-color"; From 92a7319b27d9914c5fa98b0f78442aad94ce2577 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 18:52:33 -0800 Subject: [PATCH 20/33] Remove use of EntitySystem.Get from lightbb command --- Robust.Client/Console/Commands/LightBBCommand.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Robust.Client/Console/Commands/LightBBCommand.cs b/Robust.Client/Console/Commands/LightBBCommand.cs index 107f8146de7..b3640c9e984 100644 --- a/Robust.Client/Console/Commands/LightBBCommand.cs +++ b/Robust.Client/Console/Commands/LightBBCommand.cs @@ -2,6 +2,7 @@ using Robust.Client.GameObjects; using Robust.Shared.Console; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { @@ -11,7 +12,9 @@ internal sealed class LightDebugCommand : LocalizedCommands public override void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get().Enabled ^= true; + IoCManager.Resolve() + .GetEntitySystem() + .Enabled ^= true; } } } From 43a80eadf06886f586eac670345f9545128c436f Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 18:59:05 -0800 Subject: [PATCH 21/33] Fix DebugDrawingSystem Removes a bunch of unused private IEntityManager vars Also removes an obsolete use of TransformComponent.GetWorldPositionRotation --- Robust.Client/Debugging/DebugDrawingSystem.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Robust.Client/Debugging/DebugDrawingSystem.cs b/Robust.Client/Debugging/DebugDrawingSystem.cs index 897fee0d667..0509d25088c 100644 --- a/Robust.Client/Debugging/DebugDrawingSystem.cs +++ b/Robust.Client/Debugging/DebugDrawingSystem.cs @@ -38,7 +38,7 @@ public bool DebugPositions if (value && !_overlayManager.HasOverlay()) { - _overlayManager.AddOverlay(new EntityPositionOverlay(_lookup, EntityManager, _transform)); + _overlayManager.AddOverlay(new EntityPositionOverlay(_lookup, _transform)); } else { @@ -64,7 +64,7 @@ public bool DebugRotations if (value && !_overlayManager.HasOverlay()) { - _overlayManager.AddOverlay(new EntityRotationOverlay(_lookup, EntityManager)); + _overlayManager.AddOverlay(new EntityRotationOverlay(_lookup, _transform)); } else { @@ -76,15 +76,13 @@ public bool DebugRotations private sealed class EntityPositionOverlay : Overlay { private readonly EntityLookupSystem _lookup; - private readonly IEntityManager _entityManager; private readonly SharedTransformSystem _transform; public override OverlaySpace Space => OverlaySpace.WorldSpace; - public EntityPositionOverlay(EntityLookupSystem lookup, IEntityManager entityManager, SharedTransformSystem transform) + public EntityPositionOverlay(EntityLookupSystem lookup, SharedTransformSystem transform) { _lookup = lookup; - _entityManager = entityManager; _transform = transform; } @@ -110,25 +108,24 @@ protected internal override void Draw(in OverlayDrawArgs args) private sealed class EntityRotationOverlay : Overlay { private readonly EntityLookupSystem _lookup; - private readonly IEntityManager _entityManager; + private readonly TransformSystem _xformSystem; public override OverlaySpace Space => OverlaySpace.WorldSpace; - public EntityRotationOverlay(EntityLookupSystem lookup, IEntityManager entityManager) + public EntityRotationOverlay(EntityLookupSystem lookup, TransformSystem xformSystem) { _lookup = lookup; - _entityManager = entityManager; + _xformSystem = xformSystem; } protected internal override void Draw(in OverlayDrawArgs args) { const float stubLength = 0.25f; var worldHandle = (DrawingHandleWorld) args.DrawingHandle; - var xformQuery = _entityManager.GetEntityQuery(); foreach (var entity in _lookup.GetEntitiesIntersecting(args.MapId, args.WorldBounds)) { - var (center, worldRotation) = xformQuery.GetComponent(entity).GetWorldPositionRotation(); + var (center, worldRotation) = _xformSystem.GetWorldPositionRotation(entity); var drawLine = worldRotation.RotateVec(-Vector2.UnitY); From 2377cb522f63b074c9213692d7f6d7968f8a3875 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:11:31 -0800 Subject: [PATCH 22/33] Removes duplicate position set when splitting grids There's nothing saying why this is this way and the blame looks like it was an oversight when replacing a bit where they set position and then rotation Please, oh Chesterton's Fence, spare me your wrath --- Robust.Server/Physics/GridFixtureSystem.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Robust.Server/Physics/GridFixtureSystem.cs b/Robust.Server/Physics/GridFixtureSystem.cs index e3f79a4dd10..8aef85426d4 100644 --- a/Robust.Server/Physics/GridFixtureSystem.cs +++ b/Robust.Server/Physics/GridFixtureSystem.cs @@ -268,8 +268,7 @@ private void CheckSplits(EntityUid uid, HashSet dirtyNodes) newGrids[i] = newGridUid; // Keep same origin / velocity etc; this makes updating a lot faster and easier. - _xformSystem.SetWorldPosition((newGridUid, newGridXform), gridPos); - _xformSystem.SetWorldPositionRotation(newGridUid, gridPos, gridRot, newGridXform); // Why do we set this twice??? + _xformSystem.SetWorldPositionRotation(newGridUid, gridPos, gridRot, newGridXform); var splitBody = _bodyQuery.GetComponent(newGridUid); _physics.SetLinearVelocity(newGridUid, mapBody.LinearVelocity, body: splitBody); _physics.SetAngularVelocity(newGridUid, mapBody.AngularVelocity, body: splitBody); From 5c6c250253b86a84daa6730d9d651ec439989cfb Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:20:25 -0800 Subject: [PATCH 23/33] Fix obsolete method use in PlacementMode --- Robust.Client/Placement/PlacementMode.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Robust.Client/Placement/PlacementMode.cs b/Robust.Client/Placement/PlacementMode.cs index f3e6ea67c76..00956d30c64 100644 --- a/Robust.Client/Placement/PlacementMode.cs +++ b/Robust.Client/Placement/PlacementMode.cs @@ -121,8 +121,8 @@ public virtual void Render(in OverlayDrawArgs args) { if (!coordinate.IsValid(pManager.EntityManager)) return; // Just some paranoia just in case - var worldPos = coordinate.ToMapPos(pManager.EntityManager, transformSys); - var worldRot = pManager.EntityManager.GetComponent(coordinate.EntityId).WorldRotation + dirAng; + var worldPos = transformSys.ToMapCoordinates(coordinate).Position; + var worldRot = transformSys.GetWorldRotation(coordinate.EntityId) + dirAng; sprite.Color = IsValidPosition(coordinate) ? ValidPlaceColor : InvalidPlaceColor; var rot = args.Viewport.Eye?.Rotation ?? default; @@ -144,7 +144,7 @@ public IEnumerable LineCoordinates() if (mousePos.MapId == MapId.Nullspace) yield break; - var (_, (x, y)) = EntityCoordinates.FromMap(pManager.StartPoint.EntityId, mousePos, transformSys, pManager.EntityManager) - pManager.StartPoint; + var (_, (x, y)) = transformSys.ToCoordinates(pManager.StartPoint.EntityId, mousePos) - pManager.StartPoint; float iterations; Vector2 distance; if (Math.Abs(x) > Math.Abs(y)) @@ -176,7 +176,7 @@ public IEnumerable GridCoordinates() if (mousePos.MapId == MapId.Nullspace) yield break; - var placementdiff = EntityCoordinates.FromMap(pManager.StartPoint.EntityId, mousePos, transformSys, pManager.EntityManager) - pManager.StartPoint; + var placementdiff = transformSys.ToCoordinates(pManager.StartPoint.EntityId, mousePos) - pManager.StartPoint; var xSign = Math.Sign(placementdiff.X); var ySign = Math.Sign(placementdiff.Y); @@ -230,7 +230,7 @@ public bool RangeCheck(EntityCoordinates coordinates) var range = pManager.CurrentPermission!.Range; var transformSys = pManager.EntityManager.System(); - if (range > 0 && !pManager.EntityManager.GetComponent(controlled).Coordinates.InRange(pManager.EntityManager, transformSys, coordinates, range)) + if (range > 0 && !transformSys.InRange(pManager.EntityManager.GetComponent(controlled).Coordinates, coordinates, range)) return false; return true; } @@ -239,7 +239,7 @@ public bool IsColliding(EntityCoordinates coordinates) { var bounds = pManager.ColliderAABB; var transformSys = pManager.EntityManager.System(); - var mapCoords = coordinates.ToMap(pManager.EntityManager, transformSys); + var mapCoords = transformSys.ToMapCoordinates(coordinates); var (x, y) = mapCoords.Position; var collisionBox = Box2.FromDimensions( @@ -248,7 +248,9 @@ public bool IsColliding(EntityCoordinates coordinates) bounds.Width, bounds.Height); - return EntitySystem.Get().TryCollideRect(collisionBox, mapCoords.MapId); + return pManager.EntityManager + .System() + .TryCollideRect(collisionBox, mapCoords.MapId); } protected Vector2 ScreenToWorld(Vector2 point) @@ -264,13 +266,13 @@ protected Vector2 WorldToScreen(Vector2 point) protected EntityCoordinates ScreenToCursorGrid(ScreenCoordinates coords) { var mapCoords = pManager.EyeManager.PixelToMap(coords.Position); + var transformSys = pManager.EntityManager.System(); if (!pManager.MapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid)) { - return EntityCoordinates.FromMap(pManager.MapManager, mapCoords); + return transformSys.ToCoordinates(mapCoords); } - var transformSys = pManager.EntityManager.System(); - return EntityCoordinates.FromMap(gridUid, mapCoords, transformSys, pManager.EntityManager); + return transformSys.ToCoordinates(gridUid, mapCoords); } } } From 1816592c5b43f3053228dcbbda3a20dcec397bd4 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:27:20 -0800 Subject: [PATCH 24/33] Fix obsolete method use in Placement Modes --- Robust.Client/Placement/Modes/AlignSimilar.cs | 13 ++++++++----- .../Placement/Modes/AlignSnapgridBorder.cs | 3 ++- Robust.Client/Placement/Modes/AlignTileDense.cs | 4 +++- Robust.Client/Placement/Modes/AlignTileNonDense.cs | 4 +++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Robust.Client/Placement/Modes/AlignSimilar.cs b/Robust.Client/Placement/Modes/AlignSimilar.cs index 94a1eb191f8..b7a1d71a371 100644 --- a/Robust.Client/Placement/Modes/AlignSimilar.cs +++ b/Robust.Client/Placement/Modes/AlignSimilar.cs @@ -30,11 +30,13 @@ public override void AlignPlacementMode(ScreenCoordinates mouseScreen) return; } - var mapId = MouseCoords.GetMapId(pManager.EntityManager); + var transformSys = pManager.EntityManager.System(); + var mapId = transformSys.GetMapId(MouseCoords); - var snapToEntities = EntitySystem.Get().GetEntitiesInRange(MouseCoords, SnapToRange) + var snapToEntities = pManager.EntityManager.System() + .GetEntitiesInRange(MouseCoords, SnapToRange) .Where(entity => pManager.EntityManager.GetComponent(entity).EntityPrototype == pManager.CurrentPrototype && pManager.EntityManager.GetComponent(entity).MapID == mapId) - .OrderBy(entity => (pManager.EntityManager.GetComponent(entity).WorldPosition - MouseCoords.ToMapPos(pManager.EntityManager, pManager.EntityManager.System())).LengthSquared()) + .OrderBy(entity => (transformSys.GetWorldPosition(entity) - transformSys.ToMapCoordinates(MouseCoords).Position).LengthSquared()) .ToList(); if (snapToEntities.Count == 0) @@ -51,10 +53,11 @@ public override void AlignPlacementMode(ScreenCoordinates mouseScreen) var closestBounds = component.BaseRSI.Size; + var closestPos = transformSys.GetWorldPosition(closestTransform); var closestRect = Box2.FromDimensions( - closestTransform.WorldPosition.X - closestBounds.X / 2f, - closestTransform.WorldPosition.Y - closestBounds.Y / 2f, + closestPos.X - closestBounds.X / 2f, + closestPos.Y - closestBounds.Y / 2f, closestBounds.X, closestBounds.Y); var sides = new[] diff --git a/Robust.Client/Placement/Modes/AlignSnapgridBorder.cs b/Robust.Client/Placement/Modes/AlignSnapgridBorder.cs index f3a4d3dff2d..69aceae37d7 100644 --- a/Robust.Client/Placement/Modes/AlignSnapgridBorder.cs +++ b/Robust.Client/Placement/Modes/AlignSnapgridBorder.cs @@ -21,7 +21,8 @@ public override void AlignPlacementMode(ScreenCoordinates mouseScreen) { MouseCoords = ScreenToCursorGrid(mouseScreen); - var gridIdOpt = MouseCoords.GetGridUid(pManager.EntityManager); + var transformSys = pManager.EntityManager.System(); + var gridIdOpt = transformSys.GetGrid(MouseCoords); SnapSize = 1f; if (gridIdOpt is EntityUid gridId && gridId.IsValid()) { diff --git a/Robust.Client/Placement/Modes/AlignTileDense.cs b/Robust.Client/Placement/Modes/AlignTileDense.cs index 50af90644b8..f76626113b9 100644 --- a/Robust.Client/Placement/Modes/AlignTileDense.cs +++ b/Robust.Client/Placement/Modes/AlignTileDense.cs @@ -16,8 +16,10 @@ public override void AlignPlacementMode(ScreenCoordinates mouseScreen) { MouseCoords = ScreenToCursorGrid(mouseScreen); + var transformSys = pManager.EntityManager.System(); + var tileSize = 1f; - var gridIdOpt = MouseCoords.GetGridUid(pManager.EntityManager); + var gridIdOpt = transformSys.GetGrid(MouseCoords); if (gridIdOpt is EntityUid gridId && gridId.IsValid()) { diff --git a/Robust.Client/Placement/Modes/AlignTileNonDense.cs b/Robust.Client/Placement/Modes/AlignTileNonDense.cs index ef601ef74df..ceae17485ce 100644 --- a/Robust.Client/Placement/Modes/AlignTileNonDense.cs +++ b/Robust.Client/Placement/Modes/AlignTileNonDense.cs @@ -16,9 +16,11 @@ public override void AlignPlacementMode(ScreenCoordinates mouseScreen) { MouseCoords = ScreenToCursorGrid(mouseScreen); + var transformSys = pManager.EntityManager.System(); + var tileSize = 1f; - var gridIdOpt = MouseCoords.GetGridUid(pManager.EntityManager); + var gridIdOpt = transformSys.GetGrid(MouseCoords); if (gridIdOpt is EntityUid gridId && gridId.IsValid()) { var mapGrid = pManager.EntityManager.GetComponent(gridId); From d0f02240f0d1c93ae462fe66c79eeee01d45d59c Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:30:54 -0800 Subject: [PATCH 25/33] Removes unused local var in gamestate management --- Robust.Client/GameStates/ClientGameStateManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Robust.Client/GameStates/ClientGameStateManager.cs b/Robust.Client/GameStates/ClientGameStateManager.cs index 5b77017e693..352c249ead2 100644 --- a/Robust.Client/GameStates/ClientGameStateManager.cs +++ b/Robust.Client/GameStates/ClientGameStateManager.cs @@ -384,7 +384,6 @@ public void ApplyGameState() _processor.UpdateFullRep(curState); } - IEnumerable createdEntities; using (_prof.Group("ApplyGameState")) { if (_timing.LastProcessedTick < targetProcessedTick && nextState != null) From 073dde51343f3c6ae8d7ddfa9a45f6534a493b20 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:33:54 -0800 Subject: [PATCH 26/33] Fix unreachable code warnings in gamestate management Use #else sections to make sure they don't complain about being on the wrong side of a throw --- Robust.Client/GameStates/ClientGameStateManager.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Robust.Client/GameStates/ClientGameStateManager.cs b/Robust.Client/GameStates/ClientGameStateManager.cs index 352c249ead2..4ca0bf1d020 100644 --- a/Robust.Client/GameStates/ClientGameStateManager.cs +++ b/Robust.Client/GameStates/ClientGameStateManager.cs @@ -698,8 +698,9 @@ public void MergeImplicitData() #if !EXCEPTION_TOLERANCE throw new KeyNotFoundException(); -#endif +#else continue; +#endif } var compData = _compDataPool.Get(); @@ -960,8 +961,9 @@ private void ApplyEntState(in StateData data, GameTick toTick) RequestFullState(); #if !EXCEPTION_TOLERANCE throw; -#endif +#else return; +#endif } if (data.Created) @@ -979,8 +981,9 @@ private void ApplyEntState(in StateData data, GameTick toTick) RequestFullState(); #if !EXCEPTION_TOLERANCE throw; -#endif +#else return; +#endif } } From 14618e8f7410a72fbbb2871a10f3073c033e730a Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:35:53 -0800 Subject: [PATCH 27/33] Fix obsolete ToMap use in EyeManager --- Robust.Client/Graphics/ClientEye/EyeManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Robust.Client/Graphics/ClientEye/EyeManager.cs b/Robust.Client/Graphics/ClientEye/EyeManager.cs index c32f0f51a44..3734811cb4e 100644 --- a/Robust.Client/Graphics/ClientEye/EyeManager.cs +++ b/Robust.Client/Graphics/ClientEye/EyeManager.cs @@ -123,7 +123,8 @@ 0 0 1 /// public ScreenCoordinates CoordinatesToScreen(EntityCoordinates point) { - return MapToScreen(point.ToMap(_entityManager, _entityManager.System())); + var transformSystem = _entityManager.System(); + return MapToScreen(transformSystem.ToMapCoordinates(point)); } public ScreenCoordinates MapToScreen(MapCoordinates point) From 9f633e99ed24603ea0cce32457c1262182f370ce Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:45:44 -0800 Subject: [PATCH 28/33] Make InputManager use a sawmill to log --- Robust.Client/Input/InputManager.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 4f7d8e8e8c6..921c8de65e1 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -48,6 +48,7 @@ internal class InputManager : IInputManager [Dependency] private readonly IUserInterfaceManagerInternal _uiMgr = default!; [Dependency] private readonly IConsoleHost _console = default!; [Dependency] private readonly ISerializationManager _serialization = default!; + private ISawmill _logger = default!; private bool _currentlyFindingViewport; @@ -114,6 +115,8 @@ public string GetKeyFunctionButtonString(BoundKeyFunction function) /// public void Initialize() { + _logger = Logger.GetSawmill("input"); + NetworkBindMap = new BoundKeyMap(_reflectionManager); NetworkBindMap.PopulateKeyFunctionsMap(); @@ -130,7 +133,7 @@ public void Initialize() } catch (Exception e) { - Logger.ErrorS("input", "Failed to load user keybindings: " + e); + _logger.Error("Failed to load user keybindings: " + e); } } @@ -531,8 +534,7 @@ public void LoadKeyFile(ResPath file, bool defaultRegistration, bool userData = if (reg.Type != KeyBindingType.Command && !NetworkBindMap.FunctionExists(reg.Function.FunctionName)) { - Logger.DebugS("input", "Key function in {0} does not exist: '{1}'.", file, - reg.Function); + _logger.Debug("Key function in {0} does not exist: '{1}'.", file, reg.Function); invalid = true; } From 60b5b6ad3f7489ac9562f4d93c054ca169bbb066 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:50:08 -0800 Subject: [PATCH 29/33] Fix obsolete ContainerManagerComponent method calls in ContainerSystem --- Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs b/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs index f0b8c72cd6a..d632e82cdba 100644 --- a/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs @@ -303,7 +303,7 @@ private void UpdateEntityRecursively(EntityUid entity) while (parent.IsValid() && (!spriteOccluded || !lightOccluded)) { var parentXform = TransformQuery.GetComponent(parent); - if (TryComp(parent, out var manager) && manager.TryGetContainer(child, out var container)) + if (TryComp(parent, out var manager) && TryGetContainingContainer(parent, child, out var container, manager)) { spriteOccluded = spriteOccluded || !container.ShowContents; lightOccluded = lightOccluded || container.OccludesLight; @@ -344,7 +344,7 @@ private void UpdateEntity( var childLightOccluded = lightOccluded; // We already know either sprite or light is not occluding so need to check container. - if (manager.TryGetContainer(child, out var container)) + if (TryGetContainingContainer(entity, child, out var container, manager)) { childSpriteOccluded = childSpriteOccluded || !container.ShowContents; childLightOccluded = childLightOccluded || container.OccludesLight; From c09d63249905681ea1f09f2605ceb926676ce394 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Wed, 5 Feb 2025 19:52:13 -0800 Subject: [PATCH 30/33] Make ClientPrototypeManager use a sawmill for logging --- Robust.Client/Prototypes/ClientPrototypeManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Robust.Client/Prototypes/ClientPrototypeManager.cs b/Robust.Client/Prototypes/ClientPrototypeManager.cs index 79adba3c461..29d30d91bff 100644 --- a/Robust.Client/Prototypes/ClientPrototypeManager.cs +++ b/Robust.Client/Prototypes/ClientPrototypeManager.cs @@ -81,7 +81,7 @@ private void ReloadPrototypeQueue() _reloadQueue.Clear(); - Logger.Info($"Reloaded prototypes in {sw.ElapsedMilliseconds} ms"); + Sawmill.Info($"Reloaded prototypes in {sw.ElapsedMilliseconds} ms"); #endif } @@ -139,7 +139,7 @@ private void WatchResources() } catch (IOException ex) { - Logger.Error($"Watching resources in path {path} threw an exception:\n{ex}"); + Sawmill.Error($"Watching resources in path {path} threw an exception:\n{ex}"); } } #endif From 69ac472bbefc5088b2201bce0721757b1f1c3f49 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Thu, 6 Feb 2025 15:34:31 -0800 Subject: [PATCH 31/33] poke tests From e79289fc52e8d05d9cc29507e2d0bdcb8978c7fc Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Mon, 17 Feb 2025 09:30:06 -0800 Subject: [PATCH 32/33] Use LocalizedEntityCommands for SpriteBoundsOverlay toggle --- .../Components/Renderable/SpriteBoundsOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs index ac047782f07..fac757050c2 100644 --- a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs +++ b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs @@ -10,15 +10,15 @@ namespace Robust.Client.GameObjects { - public sealed class ShowSpriteBBCommand : LocalizedCommands + public sealed class ShowSpriteBBCommand : LocalizedEntityCommands { + [Dependency] private readonly SpriteBoundsSystem _spriteBoundsSystem = default!; + public override string Command => "showspritebb"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { - IoCManager.Resolve() - .System() - .Enabled ^= true; + _spriteBoundsSystem.Enabled ^= true; } } From 07cce9c1d8fb22ead005ae5251b36a143641fe19 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Mon, 17 Feb 2025 09:35:13 -0800 Subject: [PATCH 33/33] Use LocalizedEntityCommands for system toggles --- Robust.Client/Console/Commands/DebugAnchoredCommand.cs | 8 +++++--- Robust.Client/Console/Commands/LightBBCommand.cs | 9 ++++----- Robust.Client/Console/Commands/VelocitiesCommand.cs | 7 +++---- .../Components/Renderable/SpriteBoundsOverlay.cs | 4 ++-- .../GameObjects/EntitySystems/DebugEntityLookupSystem.cs | 8 +++----- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/Robust.Client/Console/Commands/DebugAnchoredCommand.cs b/Robust.Client/Console/Commands/DebugAnchoredCommand.cs index 8a1e2119c44..89be6a444d6 100644 --- a/Robust.Client/Console/Commands/DebugAnchoredCommand.cs +++ b/Robust.Client/Console/Commands/DebugAnchoredCommand.cs @@ -1,17 +1,19 @@ #if DEBUG using Robust.Client.Debugging; using Robust.Shared.Console; -using Robust.Shared.GameObjects; +using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { - public sealed class DebugAnchoredCommand : LocalizedCommands + public sealed class DebugAnchoredCommand : LocalizedEntityCommands { + [Dependency] private readonly DebugAnchoringSystem _system = default!; + public override string Command => "showanchored"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get().Enabled ^= true; + _system.Enabled ^= true; } } } diff --git a/Robust.Client/Console/Commands/LightBBCommand.cs b/Robust.Client/Console/Commands/LightBBCommand.cs index b3640c9e984..915a3bba752 100644 --- a/Robust.Client/Console/Commands/LightBBCommand.cs +++ b/Robust.Client/Console/Commands/LightBBCommand.cs @@ -1,20 +1,19 @@ #if DEBUG using Robust.Client.GameObjects; using Robust.Shared.Console; -using Robust.Shared.GameObjects; using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { - internal sealed class LightDebugCommand : LocalizedCommands + internal sealed class LightDebugCommand : LocalizedEntityCommands { + [Dependency] private readonly DebugLightTreeSystem _system = default!; + public override string Command => "lightbb"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { - IoCManager.Resolve() - .GetEntitySystem() - .Enabled ^= true; + _system.Enabled ^= true; } } } diff --git a/Robust.Client/Console/Commands/VelocitiesCommand.cs b/Robust.Client/Console/Commands/VelocitiesCommand.cs index 0701be7b35b..1e3bb33bfe6 100644 --- a/Robust.Client/Console/Commands/VelocitiesCommand.cs +++ b/Robust.Client/Console/Commands/VelocitiesCommand.cs @@ -1,19 +1,18 @@ using Robust.Client.GameObjects; using Robust.Shared.Console; -using Robust.Shared.GameObjects; using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { - public sealed class VelocitiesCommand : LocalizedCommands + public sealed class VelocitiesCommand : LocalizedEntityCommands { - [Dependency] private readonly IEntitySystemManager _entitySystems = default!; + [Dependency] private readonly VelocityDebugSystem _system = default!; public override string Command => "showvelocities"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { - _entitySystems.GetEntitySystem().Enabled ^= true; + _system.Enabled ^= true; } } } diff --git a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs index fac757050c2..dd4abae45ce 100644 --- a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs +++ b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs @@ -12,13 +12,13 @@ namespace Robust.Client.GameObjects { public sealed class ShowSpriteBBCommand : LocalizedEntityCommands { - [Dependency] private readonly SpriteBoundsSystem _spriteBoundsSystem = default!; + [Dependency] private readonly SpriteBoundsSystem _system = default!; public override string Command => "showspritebb"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { - _spriteBoundsSystem.Enabled ^= true; + _system.Enabled ^= true; } } diff --git a/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs b/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs index f8a6894617d..5fae53eed8d 100644 --- a/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs @@ -2,26 +2,24 @@ using System.Numerics; using Robust.Client.Graphics; using Robust.Shared.Console; -using Robust.Shared.Containers; using Robust.Shared.Enums; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Physics.Dynamics; -using Robust.Shared.Utility; using Color = Robust.Shared.Maths.Color; namespace Robust.Client.GameObjects; -public sealed class DebugEntityLookupCommand : LocalizedCommands +public sealed class DebugEntityLookupCommand : LocalizedEntityCommands { - [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly DebugEntityLookupSystem _system = default!; public override string Command => "togglelookup"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { - _entityManager.System().Enabled ^= true; + _system.Enabled ^= true; } }