diff --git a/OpenRA.Mods.Common/Commands/DebugVisualizationCommands.cs b/OpenRA.Mods.Common/Commands/DebugVisualizationCommands.cs index fc3d367364..bf994d838b 100644 --- a/OpenRA.Mods.Common/Commands/DebugVisualizationCommands.cs +++ b/OpenRA.Mods.Common/Commands/DebugVisualizationCommands.cs @@ -23,13 +23,28 @@ namespace OpenRA.Mods.Common.Commands public class DebugVisualizationCommands : IChatCommand, IWorldLoaded { + [TranslationReference] + static readonly string CombatGeometryDescription = "combat-geometry-description"; + + [TranslationReference] + static readonly string RenderGeometryDescription = "render-geometry-description"; + + [TranslationReference] + static readonly string ScreenMapOverlayDescription = "screen-map-overlay-description"; + + [TranslationReference] + static readonly string DepthBufferDescription = "depth-buffer-description"; + + [TranslationReference] + static readonly string ActorTagsOverlayDescripition = "actor-tags-overlay-description"; + readonly IDictionary Handler)> commandHandlers = new Dictionary Handler)> { - { "combat-geometry", ("toggles combat geometry overlay.", CombatGeometry) }, - { "render-geometry", ("toggles render geometry overlay.", RenderGeometry) }, - { "screen-map", ("toggles screen map overlay.", ScreenMap) }, - { "depth-buffer", ("toggles depth buffer overlay.", DepthBuffer) }, - { "actor-tags", ("toggles actor tags overlay.", ActorTags) }, + { "combat-geometry", (CombatGeometryDescription, CombatGeometry) }, + { "render-geometry", (RenderGeometryDescription, RenderGeometry) }, + { "screen-map", (ScreenMapOverlayDescription, ScreenMap) }, + { "depth-buffer", (DepthBufferDescription, DepthBuffer) }, + { "actor-tags", (ActorTagsOverlayDescripition, ActorTags) }, }; DebugVisualizations debugVis; diff --git a/OpenRA.Mods.Common/Commands/DevCommands.cs b/OpenRA.Mods.Common/Commands/DevCommands.cs index f2f7c7eb86..351d9a69a2 100644 --- a/OpenRA.Mods.Common/Commands/DevCommands.cs +++ b/OpenRA.Mods.Common/Commands/DevCommands.cs @@ -30,23 +30,68 @@ namespace OpenRA.Mods.Common.Commands [TranslationReference] static readonly string InvalidCashAmount = "invalid-cash-amount"; + [TranslationReference] + static readonly string ToggleVisiblityDescription = "toggle-visibility"; + + [TranslationReference] + static readonly string GiveCashDescription = "give-cash"; + + [TranslationReference] + static readonly string GiveCashAllDescription = "give-cash-all"; + + [TranslationReference] + static readonly string InstantBuildingDescription = "instant-building"; + + [TranslationReference] + static readonly string BuildAnywhereDescription = "build-anywhere"; + + [TranslationReference] + static readonly string UnlimitedPowerDescription = "unlimited-power"; + + [TranslationReference] + static readonly string EnableTechDescription = "enable-tech"; + + [TranslationReference] + static readonly string FastChargeDescription = "fast-charge"; + + [TranslationReference] + static readonly string DevCheatAllDescription = "dev-cheat-all"; + + [TranslationReference] + static readonly string DevCrashDescription = "dev-crash"; + + [TranslationReference] + static readonly string LevelUpActorDescription = "levelup-actor"; + + [TranslationReference] + static readonly string PlayerExperienceDescription = "player-experience"; + + [TranslationReference] + static readonly string PowerOutageDescription = "power-outage"; + + [TranslationReference] + static readonly string KillSelectedActorsDescription = "kill-selected-actors"; + + [TranslationReference] + static readonly string DisposeSelectedActorsDescription = "dispose-selected-actors"; + readonly IDictionary Handler)> commandHandlers = new Dictionary)> { - { "visibility", ("toggles visibility checks and minimap.", Visibility) }, - { "give-cash", ("gives the default or specified amount of money.", GiveCash) }, - { "give-cash-all", ("gives the default or specified amount of money to all players and ai.", GiveCashAll) }, - { "instant-build", ("toggles instant building.", InstantBuild) }, - { "build-anywhere", ("toggles you the ability to build anywhere.", BuildAnywhere) }, - { "unlimited-power", ("toggles infinite power.", UnlimitedPower) }, - { "enable-tech", ("toggles the ability to build everything.", EnableTech) }, - { "fast-charge", ("toggles almost instant support power charging.", FastCharge) }, - { "all", ("toggles all cheats and gives you some cash for your trouble.", All) }, - { "crash", ("crashes the game.", Crash) }, - { "levelup", ("adds a specified number of levels to the selected actors.", LevelUp) }, - { "player-experience", ("adds a specified amount of player experience to the owner(s) of selected actors.", PlayerExperience) }, - { "power-outage", ("causes owner(s) of selected actors to have a 5 second power outage.", PowerOutage) }, - { "kill", ("kills selected actors.", Kill) }, - { "dispose", ("disposes selected actors.", Dispose) } + { "visibility", (ToggleVisiblityDescription, Visibility) }, + { "give-cash", (GiveCashDescription, GiveCash) }, + { "give-cash-all", (GiveCashAllDescription, GiveCashAll) }, + { "instant-build", (InstantBuildingDescription, InstantBuild) }, + { "build-anywhere", (BuildAnywhereDescription, BuildAnywhere) }, + { "unlimited-power", (UnlimitedPowerDescription, UnlimitedPower) }, + { "enable-tech", (EnableTechDescription, EnableTech) }, + { "fast-charge", (FastChargeDescription, FastCharge) }, + { "all", (DevCheatAllDescription, All) }, + { "crash", (DevCrashDescription, Crash) }, + { "levelup", (LevelUpActorDescription, LevelUp) }, + { "player-experience", (PlayerExperienceDescription, PlayerExperience) }, + { "power-outage", (PowerOutageDescription, PowerOutage) }, + { "kill", (KillSelectedActorsDescription, Kill) }, + { "dispose", (DisposeSelectedActorsDescription, Dispose) } }; World world; diff --git a/OpenRA.Mods.Common/Commands/HelpCommand.cs b/OpenRA.Mods.Common/Commands/HelpCommand.cs index 7a5d2c2fb3..03319be9dd 100644 --- a/OpenRA.Mods.Common/Commands/HelpCommand.cs +++ b/OpenRA.Mods.Common/Commands/HelpCommand.cs @@ -29,6 +29,9 @@ namespace OpenRA.Mods.Common.Commands [TranslationReference] static readonly string NoDescription = "no-description"; + [TranslationReference] + static readonly string HelpDescription = "help-description"; + World world; ChatCommands console; @@ -43,7 +46,7 @@ namespace OpenRA.Mods.Common.Commands console = world.WorldActor.Trait(); console.RegisterCommand("help", this); - RegisterHelp("help", "provides useful info about various commands"); + RegisterHelp("help", HelpDescription); } public void InvokeCommand(string name, string arg) @@ -61,7 +64,7 @@ namespace OpenRA.Mods.Common.Commands public void RegisterHelp(string name, string description) { - helpDescriptions[name] = description; + helpDescriptions[name] = Game.ModData.Translation.GetString(description); } } } diff --git a/OpenRA.Mods.Common/Commands/PlayerCommands.cs b/OpenRA.Mods.Common/Commands/PlayerCommands.cs index c568a3c1dc..038c9f94ee 100644 --- a/OpenRA.Mods.Common/Commands/PlayerCommands.cs +++ b/OpenRA.Mods.Common/Commands/PlayerCommands.cs @@ -22,6 +22,12 @@ namespace OpenRA.Mods.Common.Commands { World world; + [TranslationReference] + static readonly string PauseDescription = "pause-description"; + + [TranslationReference] + static readonly string SurrenderDescription = "surrender-description"; + public void WorldLoaded(World w, WorldRenderer wr) { world = w; @@ -29,9 +35,10 @@ namespace OpenRA.Mods.Common.Commands var help = world.WorldActor.Trait(); console.RegisterCommand("pause", this); - help.RegisterHelp("pause", "pause or unpause the game"); + help.RegisterHelp("pause", PauseDescription); + console.RegisterCommand("surrender", this); - help.RegisterHelp("surrender", "self-destruct everything and lose the game"); + help.RegisterHelp("surrender", SurrenderDescription); } public void InvokeCommand(string name, string arg) diff --git a/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs b/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs index b0c3246883..1bed161299 100644 --- a/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs @@ -29,7 +29,9 @@ namespace OpenRA.Mods.Common.Traits class CustomTerrainDebugOverlay : IWorldLoaded, IChatCommand, IRenderAnnotations { const string CommandName = "custom-terrain"; - const string CommandDesc = "toggles the custom terrain debug overlay."; + + [TranslationReference] + const string CommandDescription = "custom-terrain-debug-overlay-description"; public bool Enabled; @@ -49,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits return; console.RegisterCommand(CommandName, this); - help.RegisterHelp(CommandName, CommandDesc); + help.RegisterHelp(CommandName, CommandDescription); } void IChatCommand.InvokeCommand(string name, string arg) diff --git a/OpenRA.Mods.Common/Traits/World/CellTriggerOverlay.cs b/OpenRA.Mods.Common/Traits/World/CellTriggerOverlay.cs index c25f6e5950..eb9068b68b 100644 --- a/OpenRA.Mods.Common/Traits/World/CellTriggerOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/CellTriggerOverlay.cs @@ -32,7 +32,9 @@ namespace OpenRA.Mods.Common.Traits public class CellTriggerOverlay : IRenderAnnotations, IWorldLoaded, IChatCommand { const string CommandName = "triggers"; - const string CommandDesc = "toggles the script triggers overlay."; + + [TranslationReference] + const string CommandDescription = "cell-trigger-overlay-description"; bool enabled; @@ -54,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits return; console.RegisterCommand(CommandName, this); - help.RegisterHelp(CommandName, CommandDesc); + help.RegisterHelp(CommandName, CommandDescription); } void IChatCommand.InvokeCommand(string name, string arg) diff --git a/OpenRA.Mods.Common/Traits/World/ExitsDebugOverlayManager.cs b/OpenRA.Mods.Common/Traits/World/ExitsDebugOverlayManager.cs index 419ea63115..d971368ff7 100644 --- a/OpenRA.Mods.Common/Traits/World/ExitsDebugOverlayManager.cs +++ b/OpenRA.Mods.Common/Traits/World/ExitsDebugOverlayManager.cs @@ -27,7 +27,9 @@ namespace OpenRA.Mods.Common.Traits public class ExitsDebugOverlayManager : IWorldLoaded, IChatCommand { const string CommandName = "exits-overlay"; - const string CommandHelp = "Displays exits for factories."; + + [TranslationReference] + const string CommandDescription = "exits-debug-overlay-description"; public readonly SpriteFont Font; public readonly ExitsDebugOverlayManagerInfo Info; @@ -54,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits return; console.RegisterCommand(CommandName, this); - help.RegisterHelp(CommandName, CommandHelp); + help.RegisterHelp(CommandName, CommandDescription); } void IChatCommand.InvokeCommand(string command, string arg) diff --git a/OpenRA.Mods.Common/Traits/World/HierarchicalPathFinderOverlay.cs b/OpenRA.Mods.Common/Traits/World/HierarchicalPathFinderOverlay.cs index 3d16ffdb15..ab063157e1 100644 --- a/OpenRA.Mods.Common/Traits/World/HierarchicalPathFinderOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/HierarchicalPathFinderOverlay.cs @@ -35,7 +35,9 @@ namespace OpenRA.Mods.Common.Traits public class HierarchicalPathFinderOverlay : IRenderAnnotations, IWorldLoaded, IChatCommand { const string CommandName = "hpf"; - const string CommandDesc = "toggles the hierarchical pathfinder overlay."; + + [TranslationReference] + const string CommandDescription = "hpf-overlay-description"; readonly HierarchicalPathFinderOverlayInfo info; readonly SpriteFont font; @@ -68,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits return; console.RegisterCommand(CommandName, this); - help.RegisterHelp(CommandName, CommandDesc); + help.RegisterHelp(CommandName, CommandDescription); } void IChatCommand.InvokeCommand(string name, string arg) diff --git a/OpenRA.Mods.Common/Traits/World/PathFinderOverlay.cs b/OpenRA.Mods.Common/Traits/World/PathFinderOverlay.cs index 76aafa73f8..4efe8f3e93 100644 --- a/OpenRA.Mods.Common/Traits/World/PathFinderOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/PathFinderOverlay.cs @@ -40,7 +40,9 @@ namespace OpenRA.Mods.Common.Traits public class PathFinderOverlay : IRenderAnnotations, IWorldLoaded, IChatCommand { const string CommandName = "path-debug"; - const string CommandDesc = "toggles a visualization of path searching."; + + [TranslationReference] + const string CommandDescription = "path-debug-description"; sealed class Record : PathSearch.IRecorder, IEnumerable<(CPos Source, CPos Destination, int CostSoFar, int EstimatedRemainingCost)> { @@ -90,7 +92,7 @@ namespace OpenRA.Mods.Common.Traits return; console.RegisterCommand(CommandName, this); - help.RegisterHelp(CommandName, CommandDesc); + help.RegisterHelp(CommandName, CommandDescription); } void IChatCommand.InvokeCommand(string name, string arg) diff --git a/OpenRA.Mods.Common/Traits/World/TerrainGeometryOverlay.cs b/OpenRA.Mods.Common/Traits/World/TerrainGeometryOverlay.cs index 11c300648d..f7a0d8740a 100644 --- a/OpenRA.Mods.Common/Traits/World/TerrainGeometryOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/TerrainGeometryOverlay.cs @@ -25,7 +25,9 @@ namespace OpenRA.Mods.Common.Traits public class TerrainGeometryOverlay : IRenderAnnotations, IWorldLoaded, IChatCommand { const string CommandName = "terrain-geometry"; - const string CommandDesc = "toggles the terrain geometry overlay."; + + [TranslationReference] + const string CommandDescription = "terrain-geometry-overlay"; public bool Enabled; @@ -38,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits return; console.RegisterCommand(CommandName, this); - help.RegisterHelp(CommandName, CommandDesc); + help.RegisterHelp(CommandName, CommandDescription); } void IChatCommand.InvokeCommand(string name, string arg) diff --git a/mods/common/languages/en.ftl b/mods/common/languages/en.ftl index d421185b43..56c6d46c2d 100644 --- a/mods/common/languages/en.ftl +++ b/mods/common/languages/en.ftl @@ -597,13 +597,58 @@ saved-screenshot = Saved screenshot { $filename } ## ChatCommands invalid-command = { $name } is not a valid command. +## DebugVisualizationCommands +combat-geometry-description = toggles combat geometry overlay. +render-geometry-description = toggles render geometry overlay. +screen-map-overlay-description = toggles screen map overlay. +depth-buffer-description = toggles depth buffer overlay. +actor-tags-overlay-description = toggles actor tags overlay. + ## DevCommands cheats-disabled = Cheats are disabled. invalid-cash-amount = Invalid amount of cash. +toggle-visibility = toggles visibility checks and minimap. +give-cash = gives the default or specified amount of money. +give-cash-all = gives the default or specified amount of money to all players and ai. +instant-building = toggles instant building. +build-anywhere = toggles the ability to build anywhere. +unlimited-power = toggles infinite power. +enable-tech = toggles the ability to build everything. +fast-charge = toggles almost instant support power charging. +dev-cheat-all = toggles all cheats and gives you some cash for your trouble. +dev-crash = crashes the game. +levelup-actor = adds a specified number of levels to the selected actors. +player-experience = adds a specified amount of player experience to the owner(s) of selected actors. +power-outage = causes owner(s) of selected actors to have a 5 second power outage. +kill-selected-actors = kills selected actors. +dispose-selected-actors = disposes selected actors. ## HelpCommands available-commands = Here are the available commands: no-description = no description available. +help-description = provides useful info about various commands + +## PlayerCommands +pause-description = pause or unpause the game +surrender-description = self-destruct everything and lose the game ## DeveloperMode cheat-used = Cheat used: { $cheat } by { $player }{ $suffix } + +## CustomTerrainDebugOverlay +custom-terrain-debug-overlay-description = toggles the custom terrain debug overlay. + +## CellTriggerOverlay +cell-trigger-overlay-description = toggles the script triggers overlay. + +## ExitsDebugOverlay +exits-debug-overlay-description = Displays exits for factories. + +## HierarchicalPathFinderOverlay +hpf-overlay-description = toggles the hierarchical pathfinder overlay. + +## PathFinderOverlay +path-debug-description = toggles a visualization of path searching. + +## TerrainGeometryOverlay +terrain-geometry-overlay = toggles the terrain geometry overlay.