From 76223e8e14e35506e479fa38f20bb449e7d29279 Mon Sep 17 00:00:00 2001 From: Winkarst <74284083+Winkarst-cpu@users.noreply.github.com> Date: Tue, 27 Aug 2024 03:18:10 +0300 Subject: [PATCH] Remove double-iteration from the mime wall code (#31420) * Remove double-iteration from the mime wall code * Update * Update --- Content.Server/Abilities/Mime/MimePowersSystem.cs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Content.Server/Abilities/Mime/MimePowersSystem.cs b/Content.Server/Abilities/Mime/MimePowersSystem.cs index 85230faab0..20889f293c 100644 --- a/Content.Server/Abilities/Mime/MimePowersSystem.cs +++ b/Content.Server/Abilities/Mime/MimePowersSystem.cs @@ -5,7 +5,6 @@ using Content.Shared.Actions.Events; using Content.Shared.Alert; using Content.Shared.Coordinates.Helpers; using Content.Shared.Maps; -using Content.Shared.Mobs.Components; using Content.Shared.Physics; using Robust.Shared.Containers; using Robust.Shared.Map; @@ -19,7 +18,6 @@ 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 TurfSystem _turf = default!; [Dependency] private readonly IMapManager _mapMan = default!; [Dependency] private readonly SharedContainerSystem _container = default!; @@ -80,22 +78,13 @@ namespace Content.Server.Abilities.Mime if (tile == null) return; - // Check there are no walls there - if (_turf.IsTileBlocked(tile.Value, CollisionGroup.Impassable)) + // Check if the tile is blocked by a wall or mob, and don't create the wall if so + if (_turf.IsTileBlocked(tile.Value, CollisionGroup.Impassable | CollisionGroup.Opaque)) { _popupSystem.PopupEntity(Loc.GetString("mime-invisible-wall-failed"), uid, uid); return; } - // Check there are no mobs there - foreach (var entity in _lookupSystem.GetLocalEntitiesIntersecting(tile.Value, 0f)) - { - if (HasComp(entity) && entity != uid) - { - _popupSystem.PopupEntity(Loc.GetString("mime-invisible-wall-failed"), uid, uid); - return; - } - } _popupSystem.PopupEntity(Loc.GetString("mime-invisible-wall-popup", ("mime", uid)), uid); // Make sure we set the invisible wall to despawn properly Spawn(component.WallPrototype, _turf.GetTileCenter(tile.Value)); -- 2.51.2