]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Command resolves and LEC conversions batch 4 (#38382)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Thu, 19 Jun 2025 00:03:28 +0000 (20:03 -0400)
committerGitHub <noreply@github.com>
Thu, 19 Jun 2025 00:03:28 +0000 (02:03 +0200)
* reeeecolllaaaaaaaa

* gonna convert these to public while I'm here for consistency sake

* requested changes.

18 files changed:
Content.Server/Chat/Commands/AdminChatCommand.cs
Content.Server/Chat/Commands/MeCommand.cs
Content.Server/Chat/Commands/OOCCommand.cs
Content.Server/Chat/Commands/SayCommand.cs
Content.Server/Chat/Commands/SetLOOCCommand.cs
Content.Server/Chat/Commands/SetOOCCommand.cs
Content.Server/Chat/Commands/WhisperCommand.cs
Content.Server/EntityList/SpawnEntityListCommand.cs
Content.Server/GameTicking/Commands/ToggleDisallowLateJoinCommand.cs
Resources/Locale/en-US/administration/commands/set-looc-command.ftl
Resources/Locale/en-US/administration/commands/set-ooc-command.ftl
Resources/Locale/en-US/commands/asay-command.ftl [new file with mode: 0644]
Resources/Locale/en-US/commands/me-command.ftl [new file with mode: 0644]
Resources/Locale/en-US/commands/ooc-command.ftl [new file with mode: 0644]
Resources/Locale/en-US/commands/say-command.ftl [new file with mode: 0644]
Resources/Locale/en-US/commands/spawn-entity-list-command.ftl [new file with mode: 0644]
Resources/Locale/en-US/commands/toggle-disallow-late-join-command.ftl [new file with mode: 0644]
Resources/Locale/en-US/commands/whisper-command.ftl [new file with mode: 0644]

index 1a7ae050b66491c4e1f7418ad2c36fc23cc2ac3b..38eb977afc8955ac3b6d606cc9114e1ba2e81aba 100644 (file)
@@ -6,19 +6,19 @@ using Robust.Shared.Console;
 namespace Content.Server.Chat.Commands
 {
     [AdminCommand(AdminFlags.Adminchat)]
-    internal sealed class AdminChatCommand : IConsoleCommand
+    internal sealed class AdminChatCommand : LocalizedCommands
     {
-        public string Command => "asay";
-        public string Description => "Send chat messages to the private admin chat channel.";
-        public string Help => "asay <text>";
+        [Dependency] private readonly IChatManager _chatManager = default!;
 
-        public void Execute(IConsoleShell shell, string argStr, string[] args)
+        public override string Command => "asay";
+
+        public override void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             var player = shell.Player;
 
             if (player == null)
             {
-                shell.WriteError("You can't run this command locally.");
+                shell.WriteError(Loc.GetString($"shell-cannot-run-command-from-server"));
                 return;
             }
 
@@ -29,7 +29,7 @@ namespace Content.Server.Chat.Commands
             if (string.IsNullOrEmpty(message))
                 return;
 
-            IoCManager.Resolve<IChatManager>().TrySendOOCMessage(player, message, OOCChatType.Admin);
+            _chatManager.TrySendOOCMessage(player, message, OOCChatType.Admin);
         }
     }
 }
index e763d5656e16da01049c225892671787d8fd3484..36acfa7a69268824a250fdc5fec746412dd338cb 100644 (file)
@@ -6,17 +6,17 @@ using Robust.Shared.Enums;
 namespace Content.Server.Chat.Commands
 {
     [AnyCommand]
-    internal sealed class MeCommand : IConsoleCommand
+    internal sealed class MeCommand : LocalizedEntityCommands
     {
-        public string Command => "me";
-        public string Description => "Perform an action.";
-        public string Help => "me <text>";
+        [Dependency] private readonly ChatSystem _chatSystem = default!;
 
-        public void Execute(IConsoleShell shell, string argStr, string[] args)
+        public override string Command => "me";
+
+        public override void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             if (shell.Player is not { } player)
             {
-                shell.WriteError("This command cannot be run from the server.");
+                shell.WriteError(Loc.GetString($"shell-cannot-run-command-from-server"));
                 return;
             }
 
@@ -25,7 +25,7 @@ namespace Content.Server.Chat.Commands
 
             if (player.AttachedEntity is not {} playerEntity)
             {
-                shell.WriteError("You don't have an entity!");
+                shell.WriteError(Loc.GetString($"shell-must-be-attached-to-entity"));
                 return;
             }
 
@@ -36,8 +36,7 @@ namespace Content.Server.Chat.Commands
             if (string.IsNullOrEmpty(message))
                 return;
 
-            IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>()
-                .TrySendInGameICMessage(playerEntity, message, InGameICChatType.Emote, ChatTransmitRange.Normal, false, shell, player);
+            _chatSystem.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Emote, ChatTransmitRange.Normal, false, shell, player);
         }
     }
 }
