]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
tag:with toolshed command (#31751)
authordffdff2423 <dffdff2423@gmail.com>
Wed, 13 Nov 2024 23:27:31 +0000 (18:27 -0500)
committerGitHub <noreply@github.com>
Wed, 13 Nov 2024 23:27:31 +0000 (06:27 +0700)
Content.Server/Administration/Toolshed/TagCommand.cs
Resources/Locale/en-US/commands/toolshed-commands.ftl

index e1cf53e1b1abf7cb7e35ce8a7e275ff22fbfaa5e..4c6f790e49392485d2aee933868ebbf21a8b5712 100644 (file)
@@ -25,6 +25,16 @@ public sealed class TagCommand : ToolshedCommand
         });
     }
 
+    [CommandImplementation("with")]
+    public IEnumerable<EntityUid> With(
+        [CommandInvocationContext] IInvocationContext ctx,
+        [PipedArgument] IEnumerable<EntityUid> entities,
+        [CommandArgument] ValueRef<string, Prototype<TagPrototype>> tag)
+    {
+        _tag ??= GetSys<TagSystem>();
+        return entities.Where(e => _tag.HasTag(e, tag.Evaluate(ctx)!));
+    }
+
     [CommandImplementation("add")]
     public EntityUid Add(
             [CommandInvocationContext] IInvocationContext ctx,
index e2536f6781b21376c0c7502359c7fe5978ac8b46..c53c825eb3e0937138faeee540be7c9b8ca7e758 100644 (file)
@@ -1,4 +1,4 @@
-command-description-visualize =
+command-description-visualize =
     Takes the input list of entities and puts them into a UI window for easy browsing.
 command-description-runverbas =
     Runs a verb over the input entities with the given user.
@@ -58,6 +58,8 @@ command-description-rejuvenate =
     Rejuvenates the given entities, restoring them to full health, clearing status effects, etc.
 command-description-tag-list =
     Lists tags on the given entities.
+command-description-tag-with =
+    Returns only the entities with the given tag from the piped list of entities.
 command-description-tag-add =
     Adds a tag to the given entities.
 command-description-tag-rm =