diff --git a/Content.Server/Chat/Commands/AdminChatCommand.cs b/Content.Server/Chat/Commands/AdminChatCommand.cs index 1a7ae050b6..38eb977afc 100644 --- a/Content.Server/Chat/Commands/AdminChatCommand.cs +++ b/Content.Server/Chat/Commands/AdminChatCommand.cs @@ -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 "; + [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().TrySendOOCMessage(player, message, OOCChatType.Admin); + _chatManager.TrySendOOCMessage(player, message, OOCChatType.Admin); } } } diff --git a/Content.Server/Chat/Commands/MeCommand.cs b/Content.Server/Chat/Commands/MeCommand.cs index e763d5656e..36acfa7a69 100644 --- a/Content.Server/Chat/Commands/MeCommand.cs +++ b/Content.Server/Chat/Commands/MeCommand.cs @@ -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 "; + [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().GetEntitySystem() - .TrySendInGameICMessage(playerEntity, message, InGameICChatType.Emote, ChatTransmitRange.Normal, false, shell, player); + _chatSystem.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Emote, ChatTransmitRange.Normal, false, shell, player); } } } diff --git a/Content.Server/Chat/Commands/OOCCommand.cs b/Content.Server/Chat/Commands/OOCCommand.cs index 36f6303fbd..1760d49cea 100644 --- a/Content.Server/Chat/Commands/OOCCommand.cs +++ b/Content.Server/Chat/Commands/OOCCommand.cs @@ -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 "; + [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().TrySendOOCMessage(player, message, OOCChatType.OOC); + _chatManager.TrySendOOCMessage(player, message, OOCChatType.OOC); } } } diff --git a/Content.Server/Chat/Commands/SayCommand.cs b/Content.Server/Chat/Commands/SayCommand.cs index df6e548e5d..99ca4660f0 100644 --- a/Content.Server/Chat/Commands/SayCommand.cs +++ b/Content.Server/Chat/Commands/SayCommand.cs @@ -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 "; + [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().GetEntitySystem() - .TrySendInGameICMessage(playerEntity, message, InGameICChatType.Speak, ChatTransmitRange.Normal, false, shell, player); + _chatSystem.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Speak, ChatTransmitRange.Normal, false, shell, player); } } } diff --git a/Content.Server/Chat/Commands/SetLOOCCommand.cs b/Content.Server/Chat/Commands/SetLOOCCommand.cs index 9cfa2a67fc..c97c67c569 100644 --- a/Content.Server/Chat/Commands/SetLOOCCommand.cs +++ b/Content.Server/Chat/Commands/SetLOOCCommand.cs @@ -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(); + [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")); } } diff --git a/Content.Server/Chat/Commands/SetOOCCommand.cs b/Content.Server/Chat/Commands/SetOOCCommand.cs index d712a62401..46e7e84af4 100644 --- a/Content.Server/Chat/Commands/SetOOCCommand.cs +++ b/Content.Server/Chat/Commands/SetOOCCommand.cs @@ -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(); + [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")); } } diff --git a/Content.Server/Chat/Commands/WhisperCommand.cs b/Content.Server/Chat/Commands/WhisperCommand.cs index 13effa3446..0556dd8036 100644 --- a/Content.Server/Chat/Commands/WhisperCommand.cs +++ b/Content.Server/Chat/Commands/WhisperCommand.cs @@ -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 "; + [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().GetEntitySystem() - .TrySendInGameICMessage(playerEntity, message, InGameICChatType.Whisper, ChatTransmitRange.Normal, false, shell, player); + _chatSystem.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Whisper, ChatTransmitRange.Normal, false, shell, player); } } } diff --git a/Content.Server/EntityList/SpawnEntityListCommand.cs b/Content.Server/EntityList/SpawnEntityListCommand.cs index 127e1ec47c..07bc26996e 100644 --- a/Content.Server/EntityList/SpawnEntityListCommand.cs +++ b/Content.Server/EntityList/SpawnEntityListCommand.cs @@ -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} "; + [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(); - - 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(); var i = 0; - foreach (var entity in prototype.Entities(prototypeManager)) + foreach (var entity in prototype.Entities(_prototypeManager)) { - entityManager.SpawnEntity(entity.ID, entityManager.GetComponent(attached).Coordinates); + EntityManager.SpawnEntity(entity.ID, EntityManager.GetComponent(attached).Coordinates); i++; } - shell.WriteLine($"Spawned {i} entities."); + shell.WriteLine(Loc.GetString($"cmd-spawnentitylist-success", ("count", i))); } } } diff --git a/Content.Server/GameTicking/Commands/ToggleDisallowLateJoinCommand.cs b/Content.Server/GameTicking/Commands/ToggleDisallowLateJoinCommand.cs index f6e94eb93f..813b395c29 100644 --- a/Content.Server/GameTicking/Commands/ToggleDisallowLateJoinCommand.cs +++ b/Content.Server/GameTicking/Commands/ToggleDisallowLateJoinCommand.cs @@ -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} "; + [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(); - 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")); } } } diff --git a/Resources/Locale/en-US/administration/commands/set-looc-command.ftl b/Resources/Locale/en-US/administration/commands/set-looc-command.ftl index 2125939052..8d14ac8954 100644 --- a/Resources/Locale/en-US/administration/commands/set-looc-command.ftl +++ b/Resources/Locale/en-US/administration/commands/set-looc-command.ftl @@ -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. diff --git a/Resources/Locale/en-US/administration/commands/set-ooc-command.ftl b/Resources/Locale/en-US/administration/commands/set-ooc-command.ftl index 62b0747173..bb73d209da 100644 --- a/Resources/Locale/en-US/administration/commands/set-ooc-command.ftl +++ b/Resources/Locale/en-US/administration/commands/set-ooc-command.ftl @@ -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 index 0000000000..3882947a7e --- /dev/null +++ b/Resources/Locale/en-US/commands/asay-command.ftl @@ -0,0 +1,2 @@ +cmd-asay-desc = Send chat messages to the private admin chat channel. +cmd-asay-help = Usage: asay diff --git a/Resources/Locale/en-US/commands/me-command.ftl b/Resources/Locale/en-US/commands/me-command.ftl new file mode 100644 index 0000000000..cd482b0be3 --- /dev/null +++ b/Resources/Locale/en-US/commands/me-command.ftl @@ -0,0 +1,2 @@ +cmd-me-desc = Perform an action. +cmd-me-help = Usage: me diff --git a/Resources/Locale/en-US/commands/ooc-command.ftl b/Resources/Locale/en-US/commands/ooc-command.ftl new file mode 100644 index 0000000000..a2fa48e2ae --- /dev/null +++ b/Resources/Locale/en-US/commands/ooc-command.ftl @@ -0,0 +1,2 @@ +cmd-ooc-desc = Send Out Of Character chat messages. +cmd-ooc-help = Usage: ooc diff --git a/Resources/Locale/en-US/commands/say-command.ftl b/Resources/Locale/en-US/commands/say-command.ftl new file mode 100644 index 0000000000..8deb7bdc45 --- /dev/null +++ b/Resources/Locale/en-US/commands/say-command.ftl @@ -0,0 +1,2 @@ +cmd-say-desc = Send chat messages to the local channel or a specified radio channel. +cmd-say-help = Usage: say 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 index 0000000000..b8f41fd945 --- /dev/null +++ b/Resources/Locale/en-US/commands/spawn-entity-list-command.ftl @@ -0,0 +1,4 @@ +cmd-spawnentitylist-desc = Spawns a list of entities around you. +cmd-spawnentitylist-help = Usage: spawnentitylist +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 index 0000000000..1f797b4141 --- /dev/null +++ b/Resources/Locale/en-US/commands/toggle-disallow-late-join-command.ftl @@ -0,0 +1,4 @@ +cmd-toggledisallowlatejoin-desc = Allows or disallows latejoining during mid-game. +cmd-toggledisallowlatejoin-help = Usage: toggledisallowlatejoin +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 index 0000000000..7dfe909f24 --- /dev/null +++ b/Resources/Locale/en-US/commands/whisper-command.ftl @@ -0,0 +1,2 @@ +cmd-whisper-desc = Send chat messages to the local channel as a whisper. +cmd-whisper-help = Usage: whisper