index 36f6303fbd145c29e0ec0ca7fcb2269c6bfff2f0..1760d49ceac3b0f3cd1904da5e322f1024ea4605 100644 (file)
@@ -5,17 +5,17 @@ using Robust.Shared.Console;
 namespace Content.Server.Chat.Commands
 {
     [AnyCommand]
-    internal sealed class OOCCommand : IConsoleCommand
+    internal sealed class OOCCommand : LocalizedCommands
     {
-        public string Command => "ooc";
-        public string Description => "Send Out Of Character chat messages.";
-        public string Help => "ooc <text>";
+        [Dependency] private readonly IChatManager _chatManager = default!;
 
-        public void Execute(IConsoleShell shell, string argStr, string[] args)
+        public override string Command => "ooc";
+
+        public override void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             if (shell.Player is not { } player)
             {
-                shell.WriteError("This command cannot be run from the server.");
+                shell.WriteError(Loc.GetString($"shell-cannot-run-command-from-server"));
                 return;
             }
 
@@ -26,7 +26,7 @@ namespace Content.Server.Chat.Commands
             if (string.IsNullOrEmpty(message))
                 return;
 
-            IoCManager.Resolve<IChatManager>().TrySendOOCMessage(player, message, OOCChatType.OOC);
+            _chatManager.TrySendOOCMessage(player, message, OOCChatType.OOC);
         }
     }
 }
index df6e548e5d9efcbba29485bbad3a34bb5a4c9bbc..99ca4660f0587cb78b4ae7bb2dbd4a90ca90c250 100644 (file)
@@ -6,13 +6,12 @@ using Robust.Shared.Enums;
 namespace Content.Server.Chat.Commands
 {
     [AnyCommand]
-    internal sealed class SayCommand : IConsoleCommand
+    internal sealed class SayCommand : LocalizedEntityCommands
     {
-        public string Command => "say";
-        public string Description => "Send chat messages to the local channel or a specified radio channel.";
-        public string Help => "say <text>";
+        [Dependency] private readonly ChatSystem _chatSystem = default!;
+        public override string Command => "say";
 
-        public void Execute(IConsoleShell shell, string argStr, string[] args)
+        public override void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             if (shell.Player is not { } player)
             {
@@ -25,7 +24,7 @@ namespace Content.Server.Chat.Commands
 
             if (player.AttachedEntity is not {} playerEntity)
             {
-                shell.WriteError("You don't have an entity!");
+                shell.WriteError(Loc.GetString($"shell-must-be-attached-to-entity"));
                 return;
             }
 
@@ -36,8 +35,7 @@ namespace Content.Server.Chat.Commands
             if (string.IsNullOrEmpty(message))
                 return;
 
-            IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>()
-                .TrySendInGameICMessage(playerEntity, message, InGameICChatType.Speak, ChatTransmitRange.Normal, false, shell, player);
+            _chatSystem.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Speak, ChatTransmitRange.Normal, false, shell, player);
         }
     }
 }
index 9cfa2a67fcbf216ee81da13c2dffef89abd1dba0..c97c67c56904aacda4549052e4075dc3f4b73600 100644 (file)
@@ -7,22 +7,21 @@ using Robust.Shared.Console;
 namespace Content.Server.Chat.Commands;
 
 [AdminCommand(AdminFlags.Server)]
