]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixes warnings in Abilities module (#16573)
authorTemporalOroboros <TemporalOroboros@gmail.com>
Thu, 18 May 2023 23:47:29 +0000 (16:47 -0700)
committerGitHub <noreply@github.com>
Thu, 18 May 2023 23:47:29 +0000 (09:47 +1000)
Content.Server/Abilities/Mime/MimePowersSystem.cs

index 02dab8baf0209daf51632be97fc8e610c0c704e9..0e67c44d36710f7b028b93c6b39ebe8dfc66043f 100644 (file)
@@ -1,20 +1,13 @@
 using Content.Server.Popups;
 using Content.Server.Coordinates.Helpers;
-using Content.Shared.Speech;
 using Content.Shared.Actions;
 using Content.Shared.Alert;
 using Content.Shared.Physics;
 using Content.Shared.Doors.Components;
 using Content.Shared.Maps;
 using Content.Shared.Mobs.Components;
-using Robust.Shared.Player;
-using Robust.Shared.Physics;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Timing;
-using Content.Server.Chat.Systems;
-using Content.Server.Speech.Components;
-using Content.Shared.Chat.Prototypes;
-using Content.Server.Speech.EntitySystems;
 using Content.Server.Speech.Muting;
 
 namespace Content.Server.Abilities.Mime
@@ -24,6 +17,7 @@ namespace Content.Server.Abilities.Mime
         [Dependency] private readonly PopupSystem _popupSystem = default!;
         [Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
         [Dependency] private readonly AlertsSystem _alertsSystem = default!;
+        [Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
 
         [Dependency] private readonly IGameTiming _timing = default!;
 
@@ -37,7 +31,9 @@ namespace Content.Server.Abilities.Mime
         {
             base.Update(frameTime);
             // Queue to track whether mimes can retake vows yet
-            foreach (var mime in EntityQuery<MimePowersComponent>())
+
+            var query = EntityQueryEnumerator<MimePowersComponent>();
+            while (query.MoveNext(out var uid, out var mime))
             {
                 if (!mime.VowBroken || mime.ReadyToRepent)
                     continue;
@@ -46,7 +42,7 @@ namespace Content.Server.Abilities.Mime
                     continue;
 
                 mime.ReadyToRepent = true;
-                _popupSystem.PopupEntity(Loc.GetString("mime-ready-to-repent"), mime.Owner, mime.Owner);
+                _popupSystem.PopupEntity(Loc.GetString("mime-ready-to-repent"), uid, uid);
             }
         }
 
@@ -69,13 +65,17 @@ namespace Content.Server.Abilities.Mime
             // Get the tile in front of the mime
             var offsetValue = xform.LocalRotation.ToWorldVec().Normalized;
             var coords = xform.Coordinates.Offset(offsetValue).SnapToGrid(EntityManager);
+            var tile = coords.GetTileRef();
+            if (tile == null)
+                return;
+
             // Check there are no walls or mobs there
-            foreach (var entity in coords.GetEntitiesInTile())
+            foreach (var entity in _lookupSystem.GetEntitiesIntersecting(tile.Value, flags: LookupFlags.Static))
             {
                 PhysicsComponent? physics = null; // We use this to check if it's impassable
-                if ((HasComp<MobStateComponent>(entity) && entity != uid) || // Is it a mob?
-                    ((Resolve(entity, ref physics, false) && (physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0) // Is it impassable?
-                    &&  !(TryComp<DoorComponent>(entity, out var door) && door.State != DoorState.Closed))) // Is it a door that's open and so not actually impassable?
+                if (HasComp<MobStateComponent>(entity) && entity != uid // Is it a mob?
+                || Resolve(entity, ref physics, false) && (physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0 // Is it impassable?
+                    && !(TryComp<DoorComponent>(entity, out var door) && door.State != DoorState.Closed)) // Is it a door that's open and so not actually impassable?
                 {
                     _popupSystem.PopupEntity(Loc.GetString("mime-invisible-wall-failed"), uid, uid);
                     return;
@@ -132,5 +132,7 @@ namespace Content.Server.Abilities.Mime
         }
     }
 
-    public sealed class InvisibleWallActionEvent : InstantActionEvent {}
+    public sealed class InvisibleWallActionEvent : InstantActionEvent
+    {
+    }
 }