From f58baf042850680f9a03714976a3b33c48ca5ddf Mon Sep 17 00:00:00 2001 From: ElectroJr Date: Tue, 24 Dec 2024 03:37:31 +1300 Subject: [PATCH 1/5] Update permissions for engine toolshed PR --- Resources/toolshedEngineCommandPerms.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/toolshedEngineCommandPerms.yml b/Resources/toolshedEngineCommandPerms.yml index b9911e9468db1d..ae02339c1a2430 100644 --- a/Resources/toolshedEngineCommandPerms.yml +++ b/Resources/toolshedEngineCommandPerms.yml @@ -74,7 +74,7 @@ - '%' - '%/' - '&~' - - '|~' + - bitornot - '^~' - '~' - '<' @@ -88,7 +88,7 @@ - '*/' - '//' - '&' - - '|' + - bitor - '^' - neg - abs From 9d05ea9f57dcb0931f820dab19648d6e6c7c30b9 Mon Sep 17 00:00:00 2001 From: ElectroJr Date: Tue, 24 Dec 2024 04:01:17 +1300 Subject: [PATCH 2/5] Poke tests From f95fb450fd936a4d5e73a34f4fd641c9a4dc4fcc Mon Sep 17 00:00:00 2001 From: ElectroJr Date: Thu, 2 Jan 2025 17:00:13 +1300 Subject: [PATCH 3/5] obsolete --- Content.Server/Commands/CommandUtils.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Content.Server/Commands/CommandUtils.cs b/Content.Server/Commands/CommandUtils.cs index 30ea41b7c9faa3..fde52d18e1a45f 100644 --- a/Content.Server/Commands/CommandUtils.cs +++ b/Content.Server/Commands/CommandUtils.cs @@ -4,6 +4,7 @@ using Robust.Shared.Console; using Robust.Shared.Network; using Robust.Shared.Player; +using Robust.Shared.Toolshed.Commands.Generic; namespace Content.Server.Commands { @@ -51,6 +52,7 @@ public static bool TryGetAttachedEntityByUsernameOrId(IConsoleShell shell, return true; } + [Obsolete($"Use toolshed's {nameof(EmplaceCommand)}")] public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, string ruleString) { var entMan = IoCManager.Resolve(); From 48c13b32f43be057775acb8a87aa950dbd92adf5 Mon Sep 17 00:00:00 2001 From: ElectroJr Date: Thu, 2 Jan 2025 17:00:45 +1300 Subject: [PATCH 4/5] Remove unused helper. Use EmplaceCommand instead --- Content.Server/Commands/CommandUtils.cs | 41 ------------------------- 1 file changed, 41 deletions(-) diff --git a/Content.Server/Commands/CommandUtils.cs b/Content.Server/Commands/CommandUtils.cs index fde52d18e1a45f..502c3ae0241e57 100644 --- a/Content.Server/Commands/CommandUtils.cs +++ b/Content.Server/Commands/CommandUtils.cs @@ -51,46 +51,5 @@ public static bool TryGetAttachedEntityByUsernameOrId(IConsoleShell shell, attachedEntity = session.AttachedEntity.Value; return true; } - - [Obsolete($"Use toolshed's {nameof(EmplaceCommand)}")] - public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, string ruleString) - { - var entMan = IoCManager.Resolve(); - var transform = entMan.GetComponent(ent); - var transformSystem = entMan.System(); - var worldPosition = transformSystem.GetWorldPosition(transform); - - // gross, is there a better way to do this? - ruleString = ruleString.Replace("$ID", ent.ToString()); - ruleString = ruleString.Replace("$WX", - worldPosition.X.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$WY", - worldPosition.Y.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$LX", - transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$LY", - transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$NAME", entMan.GetComponent(ent).EntityName); - - if (shell.Player is { } player) - { - if (player.AttachedEntity is {Valid: true} p) - { - var pTransform = entMan.GetComponent(p); - var pWorldPosition = transformSystem.GetWorldPosition(pTransform); - - ruleString = ruleString.Replace("$PID", ent.ToString()); - ruleString = ruleString.Replace("$PWX", - pWorldPosition.X.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$PWY", - pWorldPosition.Y.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$PLX", - pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$PLY", - pTransform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); - } - } - return ruleString; - } } } From e5468982f5806dbf0066be3dd671f5da949414b6 Mon Sep 17 00:00:00 2001 From: ElectroJr Date: Fri, 3 Jan 2025 18:45:02 +1300 Subject: [PATCH 5/5] Fix mark verb --- Content.Server/Administration/Systems/AdminVerbSystem.cs | 2 +- Content.Server/Administration/Toolshed/MarkedCommand.cs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index 0640537f57ecd9..43b60075837837 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -105,7 +105,7 @@ private void AddAdminVerbs(GetVerbsEvent args) mark.Text = Loc.GetString("toolshed-verb-mark"); mark.Message = Loc.GetString("toolshed-verb-mark-description"); mark.Category = VerbCategory.Admin; - mark.Act = () => _toolshed.InvokeCommand(player, "=> $marked", Enumerable.Repeat(args.Target, 1), out _); + mark.Act = () => _toolshed.InvokeCommand(player, "=> $marked", new List {args.Target}, out _); mark.Impact = LogImpact.Low; args.Verbs.Add(mark); diff --git a/Content.Server/Administration/Toolshed/MarkedCommand.cs b/Content.Server/Administration/Toolshed/MarkedCommand.cs index 54d45a352de781..c2b9ecf79a0dac 100644 --- a/Content.Server/Administration/Toolshed/MarkedCommand.cs +++ b/Content.Server/Administration/Toolshed/MarkedCommand.cs @@ -9,8 +9,7 @@ public sealed class MarkedCommand : ToolshedCommand [CommandImplementation] public IEnumerable Marked(IInvocationContext ctx) { - var res = (IEnumerable?)ctx.ReadVar("marked"); - res ??= Array.Empty(); - return res; + var marked = ctx.ReadVar("marked") as IEnumerable; + return marked ?? Array.Empty(); } }