-public sealed class SetLOOCCommand : IConsoleCommand
+public sealed class SetLoocCommand : LocalizedCommands
 {
-    public string Command => "setlooc";
-    public string Description => Loc.GetString("set-looc-command-description");
-    public string Help => Loc.GetString("set-looc-command-help");
-    public void Execute(IConsoleShell shell, string argStr, string[] args)
-    {
-        var cfg = IoCManager.Resolve<IConfigurationManager>();
+    [Dependency] private readonly IConfigurationManager _configManager = default!;
+
+    public override string Command => "setlooc";
 
+    public override void Execute(IConsoleShell shell, string argStr, string[] args)
+    {
         if (args.Length > 1)
         {
-            shell.WriteError(Loc.GetString("set-looc-command-too-many-arguments-error"));
+            shell.WriteError(Loc.GetString("shell-need-between-arguments", ("lower", 0), ("upper", 1)));
             return;
         }
 
-        var looc = cfg.GetCVar(CCVars.LoocEnabled);
+        var looc = _configManager.GetCVar(CCVars.LoocEnabled);
 
         if (args.Length == 0)
         {
@@ -31,12 +30,12 @@ public sealed class SetLOOCCommand : IConsoleCommand
 
         if (args.Length == 1 && !bool.TryParse(args[0], out looc))
         {
-            shell.WriteError(Loc.GetString("set-looc-command-invalid-argument-error"));
+            shell.WriteError(Loc.GetString("shell-invalid-bool"));
             return;
         }
 
-        cfg.SetCVar(CCVars.LoocEnabled, looc);
+        _configManager.SetCVar(CCVars.LoocEnabled, looc);
 
-        shell.WriteLine(Loc.GetString(looc ? "set-looc-command-looc-enabled" : "set-looc-command-looc-disabled"));
+        shell.WriteLine(Loc.GetString(looc ? "cmd-setlooc-looc-enabled" : "cmd-setlooc-looc-disabled"));
     }
 }
index d712a62401ad3a995e941b028e1f33d72661fca5..46e7e84af4d1b8b144a9c691e2e7549b8c2c0010 100644 (file)
@@ -7,22 +7,21 @@ using Robust.Shared.Console;
 namespace Content.Server.Chat.Commands;
 
 [AdminCommand(AdminFlags.Admin)]
-public sealed class SetOOCCommand : IConsoleCommand
+public sealed class SetOOCCommand : LocalizedCommands
 {
-    public string Command => "setooc";
-    public string Description => Loc.GetString("set-ooc-command-description");
-    public string Help => Loc.GetString("set-ooc-command-help");
-    public void Execute(IConsoleShell shell, string argStr, string[] args)
-    {
-        var cfg = IoCManager.Resolve<IConfigurationManager>();
+    [Dependency] private readonly IConfigurationManager _configManager = default!;
+
+    public override string Command => "setooc";
 
+    public override void Execute(IConsoleShell shell, string argStr, string[] args)
+    {
         if (args.Length > 1)
         {
-            shell.WriteError(Loc.GetString("set-ooc-command-too-many-arguments-error"));
+            shell.WriteError(Loc.GetString("shell-need-between-arguments", ("lower", 0), ("upper", 1)));
             return;
         }
 
-        var ooc = cfg.GetCVar(CCVars.OocEnabled);
+        var ooc = _configManager.GetCVar(CCVars.OocEnabled);
 
         if (args.Length == 0)
         {
@@ -31,12 +30,12 @@ public sealed class SetOOCCommand : IConsoleCommand
 
         if (args.Length == 1 && !bool.TryParse(args[0], out ooc))
         {
-            shell.WriteError(Loc.GetString("set-ooc-command-invalid-argument-error"));
+            shell.WriteError(Loc.GetString("shell-invalid-bool"));
             return;
         }
 
-        cfg.SetCVar(CCVars.OocEnabled, ooc);
+        _configManager.SetCVar(CCVars.OocEnabled, ooc);
 
-        shell.WriteLine(Loc.GetString(ooc ? "set-ooc-command-ooc-enabled" : "set-ooc-command-ooc-disabled"));
+        shell.WriteLine(Loc.GetString(ooc ? "cmd-setooc-ooc-enabled" : "cmd-setooc-ooc-disabled"));
     }
 }
index 13effa34464ba85804a1be69a50e0017ba20fcec..0556dd8036143e531667aadfae1cc20323c4f08d 100644 (file)
@@ -6,13 +6,12 @@ using Robust.Shared.Enums;
 namespace Content.Server.Chat.Commands
 {
     [AnyCommand]
-    internal sealed class WhisperCommand : IConsoleCommand
+    internal sealed class WhisperCommand : LocalizedEntityCommands
     {
-        public string Command => "whisper";
-        public string Description => "Send chat messages to the local channel as a whisper";
-        public string Help => "whisper <text>";
+        [Dependency] private readonly ChatSystem _chatSystem = default!;
+        public override string Command => "whisper";
 
-        public void Execute(IConsoleShell shell, string argStr, string[] args)
+        public override void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             if (shell.Player is not { } player)
             {
@@ -25,7 +24,7 @@ namespace Content.Server.Chat.Commands
 
             if (player.AttachedEntity is not {} playerEntity)
             {
-                shell.WriteError("You don't have an entity!");
+                shell.WriteError(Loc.GetString($"shell-must-be-attached-to-entity"));
                 return;
             }
 
@@ -36,8 +35,7 @@ namespace Content.Server.Chat.Commands
             if (string.IsNullOrEmpty(message))
                 return;
 
-            IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>()
-                .TrySendInGameICMessage(playerEntity, message, InGameICChatType.Whisper, ChatTransmitRange.Normal, false, shell, player);
+            _chatSystem.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Whisper, ChatTransmitRange.Normal, false, shell, player);
         }
     }
 }
index 127e1ec47cc70183589772c1e81bea3ce8772814..07bc26996e92736095cd5a20292f950bcd6606c6 100644 (file)
@@ -7,17 +7,17 @@ using Robust.Shared.Prototypes;
 namespace Content.Server.EntityList
 {
     [AdminCommand(AdminFlags.Spawn)]
-    public sealed class SpawnEntityListCommand : IConsoleCommand
+    public sealed class SpawnEntityListCommand : LocalizedEntityCommands
     {
-        public string Command => "spawnentitylist";
-        public string Description => "Spawns a list of entities around you";
-        public string Help => $"Usage: {Command} <entityListPrototypeId>";
+        [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
 
-        public void Execute(IConsoleShell shell, string argStr, string[] args)
+        public override string Command => "spawnentitylist";
+
+        public override void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             if (args.Length != 1)
             {
-                shell.WriteError($"Invalid arguments.\n{Help}");
+                shell.WriteError(Loc.GetString($"shell-need-exactly-one-argument"));
                 return;
             }
 
@@ -33,24 +33,23 @@ namespace Content.Server.EntityList
                 return;
             }
 
-            var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
-
-            if (!prototypeManager.TryIndex(args[0], out EntityListPrototype? prototype))
+            if (!_prototypeManager.TryIndex(args[0], out EntityListPrototype? prototype))
             {
-                shell.WriteError($"No {nameof(EntityListPrototype)} found with id {args[0]}");
+                shell.WriteError(Loc.GetString($"cmd-spawnentitylist-failed",
+                    ("prototype", nameof(EntityListPrototype)),
+                    ("id", args[0])));
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
             var i = 0;
 
-            foreach (var entity in prototype.Entities(prototypeManager))
+            foreach (var entity in prototype.Entities(_prototypeManager))
             {
-                entityManager.SpawnEntity(entity.ID, entityManager.GetComponent<TransformComponent>(attached).Coordinates);
+                EntityManager.SpawnEntity(entity.ID, EntityManager.GetComponent<TransformComponent>(attached).Coordinates);
                 i++;
             }
 
-            shell.WriteLine($"Spawned {i} entities.");
+            shell.WriteLine(Loc.GetString($"cmd-spawnentitylist-success", ("count", i)));
         }
     }
 }
index f6e94eb93f0a640b9d71cfa5b7fc63b515a04cd5..813b395c2970d01a9d783d75f8d7fcc4ab8c6198 100644 (file)
@@ -7,31 +7,27 @@ using Robust.Shared.Console;
 namespace Content.Server.GameTicking.Commands
 {
     [AdminCommand(AdminFlags.Round)]
-    sealed class ToggleDisallowLateJoinCommand : IConsoleCommand
+    public sealed class ToggleDisallowLateJoinCommand : LocalizedCommands
     {
-        public string Command => "toggledisallowlatejoin";
-        public string Description => "Allows or disallows latejoining during mid-game.";
-        public string Help => $"Usage: {Command} <disallow>";
+        [Dependency] private readonly IConfigurationManager _configManager = default!;
 
-        public void Execute(IConsoleShell shell, string argStr, string[] args)
+        public override string Command => "toggledisallowlatejoin";
+
+        public override void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             if (args.Length != 1)
             {
-                shell.WriteLine("Need exactly one argument.");
+                shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
                 return;
             }
 
-            var cfgMan = IoCManager.Resolve<IConfigurationManager>();
-
             if (bool.TryParse(args[0], out var result))
             {
-                cfgMan.SetCVar(CCVars.GameDisallowLateJoins, bool.Parse(args[0]));
-                shell.WriteLine(result ? "Late joining has been disabled." : "Late joining has been enabled.");
+                _configManager.SetCVar(CCVars.GameDisallowLateJoins, bool.Parse(args[0]));
+                shell.WriteLine(Loc.GetString(result ? "cmd-toggledisallowlatejoin-disabled" : "cmd-toggledisallowlatejoin-enabled"));
             }
             else
-            {
-                shell.WriteLine("Invalid argument.");
-            }
+                shell.WriteLine(Loc.GetString($"shell-invalid-bool"));
         }
     }
 }
index 21259390521fcbf22cb00c6d03187b2a08e2f55f..8d14ac89546aaf5075b5a6ac9111595df0ae661c 100644 (file)
@@ -1,6 +1,4 @@
-set-looc-command-description = Allows you to enable or disable LOOC.
-set-looc-command-help = Usage: setlooc OR setlooc [value]
-set-looc-command-too-many-arguments-error = Too many arguments.
-set-looc-command-invalid-argument-error = Invalid argument.
-set-looc-command-looc-enabled = LOOC chat has been enabled.
-set-looc-command-looc-disabled = LOOC chat has been disabled.
+cmd-setlooc-description = Allows you to enable or disable LOOC.
+cmd-setlooc-help = Usage: setlooc OR setlooc [value]
+cmd-setlooc-looc-enabled = LOOC chat has been enabled.
+cmd-setlooc-looc-disabled = LOOC chat has been disabled.
index 62b07471735f8427444a4b4d9763d300077d90fa..bb73d209daafef87b695375dca9b55ceab38bfb6 100644 (file)
@@ -1,6 +1,4 @@
-set-ooc-command-description = Allows you to enable or disable OOC.
-set-ooc-command-help = Usage: setooc OR setooc [value]
-set-ooc-command-too-many-arguments-error = Too many arguments.
-set-ooc-command-invalid-argument-error = Invalid argument.
-set-ooc-command-ooc-enabled = OOC chat has been enabled.
-set-ooc-command-ooc-disabled = OOC chat has been disabled.
+cmd-setooc-desc = Allows you to enable or disable OOC.
+cmd-setooc-help = Usage: setooc OR setooc [value]
+cmd-setooc-ooc-enabled = OOC chat has been enabled.
+cmd-setooc-ooc-disabled = OOC chat has been disabled.
diff --git a/Resources/Locale/en-US/commands/asay-command.ftl b/Resources/Locale/en-US/commands/asay-command.ftl
new file mode 100644 (file)
index 0000000..3882947
--- /dev/null
@@ -0,0 +1,2 @@
+cmd-asay-desc = Send chat messages to the private admin chat channel.
+cmd-asay-help = Usage: asay <text>
diff --git a/Resources/Locale/en-US/commands/me-command.ftl b/Resources/Locale/en-US/commands/me-command.ftl
new file mode 100644 (file)
index 0000000..cd482b0
--- /dev/null
@@ -0,0 +1,2 @@
+cmd-me-desc = Perform an action.
+cmd-me-help = Usage: me <text>
diff --git a/Resources/Locale/en-US/commands/ooc-command.ftl b/Resources/Locale/en-US/commands/ooc-command.ftl
new file mode 100644 (file)
index 0000000..a2fa48e
--- /dev/null
@@ -0,0 +1,2 @@
+cmd-ooc-desc = Send Out Of Character chat messages.
+cmd-ooc-help = Usage: ooc <text>
diff --git a/Resources/Locale/en-US/commands/say-command.ftl b/Resources/Locale/en-US/commands/say-command.ftl
new file mode 100644 (file)
index 0000000..8deb7bd
--- /dev/null
@@ -0,0 +1,2 @@
+cmd-say-desc = Send chat messages to the local channel or a specified radio channel.
+cmd-say-help = Usage: say <text>
diff --git a/Resources/Locale/en-US/commands/spawn-entity-list-command.ftl b/Resources/Locale/en-US/commands/spawn-entity-list-command.ftl
new file mode 100644 (file)
index 0000000..b8f41fd
--- /dev/null
@@ -0,0 +1,4 @@
+cmd-spawnentitylist-desc = Spawns a list of entities around you.
+cmd-spawnentitylist-help = Usage: spawnentitylist <entityListPrototypeId>
+cmd-spawnentitylist-failed = No {$prototype} found with id {$id},
+cmd-spawnentitylist-success = Spawned {$count} entities.
diff --git a/Resources/Locale/en-US/commands/toggle-disallow-late-join-command.ftl b/Resources/Locale/en-US/commands/toggle-disallow-late-join-command.ftl
new file mode 100644 (file)
index 0000000..1f797b4
--- /dev/null
@@ -0,0 +1,4 @@
+cmd-toggledisallowlatejoin-desc = Allows or disallows latejoining during mid-game.
+cmd-toggledisallowlatejoin-help = Usage: toggledisallowlatejoin <disallow>
+cmd-toggledisallowlatejoin-disabled = Late joining has been disabled.
+cmd-toggledisallowlatejoin-enabled = Late joining has been enabled.
diff --git a/Resources/Locale/en-US/commands/whisper-command.ftl b/Resources/Locale/en-US/commands/whisper-command.ftl
new file mode 100644 (file)
index 0000000..7dfe909
--- /dev/null
@@ -0,0 +1,2 @@
+cmd-whisper-desc = Send chat messages to the local channel as a whisper.
+cmd-whisper-help = Usage: whisper <text>