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
[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!;
{
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;
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);
}
}
// 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;
}
}
- public sealed class InvisibleWallActionEvent : InstantActionEvent {}
+ public sealed class InvisibleWallActionEvent : InstantActionEvent
+ {
+ }
}