From: osjarw <62134478+osjarw@users.noreply.github.com> Date: Sun, 21 Jul 2024 07:28:37 +0000 (+0300) Subject: NPCs no longer consider anchored pipes as weapons (#30061) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=644736b382a900645494ab32bfe9f0bd8ba25b4b;p=space-station-14.git NPCs no longer consider anchored pipes as weapons (#30061) * Anchored pipes are no longer considered weapons * Switch to overload utilizing a TransformQuery --- diff --git a/Content.Server/NPC/Queries/Queries/RemoveAnchored.cs b/Content.Server/NPC/Queries/Queries/RemoveAnchored.cs new file mode 100644 index 0000000000..ef9fa2057f --- /dev/null +++ b/Content.Server/NPC/Queries/Queries/RemoveAnchored.cs @@ -0,0 +1,11 @@ +using Robust.Shared.Prototypes; + +namespace Content.Server.NPC.Queries.Queries; + +/// +/// Remove anchored entities from the query +/// +public sealed partial class RemoveAnchoredFilter : UtilityQueryFilter +{ + +} diff --git a/Content.Server/NPC/Systems/NPCUtilitySystem.cs b/Content.Server/NPC/Systems/NPCUtilitySystem.cs index 72833fc35e..5e1823227a 100644 --- a/Content.Server/NPC/Systems/NPCUtilitySystem.cs +++ b/Content.Server/NPC/Systems/NPCUtilitySystem.cs @@ -499,6 +499,26 @@ public sealed class NPCUtilitySystem : EntitySystem break; } + case RemoveAnchoredFilter: + { + _entityList.Clear(); + + foreach (var ent in entities) + { + if (!TryComp(ent, out TransformComponent? xform)) + continue; + + if (xform.Anchored) + _entityList.Add(ent); + } + + foreach (var ent in _entityList) + { + entities.Remove(ent); + } + + break; + } case PuddleFilter: { _entityList.Clear(); diff --git a/Resources/Prototypes/NPCs/utility_queries.yml b/Resources/Prototypes/NPCs/utility_queries.yml index 3d5385ecbc..06bc0a9a9e 100644 --- a/Resources/Prototypes/NPCs/utility_queries.yml +++ b/Resources/Prototypes/NPCs/utility_queries.yml @@ -131,6 +131,7 @@ types: Blunt: 0 - type: Item + - !type:RemoveAnchoredFilter considerations: - !type:TargetMeleeCon curve: !type:QuadraticCurve