Fix the ability to hit overlapping walls.

This commit is contained in:
Quantum-cross
2025-05-25 19:58:25 -04:00
parent e0666cc510
commit f6866b6af4

View File

@@ -91,6 +91,7 @@ namespace Content.Shared.Interaction
public const string RateLimitKey = "Interaction";
private static readonly ProtoId<TagPrototype> BypassInteractionRangeChecksTag = "BypassInteractionRangeChecks";
private static readonly ProtoId<TagPrototype> WallTag = "Wall";
public delegate bool Ignored(EntityUid entity);
@@ -889,6 +890,18 @@ namespace Content.Shared.Interaction
if (ignoreAnchored && _mapManager.TryFindGridAt(targetCoords, out var gridUid, out var grid))
ignored.UnionWith(_map.GetAnchoredEntities((gridUid, grid), targetCoords));
}
else if (_tagSystem.HasTag(target, WallTag))
{
if (_mapManager.TryFindGridAt(targetCoords, out var gridUid, out var grid))
{
// If the target is a wall, it should ignore collision with other walls at the same coordinates
// This fixes the bug of not being able to target or break walls when they are overlapping
// like those spawned by rock anomalies
var wallIgnored = _map.GetAnchoredEntities((gridUid, grid), targetCoords)
.Where(e => _tagSystem.HasTag(e, WallTag));
ignored.UnionWith(wallIgnored);
}
}
Ignored combinedPredicate = e => e == target || (predicate?.Invoke(e) ?? false) || ignored.Contains(e);
return combinedPredicate;