From 51d2b51ad09f3b361d80f22c3c2c23d6a5048517 Mon Sep 17 00:00:00 2001 From: dffdff2423 Date: Wed, 13 Nov 2024 18:27:31 -0500 Subject: [PATCH] tag:with toolshed command (#31751) --- Content.Server/Administration/Toolshed/TagCommand.cs | 10 ++++++++++ Resources/Locale/en-US/commands/toolshed-commands.ftl | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Content.Server/Administration/Toolshed/TagCommand.cs b/Content.Server/Administration/Toolshed/TagCommand.cs index e1cf53e1b1..4c6f790e49 100644 --- a/Content.Server/Administration/Toolshed/TagCommand.cs +++ b/Content.Server/Administration/Toolshed/TagCommand.cs @@ -25,6 +25,16 @@ public sealed class TagCommand : ToolshedCommand }); } + [CommandImplementation("with")] + public IEnumerable With( + [CommandInvocationContext] IInvocationContext ctx, + [PipedArgument] IEnumerable entities, + [CommandArgument] ValueRef> tag) + { + _tag ??= GetSys(); + return entities.Where(e => _tag.HasTag(e, tag.Evaluate(ctx)!)); + } + [CommandImplementation("add")] public EntityUid Add( [CommandInvocationContext] IInvocationContext ctx, diff --git a/Resources/Locale/en-US/commands/toolshed-commands.ftl b/Resources/Locale/en-US/commands/toolshed-commands.ftl index e2536f6781..c53c825eb3 100644 --- a/Resources/Locale/en-US/commands/toolshed-commands.ftl +++ b/Resources/Locale/en-US/commands/toolshed-commands.ftl @@ -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 =