]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
NPCs no longer consider anchored pipes as weapons (#30061)
authorosjarw <62134478+osjarw@users.noreply.github.com>
Sun, 21 Jul 2024 07:28:37 +0000 (10:28 +0300)
committerGitHub <noreply@github.com>
Sun, 21 Jul 2024 07:28:37 +0000 (17:28 +1000)
* Anchored pipes are no longer considered weapons

* Switch to overload utilizing a TransformQuery

Content.Server/NPC/Queries/Queries/RemoveAnchored.cs [new file with mode: 0644]
Content.Server/NPC/Systems/NPCUtilitySystem.cs
Resources/Prototypes/NPCs/utility_queries.yml

diff --git a/Content.Server/NPC/Queries/Queries/RemoveAnchored.cs b/Content.Server/NPC/Queries/Queries/RemoveAnchored.cs
new file mode 100644 (file)
index 0000000..ef9fa20
--- /dev/null
@@ -0,0 +1,11 @@
+using Robust.Shared.Prototypes;
+
+namespace Content.Server.NPC.Queries.Queries;
+
+/// <summary>
+/// Remove anchored entities from the query
+/// </summary>
+public sealed partial class RemoveAnchoredFilter : UtilityQueryFilter
+{
+
+}
index 72833fc35ef9cc8be08b007d965ea2119d9aa9ca..5e1823227a8984b6197df268e1e319c02e09587d 100644 (file)
@@ -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();
index 3d5385ecbcd651f3635c4fa3131cc0d5a927e06f..06bc0a9a9ebe6f2b7ee3c4c07aef66bca76b8477 100644 (file)
             types:
               Blunt: 0
         - type: Item
+    - !type:RemoveAnchoredFilter
   considerations:
     - !type:TargetMeleeCon
       curve: !type:QuadraticCurve