diff --git a/Content.Server/Abilities/Mime/MimePowersSystem.cs b/Content.Server/Abilities/Mime/MimePowersSystem.cs index 02dab8baf0..0e67c44d36 100644 --- a/Content.Server/Abilities/Mime/MimePowersSystem.cs +++ b/Content.Server/Abilities/Mime/MimePowersSystem.cs @@ -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()) + + var query = EntityQueryEnumerator(); + 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(entity) && entity != uid) || // Is it a mob? - ((Resolve(entity, ref physics, false) && (physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0) // Is it impassable? - && !(TryComp(entity, out var door) && door.State != DoorState.Closed))) // Is it a door that's open and so not actually impassable? + if (HasComp(entity) && entity != uid // Is it a mob? + || Resolve(entity, ref physics, false) && (physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0 // Is it impassable? + && !(TryComp(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 + { + } }