]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Obsolete `Logger` cleanup for `EntitySystem`s part 2 (#26159)
authorLordCarve <27449516+LordCarve@users.noreply.github.com>
Sun, 17 Mar 2024 07:31:09 +0000 (08:31 +0100)
committerGitHub <noreply@github.com>
Sun, 17 Mar 2024 07:31:09 +0000 (18:31 +1100)
* Kill the static InRangeUnOccluded

* Adjusted 4 more EntitySystems that were missed.

14 files changed:
Content.Client/CardboardBox/CardboardBoxSystem.cs
Content.Client/Popups/PopupOverlay.cs
Content.Client/Popups/PopupSystem.cs
Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Content.Client/Verbs/VerbSystem.cs
Content.Server/Administration/Systems/AdminVerbSystem.cs
Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs
Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs
Content.Server/GameTicking/Rules/PiratesRuleSystem.cs
Content.Server/NPC/Systems/NPCUtilitySystem.cs
Content.Server/Pointing/EntitySystems/PointingSystem.cs
Content.Server/Remotes/DoorRemoteSystem.cs
Content.Server/Tabletop/TabletopSystem.Session.cs
Content.Shared/Examine/ExamineSystemShared.cs

index 50f9de239d5209f2c9adc2c32dee98dd2cde62f7..90a21d8e41b01d3c4f1b2ca04e3733113f9bde7a 100644 (file)
@@ -1,4 +1,4 @@
-using System.Numerics;
+using System.Numerics;
 using Content.Shared.CardboardBox;
 using Content.Shared.CardboardBox.Components;
 using Content.Shared.Examine;
@@ -11,6 +11,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
 {
     [Dependency] private readonly EntityLookupSystem _entityLookup = default!;
     [Dependency] private readonly TransformSystem _transform = default!;
+    [Dependency] private readonly ExamineSystemShared _examine = default!;
 
     public override void Initialize()
     {
@@ -55,7 +56,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
         foreach (var mob in mobMoverEntities)
         {
             var mapPos = _transform.GetMapCoordinates(mob);
-            if (!ExamineSystemShared.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null))
+            if (!_examine.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null))
                 continue;
 
             var ent = Spawn(box.Effect, mapPos);
index 1305d8bb947b98743fc16285788a05d3f4927772..3bfa7278734a37a7b9ae0092e4f693c639907503 100644 (file)
@@ -21,6 +21,7 @@ public sealed class PopupOverlay : Overlay
     private readonly IUserInterfaceManager _uiManager;
     private readonly PopupSystem _popup;
     private readonly PopupUIController _controller;
+    private readonly ExamineSystemShared _examine;
 
     private readonly ShaderInstance _shader;
 
@@ -33,12 +34,14 @@ public sealed class PopupOverlay : Overlay
         IPrototypeManager protoManager,
         IUserInterfaceManager uiManager,
         PopupUIController controller,
+        ExamineSystemShared examine,
         PopupSystem popup)
     {
         _configManager = configManager;
         _entManager = entManager;
         _playerMgr = playerMgr;
         _uiManager = uiManager;
+        _examine = examine;
         _popup = popup;
         _controller = controller;
 
@@ -81,7 +84,7 @@ public sealed class PopupOverlay : Overlay
             var distance = (mapPos.Position - args.WorldBounds.Center).Length();
 
             // Should handle fade here too wyci.
-            if (!args.WorldBounds.Contains(mapPos.Position) || !ExamineSystemShared.InRangeUnOccluded(viewPos, mapPos, distance,
+            if (!args.WorldBounds.Contains(mapPos.Position) || !_examine.InRangeUnOccluded(viewPos, mapPos, distance,
                     e => e == popup.InitialPos.EntityId || e == ourEntity, entMan: _entManager))
                 continue;
 
index cf96c41241a1215ecc744c1df15ca4214e563ca7..46c1e0cdf62bc99bd88903a6311141866d5c2b61 100644 (file)
@@ -1,4 +1,5 @@
 using System.Linq;
+using Content.Shared.Examine;
 using Content.Shared.GameTicking;
 using Content.Shared.Popups;
 using Robust.Client.Graphics;
@@ -26,6 +27,7 @@ namespace Content.Client.Popups
         [Dependency] private readonly IGameTiming _timing = default!;
         [Dependency] private readonly IUserInterfaceManager _uiManager = default!;
         [Dependency] private readonly IReplayRecordingManager _replayRecording = default!;
+        [Dependency] private readonly ExamineSystemShared _examine = default!;
 
         public IReadOnlyList<WorldPopupLabel> WorldLabels => _aliveWorldLabels;
         public IReadOnlyList<CursorPopupLabel> CursorLabels => _aliveCursorLabels;
@@ -51,6 +53,7 @@ namespace Content.Client.Popups
                     _prototype,
                     _uiManager,
                     _uiManager.GetUIController<PopupUIController>(),
+                    _examine,
                     this));
         }
 
index b1cff5b85a3273ba5376df6324d29f8190a9e4c7..ac0ea5335e6ad47bcb9859df13387dadf3927806 100644 (file)
@@ -613,7 +613,7 @@ public sealed class ChatUIController : UIController
 
             var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
 
-            if (occluded && !ExamineSystemShared.InRangeUnOccluded(
+            if (occluded && !_examine.InRangeUnOccluded(
                     playerPos,
                     otherPos, 0f,
                     (ent, player), predicate))
index 329a8977a68438e60dd8fb241510c2958be237c5..77f46a3fc97703818d2744d29d4243212d4c495d 100644 (file)
@@ -20,7 +20,7 @@ namespace Content.Client.Verbs
     public sealed class VerbSystem : SharedVerbSystem
     {
         [Dependency] private readonly PopupSystem _popupSystem = default!;
-        [Dependency] private readonly ExamineSystem _examineSystem = default!;
+        [Dependency] private readonly ExamineSystem _examine = default!;
         [Dependency] private readonly TagSystem _tagSystem = default!;
         [Dependency] private readonly IStateManager _stateManager = default!;
         [Dependency] private readonly EntityLookupSystem _entityLookup = default!;
@@ -77,7 +77,7 @@ namespace Content.Client.Verbs
                 bool Predicate(EntityUid e) => e == player || entitiesUnderMouse.Contains(e);
 
                 // first check the general location.
-                if (!_examineSystem.CanExamine(player.Value, targetPos, Predicate))
+                if (!_examine.CanExamine(player.Value, targetPos, Predicate))
                     return false;
 
                 TryComp(player.Value, out ExaminerComponent? examiner);
@@ -86,7 +86,7 @@ namespace Content.Client.Verbs
                 entities = new();
                 foreach (var ent in _entityLookup.GetEntitiesInRange(targetPos, EntityMenuLookupSize))
                 {
-                    if (_examineSystem.CanExamine(player.Value, targetPos, Predicate, ent, examiner))
+                    if (_examine.CanExamine(player.Value, targetPos, Predicate, ent, examiner))
                         entities.Add(ent);
                 }
             }
@@ -147,7 +147,7 @@ namespace Content.Client.Verbs
                 {
                     var entity = entities[i];
 
-                    if (!ExamineSystemShared.InRangeUnOccluded(
+                    if (!_examine.InRangeUnOccluded(
                         playerPos,
                         xformQuery.GetComponent(entity).MapPosition,
                         ExamineSystemShared.ExamineRange,
index c4754af9340f401cf6d155fc20ce001ad8b87c3a..f5b237b4492afb6f92f93b7800b2299cbf35b313 100644 (file)
@@ -66,6 +66,7 @@ namespace Content.Server.Administration.Systems
         [Dependency] private readonly SharedPopupSystem _popup = default!;
         [Dependency] private readonly StationSystem _stations = default!;
         [Dependency] private readonly StationSpawningSystem _spawning = default!;
+        [Dependency] private readonly ExamineSystemShared _examine = default!;
 
         private readonly Dictionary<ICommonSession, List<EditSolutionsEui>> _openSolutionUis = new();
 
@@ -416,7 +417,7 @@ namespace Content.Server.Administration.Systems
                     Act = () =>
                     {
 
-                        var message = ExamineSystemShared.InRangeUnOccluded(args.User, args.Target)
+                        var message = _examine.InRangeUnOccluded(args.User, args.Target)
                             ? Loc.GetString("in-range-unoccluded-verb-on-activate-not-occluded")
                             : Loc.GetString("in-range-unoccluded-verb-on-activate-occluded");
 
index aceda3cd332391d8780c8aa0bd6c9009cb9b4b70..737976a82973b1add45631ec67cd1cd78d66e8ae 100644 (file)
@@ -635,14 +635,14 @@ namespace Content.Server.Atmos.EntitySystems
             // Turns out: no they don't. Temporary debug checks to figure out which caller is causing problems:
             if (tile == null)
             {
-                Logger.Error($"Encountered null-tile in {nameof(AdjustEqMovement)}. Trace: {Environment.StackTrace}");
+                Log.Error($"Encountered null-tile in {nameof(AdjustEqMovement)}. Trace: {Environment.StackTrace}");
                 return;
             }
             var adj = tile.AdjacentTiles[direction.ToIndex()];
             if (adj == null)
             {
                 var nonNull = tile.AdjacentTiles.Where(x => x != null).Count();
-                Logger.Error($"Encountered null adjacent tile in {nameof(AdjustEqMovement)}. Dir: {direction}, Tile: {tile.Tile}, non-null adj count: {nonNull}, Trace: {Environment.StackTrace}");
+                Log.Error($"Encountered null adjacent tile in {nameof(AdjustEqMovement)}. Dir: {direction}, Tile: {tile.Tile}, non-null adj count: {nonNull}, Trace: {Environment.StackTrace}");
                 return;
             }
 
index 761e9456bcdc60cfea623afe307cfcc256ee7bd4..c923738930a37fee3d1ffbfb5ea19173426486c1 100644 (file)
@@ -39,7 +39,7 @@ public sealed class TypingIndicatorSystem : SharedTypingIndicatorSystem
         var uid = args.SenderSession.AttachedEntity;
         if (!Exists(uid))
         {
-            Logger.Warning($"Client {args.SenderSession} sent TypingChangedEvent without an attached entity.");
+            Log.Warning($"Client {args.SenderSession} sent TypingChangedEvent without an attached entity.");
             return;
         }
 
index f83d719c219c357aa0d2979557e0e27d1e1d4cd6..98926536b9d641480a173c6dc6a696cb97126bfc 100644 (file)
@@ -201,7 +201,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
 
             if (!gridId.HasValue)
             {
-                Logger.ErrorS("pirates", $"Gridid was null when loading \"{map}\", aborting.");
+                Log.Error($"Gridid was null when loading \"{map}\", aborting.");
                 foreach (var session in ops)
                 {
                     ev.PlayerPool.Add(session);
@@ -230,7 +230,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
             if (spawns.Count == 0)
             {
                 spawns.Add(Transform(pirates.PirateShip).Coordinates);
-                Logger.WarningS("pirates", $"Fell back to default spawn for pirates!");
+                Log.Warning($"Fell back to default spawn for pirates!");
             }
 
             for (var i = 0; i < ops.Length; i++)
index fc483f68c3be72ecda6b2191939a9b0f09cab826..33941be929211a4a917b24c7b40188b85dfd8878 100644 (file)
@@ -43,6 +43,7 @@ public sealed class NPCUtilitySystem : EntitySystem
     [Dependency] private readonly SharedTransformSystem _transform = default!;
     [Dependency] private readonly SolutionContainerSystem _solutions = default!;
     [Dependency] private readonly WeldableSystem _weldable = default!;
+    [Dependency] private readonly ExamineSystemShared _examine = default!;
 
     private EntityQuery<PuddleComponent> _puddleQuery;
     private EntityQuery<TransformComponent> _xformQuery;
@@ -296,7 +297,7 @@ public sealed class NPCUtilitySystem : EntitySystem
             {
                 var radius = blackboard.GetValueOrDefault<float>(NPCBlackboard.VisionRadius, EntityManager);
 
-                return ExamineSystemShared.InRangeUnOccluded(owner, targetUid, radius + 0.5f, null) ? 1f : 0f;
+                return _examine.InRangeUnOccluded(owner, targetUid, radius + 0.5f, null) ? 1f : 0f;
             }
             case TargetInLOSOrCurrentCon:
             {
@@ -313,7 +314,7 @@ public sealed class NPCUtilitySystem : EntitySystem
                     return 1f;
                 }
 
-                return ExamineSystemShared.InRangeUnOccluded(owner, targetUid, radius + bufferRange, null) ? 1f : 0f;
+                return _examine.InRangeUnOccluded(owner, targetUid, radius + bufferRange, null) ? 1f : 0f;
             }
             case TargetIsAliveCon:
             {
index a7c455e6a5d3c89e317ad64c0f5fc38343dda8c9..06d2d6f58b52a69f7801de82729cb63f26810151 100644 (file)
@@ -37,6 +37,7 @@ namespace Content.Server.Pointing.EntitySystems
         [Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
         [Dependency] private readonly SharedMindSystem _minds = default!;
         [Dependency] private readonly IAdminLogManager _adminLogger = default!;
+        [Dependency] private readonly ExamineSystemShared _examine = default!;
 
         private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f);
 
@@ -100,7 +101,7 @@ namespace Content.Server.Pointing.EntitySystems
             }
             else
             {
-                return ExamineSystemShared.InRangeUnOccluded(pointer, coordinates, 15, predicate: e => e == pointer);
+                return _examine.InRangeUnOccluded(pointer, coordinates, 15, predicate: e => e == pointer);
             }
         }
 
index 9be7e5e96b41452428ed65ce2f82b8448531c574..cb3243cb837b14dee80c043b298314ddae980c2d 100644 (file)
@@ -22,6 +22,7 @@ namespace Content.Server.Remotes
         [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
         [Dependency] private readonly DoorSystem _doorSystem = default!;
         [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
+        [Dependency] private readonly ExamineSystemShared _examine = default!;
         // I'm so sorry [Dependency] private readonly SharedAirlockSystem _sharedAirlockSystem = default!;
 
         public override void Initialize()
@@ -67,7 +68,7 @@ namespace Content.Server.Remotes
                 || !TryComp<DoorComponent>(args.Target, out var doorComp) // If it isn't a door we don't use it
                 // Only able to control doors if they are within your vision and within your max range.
                 // Not affected by mobs or machines anymore.
-                || !ExamineSystemShared.InRangeUnOccluded(args.User, args.Target.Value, SharedInteractionSystem.MaxRaycastRange, null))
+                || !_examine.InRangeUnOccluded(args.User, args.Target.Value, SharedInteractionSystem.MaxRaycastRange, null))
             {
                 return;
             }
index f16f3f01e989f1769a4ef4791f1c5ec94f0c34b1..c2bb8426fc2efa876226d870b6b8eb6f3e19c9de 100644 (file)
@@ -31,7 +31,7 @@ namespace Content.Server.Tabletop
             // Since this is the first time opening this session, set up the game
             tabletop.Setup.SetupTabletop(session, EntityManager);
 
-            Logger.Info($"Created tabletop session number {tabletop} at position {session.Position}.");
+            Log.Info($"Created tabletop session number {tabletop} at position {session.Position}.");
 
             return session;
         }
index 5a3fb8722933f9357cc00472883055b11df77ecf..f792862be1452eccfed4eff3a450dbeef99a2b5c 100644 (file)
@@ -144,7 +144,7 @@ namespace Content.Shared.Examine
             return TryComp<EyeComponent>(uid, out var eye) && eye.DrawFov;
         }
 
-        public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true, IEntityManager? entMan = null)
+        public bool InRangeUnOccluded(MapCoordinates origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true, IEntityManager? entMan = null)
         {
             // No, rider. This is better.
             // ReSharper disable once ConvertToLocalFunction
@@ -154,7 +154,7 @@ namespace Content.Shared.Examine
             return InRangeUnOccluded(origin, other, range, predicate, wrapped, ignoreInsideBlocker, entMan);
         }
 
-        public static bool InRangeUnOccluded<TState>(MapCoordinates origin, MapCoordinates other, float range,
+        public bool InRangeUnOccluded<TState>(MapCoordinates origin, MapCoordinates other, float range,
             TState state, Func<EntityUid, TState, bool> predicate, bool ignoreInsideBlocker = true, IEntityManager? entMan = null)
         {
             if (other.MapId != origin.MapId ||
@@ -171,7 +171,7 @@ namespace Content.Shared.Examine
 
             if (length > MaxRaycastRange)
             {
-                Logger.Warning("InRangeUnOccluded check performed over extreme range. Limiting CollisionRay size.");
+                Log.Warning("InRangeUnOccluded check performed over extreme range. Limiting CollisionRay size.");
                 length = MaxRaycastRange;
             }
 
@@ -207,7 +207,7 @@ namespace Content.Shared.Examine
             return true;
         }
 
-        public static bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
+        public bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
         {
             var entMan = IoCManager.Resolve<IEntityManager>();
             var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
@@ -216,7 +216,7 @@ namespace Content.Shared.Examine
             return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
         }
 
-        public static bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
+        public bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
         {
             var entMan = IoCManager.Resolve<IEntityManager>();
             var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
@@ -225,7 +225,7 @@ namespace Content.Shared.Examine
             return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
         }
 
-        public static bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
+        public bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
         {
             var entMan = IoCManager.Resolve<IEntityManager>();
             var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;