diff --git a/Content.Client/Commands/ActionsCommands.cs b/Content.Client/Commands/ActionsCommands.cs index f8eb67d78a..3d8e906e09 100644 --- a/Content.Client/Commands/ActionsCommands.cs +++ b/Content.Client/Commands/ActionsCommands.cs @@ -1,4 +1,4 @@ -using Content.Client.Actions; +using Content.Client.Actions; using Content.Client.Mapping; using Content.Shared.Administration; using Robust.Shared.Console; @@ -12,11 +12,8 @@ namespace Content.Client.Commands; public sealed class SaveActionsCommand : IConsoleCommand { public string Command => "saveacts"; - public string Description => "Saves the current action toolbar assignments to a file"; - public string Help => $"Usage: {Command} "; - public void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) @@ -38,15 +35,15 @@ public sealed class SaveActionsCommand : IConsoleCommand */ [AnyCommand] -public sealed class LoadActionsCommand : IConsoleCommand +public sealed class LoadActionsCommand : LocalizedCommands { - public string Command => "loadacts"; + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; - public string Description => "Loads action toolbar assignments from a user-file."; + public override string Command => "loadacts"; - public string Help => $"Usage: {Command} "; + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -56,33 +53,35 @@ public sealed class LoadActionsCommand : IConsoleCommand try { - EntitySystem.Get().LoadActionAssignments(args[0], true); + _entitySystemManager.GetEntitySystem().LoadActionAssignments(args[0], true); } catch { - shell.WriteLine("Failed to load action assignments"); + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error")); } } } [AnyCommand] -public sealed class LoadMappingActionsCommand : IConsoleCommand +public sealed class LoadMappingActionsCommand : LocalizedCommands { - public string Command => "loadmapacts"; + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; - public string Description => "Loads the mapping preset action toolbar assignments."; + public const string CommandName = "loadmapacts"; - public string Help => $"Usage: {Command}"; + public override string Command => CommandName; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { try { - EntitySystem.Get().LoadMappingActions(); + _entitySystemManager.GetEntitySystem().LoadMappingActions(); } catch { - shell.WriteLine("Failed to load action assignments"); + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error")); } } } diff --git a/Content.Client/Commands/AtmosDebugCommands.cs b/Content.Client/Commands/AtmosDebugCommands.cs index ba95e74287..b6f1aab09b 100644 --- a/Content.Client/Commands/AtmosDebugCommands.cs +++ b/Content.Client/Commands/AtmosDebugCommands.cs @@ -1,122 +1,128 @@ -using JetBrains.Annotations; -using Content.Shared.Atmos; -using System; using Content.Client.Atmos.EntitySystems; +using Content.Shared.Atmos; +using JetBrains.Annotations; using Robust.Shared.Console; -using Robust.Shared.GameObjects; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +[UsedImplicitly] +internal sealed class AtvRangeCommand : LocalizedCommands { - [UsedImplicitly] - internal sealed class AtvRangeCommand : IConsoleCommand + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public override string Command => "atvrange"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - public string Command => "atvrange"; - public string Description => "Sets the atmos debug range (as two floats, start [red] and end [blue])"; - public string Help => "atvrange "; - public void Execute(IConsoleShell shell, string argStr, string[] args) + if (args.Length != 2) + { + shell.WriteLine(Help); + return; + } + if (!float.TryParse(args[0], out var xStart)) + { + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-start")); + return; + } + if (!float.TryParse(args[1], out var xEnd)) + { + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-end")); + return; + } + if (xStart == xEnd) + { + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-zero")); + return; + } + var sys = _entitySystemManager.GetEntitySystem(); + sys.CfgBase = xStart; + sys.CfgScale = xEnd - xStart; + } +} + +[UsedImplicitly] +internal sealed class AtvModeCommand : LocalizedCommands +{ + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public override string Command => "atvmode"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length < 1) + { + shell.WriteLine(Help); + return; + } + if (!Enum.TryParse(args[0], out var xMode)) + { + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-invalid")); + return; + } + int xSpecificGas = 0; + float xBase = 0; + float xScale = Atmospherics.MolesCellStandard * 2; + if (xMode == AtmosDebugOverlayMode.GasMoles) { if (args.Length != 2) { - shell.WriteLine(Help); + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-target-gas")); return; } - if (!float.TryParse(args[0], out var xStart)) + if (!AtmosCommandUtils.TryParseGasID(args[1], out xSpecificGas)) { - shell.WriteLine("Bad float START"); + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-out-of-range")); return; } - if (!float.TryParse(args[1], out var xEnd)) - { - shell.WriteLine("Bad float END"); - return; - } - if (xStart == xEnd) - { - shell.WriteLine("Scale cannot be zero, as this would cause a division by zero in AtmosDebugOverlay."); - return; - } - var sys = EntitySystem.Get(); - sys.CfgBase = xStart; - sys.CfgScale = xEnd - xStart; } - } - - [UsedImplicitly] - internal sealed class AtvModeCommand : IConsoleCommand - { - public string Command => "atvmode"; - public string Description => "Sets the atmos debug mode. This will automatically reset the scale."; - public string Help => "atvmode []"; - public void Execute(IConsoleShell shell, string argStr, string[] args) - { - if (args.Length < 1) - { - shell.WriteLine(Help); - return; - } - if (!Enum.TryParse(args[0], out var xMode)) - { - shell.WriteLine("Invalid mode"); - return; - } - int xSpecificGas = 0; - float xBase = 0; - float xScale = Atmospherics.MolesCellStandard * 2; - if (xMode == AtmosDebugOverlayMode.GasMoles) - { - if (args.Length != 2) - { - shell.WriteLine("A target gas must be provided for this mode."); - return; - } - if (!AtmosCommandUtils.TryParseGasID(args[1], out xSpecificGas)) - { - shell.WriteLine("Gas ID not parsable or out of range."); - return; - } - } - else - { - if (args.Length != 1) - { - shell.WriteLine("No further information is required for this mode."); - return; - } - if (xMode == AtmosDebugOverlayMode.Temperature) - { - // Red is 100C, Green is 20C, Blue is -60C - xBase = Atmospherics.T20C + 80; - xScale = -160; - } - } - var sys = EntitySystem.Get(); - sys.CfgMode = xMode; - sys.CfgSpecificGas = xSpecificGas; - sys.CfgBase = xBase; - sys.CfgScale = xScale; - } - } - - [UsedImplicitly] - internal sealed class AtvCBMCommand : IConsoleCommand - { - public string Command => "atvcbm"; - public string Description => "Changes from red/green/blue to greyscale"; - public string Help => "atvcbm "; - public void Execute(IConsoleShell shell, string argStr, string[] args) + else { if (args.Length != 1) { - shell.WriteLine(Help); + shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-error-info")); return; } - if (!bool.TryParse(args[0], out var xFlag)) + if (xMode == AtmosDebugOverlayMode.Temperature) { - shell.WriteLine("Invalid flag"); - return; + // Red is 100C, Green is 20C, Blue is -60C + xBase = Atmospherics.T20C + 80; + xScale = -160; } - var sys = EntitySystem.Get(); - sys.CfgCBM = xFlag; } + var sys = _entitySystemManager.GetEntitySystem(); + sys.CfgMode = xMode; + sys.CfgSpecificGas = xSpecificGas; + sys.CfgBase = xBase; + sys.CfgScale = xScale; + } +} + +[UsedImplicitly] +internal sealed class AtvCBMCommand : LocalizedCommands +{ + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public override string Command => "atvcbm"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length != 1) + { + shell.WriteLine(Help); + return; + } + if (!bool.TryParse(args[0], out var xFlag)) + { + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error")); + return; + } + var sys = _entitySystemManager.GetEntitySystem(); + sys.CfgCBM = xFlag; } } diff --git a/Content.Client/Commands/CreditsCommand.cs b/Content.Client/Commands/CreditsCommand.cs index f61c80c1d5..12f461cefe 100644 --- a/Content.Client/Commands/CreditsCommand.cs +++ b/Content.Client/Commands/CreditsCommand.cs @@ -1,21 +1,19 @@ using Content.Client.Credits; -using Content.Client.UserInterface; using Content.Shared.Administration; using JetBrains.Annotations; using Robust.Shared.Console; -namespace Content.Client.Commands -{ - [UsedImplicitly, AnyCommand] - public sealed class CreditsCommand : IConsoleCommand - { - public string Command => "credits"; - public string Description => "Opens the credits window"; - public string Help => "credits"; +namespace Content.Client.Commands; - public void Execute(IConsoleShell shell, string argStr, string[] args) - { - new CreditsWindow().Open(); - } +[UsedImplicitly, AnyCommand] +public sealed class CreditsCommand : LocalizedCommands +{ + public override string Command => "credits"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + new CreditsWindow().Open(); } } diff --git a/Content.Client/Commands/DebugCommands.cs b/Content.Client/Commands/DebugCommands.cs index a29a090ce0..20d763a0e9 100644 --- a/Content.Client/Commands/DebugCommands.cs +++ b/Content.Client/Commands/DebugCommands.cs @@ -6,66 +6,71 @@ using Robust.Client.GameObjects; using Robust.Shared.Console; using DrawDepth = Content.Shared.DrawDepth.DrawDepth; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +internal sealed class ShowMarkersCommand : LocalizedCommands { - internal sealed class ShowMarkersCommand : IConsoleCommand - { - // ReSharper disable once StringLiteralTypo - public string Command => "showmarkers"; - public string Description => "Toggles visibility of markers such as spawn points."; - public string Help => ""; + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; - public void Execute(IConsoleShell shell, string argStr, string[] args) - { - IoCManager.Resolve().GetEntitySystem().MarkersVisible ^= true; - } + public override string Command => "showmarkers"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + _entitySystemManager.GetEntitySystem().MarkersVisible ^= true; } +} - internal sealed class ShowSubFloor : IConsoleCommand +internal sealed class ShowSubFloor : LocalizedCommands +{ + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public override string Command => "showsubfloor"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - // ReSharper disable once StringLiteralTypo - public string Command => "showsubfloor"; - public string Description => "Makes entities below the floor always visible."; - public string Help => $"Usage: {Command}"; - - public void Execute(IConsoleShell shell, string argStr, string[] args) - { - IoCManager.Resolve().GetEntitySystem().ShowAll ^= true; - } + _entitySystemManager.GetEntitySystem().ShowAll ^= true; } +} - internal sealed class ShowSubFloorForever : IConsoleCommand +internal sealed class ShowSubFloorForever : LocalizedCommands +{ + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public const string CommandName = "showsubfloorforever"; + public override string Command => CommandName; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - // ReSharper disable once StringLiteralTypo - public string Command => "showsubfloorforever"; - public string Description => "Makes entities below the floor always visible until the client is restarted."; - public string Help => $"Usage: {Command}"; + _entitySystemManager.GetEntitySystem().ShowAll = true; - public void Execute(IConsoleShell shell, string argStr, string[] args) + var entMan = IoCManager.Resolve(); + var components = entMan.EntityQuery(true); + + foreach (var (_, sprite) in components) { - EntitySystem.Get().ShowAll = true; - - var entMan = IoCManager.Resolve(); - var components = entMan.EntityQuery(true); - - foreach (var (_, sprite) in components) - { - sprite.DrawDepth = (int) DrawDepth.Overlays; - } - } - } - - internal sealed class NotifyCommand : IConsoleCommand - { - public string Command => "notify"; - public string Description => "Send a notify client side."; - public string Help => "notify "; - - public void Execute(IConsoleShell shell, string argStr, string[] args) - { - var message = args[0]; - - IoCManager.Resolve().GetEntitySystem().PopupCursor(message); + sprite.DrawDepth = (int) DrawDepth.Overlays; } } } + +internal sealed class NotifyCommand : LocalizedCommands +{ + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public override string Command => "notify"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + var message = args[0]; + + _entitySystemManager.GetEntitySystem().PopupCursor(message); + } +} diff --git a/Content.Client/Commands/DebugPathfindingCommand.cs b/Content.Client/Commands/DebugPathfindingCommand.cs index 9071ea40a7..e02b6dcbbd 100644 --- a/Content.Client/Commands/DebugPathfindingCommand.cs +++ b/Content.Client/Commands/DebugPathfindingCommand.cs @@ -1,61 +1,61 @@ -using System.Linq; using Content.Client.NPC; using Content.Shared.NPC; using JetBrains.Annotations; using Robust.Shared.Console; +using System.Linq; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +[UsedImplicitly] +public sealed class DebugPathfindingCommand : LocalizedCommands { - [UsedImplicitly] - public sealed class DebugPathfindingCommand : IConsoleCommand + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public override string Command => "pathfinder"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - // ReSharper disable once StringLiteralTypo - public string Command => "pathfinder"; - public string Description => "Toggles visibility of pathfinding debuggers."; - public string Help => "pathfinder [options]"; + var system = _entitySystemManager.GetEntitySystem(); - public void Execute(IConsoleShell shell, string argStr, string[] args) + if (args.Length == 0) { - var system = IoCManager.Resolve().GetEntitySystem(); - - if (args.Length == 0) - { - system.Modes = PathfindingDebugMode.None; - return; - } - - foreach (var arg in args) - { - if (!Enum.TryParse(arg, out var mode)) - { - shell.WriteError($"Unrecognised pathfinder args {arg}"); - continue; - } - - system.Modes ^= mode; - shell.WriteLine($"Toggled {arg} to {(system.Modes & mode) != 0x0}"); - } + system.Modes = PathfindingDebugMode.None; + return; } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + foreach (var arg in args) { - if (args.Length > 1) + if (!Enum.TryParse(arg, out var mode)) { - return CompletionResult.Empty; + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", arg))); + continue; } - var values = Enum.GetValues().ToList(); - var options = new List(); - - foreach (var val in values) - { - if (val == PathfindingDebugMode.None) - continue; - - options.Add(new CompletionOption(val.ToString())); - } - - return CompletionResult.FromOptions(options); + system.Modes ^= mode; + shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-notify", ("arg", arg), ("newMode", (system.Modes & mode) != 0x0))); } } + + public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + { + if (args.Length > 1) + { + return CompletionResult.Empty; + } + + var values = Enum.GetValues().ToList(); + var options = new List(); + + foreach (var val in values) + { + if (val == PathfindingDebugMode.None) + continue; + + options.Add(new CompletionOption(val.ToString())); + } + + return CompletionResult.FromOptions(options); + } } diff --git a/Content.Client/Commands/GroupingEntityMenuCommand.cs b/Content.Client/Commands/GroupingEntityMenuCommand.cs index 92315735ec..3bd2ca41e6 100644 --- a/Content.Client/Commands/GroupingEntityMenuCommand.cs +++ b/Content.Client/Commands/GroupingEntityMenuCommand.cs @@ -2,42 +2,40 @@ using Content.Client.ContextMenu.UI; using Content.Shared.CCVar; using Robust.Shared.Configuration; using Robust.Shared.Console; -using Robust.Shared.IoC; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +public sealed class GroupingEntityMenuCommand : LocalizedCommands { - public sealed class GroupingEntityMenuCommand : IConsoleCommand + [Dependency] private readonly IConfigurationManager _configurationManager = default!; + + public override string Command => "entitymenug"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command), ("groupingTypesCount", EntityMenuUIController.GroupingTypesCount)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - public string Command => "entitymenug"; - - public string Description => "Sets the entity menu grouping type."; - - public string Help => $"Usage: entitymenug <0:{EntityMenuUIController.GroupingTypesCount}>"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + if (args.Length != 1) { - if (args.Length != 1) - { - shell.WriteLine(Help); - return; - } - - if (!int.TryParse(args[0], out var id)) - { - shell.WriteLine($"{args[0]} is not a valid integer."); - return; - } - - if (id < 0 ||id > EntityMenuUIController.GroupingTypesCount - 1) - { - shell.WriteLine($"{args[0]} is not a valid integer."); - return; - } - - var configurationManager = IoCManager.Resolve(); - var cvar = CCVars.EntityMenuGroupingType; - - configurationManager.SetCVar(cvar, id); - shell.WriteLine($"Context Menu Grouping set to type: {configurationManager.GetCVar(cvar)}"); + shell.WriteLine(Help); + return; } + + if (!int.TryParse(args[0], out var id)) + { + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", args[0]))); + return; + } + + if (id < 0 || id > EntityMenuUIController.GroupingTypesCount - 1) + { + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", args[0]))); + return; + } + + var cvar = CCVars.EntityMenuGroupingType; + + _configurationManager.SetCVar(cvar, id); + shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-notify", ("cvar", _configurationManager.GetCVar(cvar)))); } } diff --git a/Content.Client/Commands/HideMechanismsCommand.cs b/Content.Client/Commands/HideMechanismsCommand.cs index 28433d2337..5f9afc78b9 100644 --- a/Content.Client/Commands/HideMechanismsCommand.cs +++ b/Content.Client/Commands/HideMechanismsCommand.cs @@ -1,46 +1,45 @@ -using Content.Shared.Body.Organ; -using Robust.Client.Console; +using Content.Shared.Body.Organ; using Robust.Client.GameObjects; using Robust.Shared.Console; using Robust.Shared.Containers; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +public sealed class HideMechanismsCommand : LocalizedCommands { - public sealed class HideMechanismsCommand : IConsoleCommand + [Dependency] private readonly IEntityManager _entityManager = default!; + + public override string Command => "hidemechanisms"; + + public override string Description => LocalizationManager.GetString($"cmd-{Command}-desc", ("showMechanismsCommand", ShowMechanismsCommand.CommandName)); + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - public string Command => "hidemechanisms"; - public string Description => $"Reverts the effects of {ShowMechanismsCommand.CommandName}"; - public string Help => $"{Command}"; + var containerSys = _entityManager.System(); + var query = _entityManager.AllEntityQueryEnumerator(); - public void Execute(IConsoleShell shell, string argStr, string[] args) + while (query.MoveNext(out var uid, out _)) { - var entityManager = IoCManager.Resolve(); - var containerSys = entityManager.System(); - var query = entityManager.AllEntityQueryEnumerator(); - - while (query.MoveNext(out var uid, out _)) + if (!_entityManager.TryGetComponent(uid, out SpriteComponent? sprite)) { - if (!entityManager.TryGetComponent(uid, out SpriteComponent? sprite)) - { - continue; - } - - sprite.ContainerOccluded = false; - - var tempParent = uid; - while (containerSys.TryGetContainingContainer(tempParent, out var container)) - { - if (!container.ShowContents) - { - sprite.ContainerOccluded = true; - break; - } - - tempParent = container.Owner; - } + continue; } - IoCManager.Resolve().ExecuteCommand("hidecontainedcontext"); + sprite.ContainerOccluded = false; + + var tempParent = uid; + while (containerSys.TryGetContainingContainer(tempParent, out var container)) + { + if (!container.ShowContents) + { + sprite.ContainerOccluded = true; + break; + } + + tempParent = container.Owner; + } } } } diff --git a/Content.Client/Commands/MappingClientSideSetupCommand.cs b/Content.Client/Commands/MappingClientSideSetupCommand.cs index a90afc5b9c..39268c6284 100644 --- a/Content.Client/Commands/MappingClientSideSetupCommand.cs +++ b/Content.Client/Commands/MappingClientSideSetupCommand.cs @@ -1,33 +1,28 @@ -using JetBrains.Annotations; -using System; using Content.Client.Markers; +using JetBrains.Annotations; using Robust.Client.Graphics; using Robust.Shared.Console; -using Robust.Shared.GameObjects; namespace Content.Client.Commands; -/// -/// Sent by mapping command to client. -/// This is because the debug commands for some of these options are on toggles. -/// [UsedImplicitly] -internal sealed class MappingClientSideSetupCommand : IConsoleCommand +internal sealed class MappingClientSideSetupCommand : LocalizedCommands { - // ReSharper disable once StringLiteralTypo - public string Command => "mappingclientsidesetup"; - public string Description => "Sets up the lighting control and such settings client-side. Sent by 'mapping' to client."; - public string Help => ""; + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + [Dependency] private readonly ILightManager _lightManager = default!; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "mappingclientsidesetup"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - var mgr = IoCManager.Resolve(); - if (!mgr.LockConsoleAccess) + if (!_lightManager.LockConsoleAccess) { - EntitySystem.Get().MarkersVisible = true; - mgr.Enabled = false; - shell.ExecuteCommand("showsubfloorforever"); - shell.ExecuteCommand("loadmapacts"); + _entitySystemManager.GetEntitySystem().MarkersVisible = true; + _lightManager.Enabled = false; + shell.ExecuteCommand(ShowSubFloorForever.CommandName); + shell.ExecuteCommand(LoadMappingActionsCommand.CommandName); } } } diff --git a/Content.Client/Commands/OpenAHelpCommand.cs b/Content.Client/Commands/OpenAHelpCommand.cs index 3d098f28a7..114ca51bc9 100644 --- a/Content.Client/Commands/OpenAHelpCommand.cs +++ b/Content.Client/Commands/OpenAHelpCommand.cs @@ -1,45 +1,41 @@ -using System; -using Content.Client.Administration; -using Content.Client.Administration.Systems; using Content.Client.UserInterface.Systems.Bwoink; -using Content.Client.UserInterface.Systems.EscapeMenu; using Content.Shared.Administration; using Robust.Client.UserInterface; using Robust.Shared.Console; -using Robust.Shared.GameObjects; using Robust.Shared.Network; -namespace Content.Client.Commands -{ - [AnyCommand] - public sealed class OpenAHelpCommand : IConsoleCommand - { - public string Command => "openahelp"; - public string Description => $"Opens AHelp channel for a given NetUserID, or your personal channel if none given."; - public string Help => $"{Command} []"; +namespace Content.Client.Commands; - public void Execute(IConsoleShell shell, string argStr, string[] args) +[AnyCommand] +public sealed class OpenAHelpCommand : LocalizedCommands +{ + [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; + + public override string Command => "openahelp"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length >= 2) { - if (args.Length >= 2) + shell.WriteLine(Help); + return; + } + if (args.Length == 0) + { + _userInterfaceManager.GetUIController().Open(); + } + else + { + if (Guid.TryParse(args[0], out var guid)) { - shell.WriteLine(Help); - return; - } - if (args.Length == 0) - { - IoCManager.Resolve().GetUIController().Open(); + var targetUser = new NetUserId(guid); + _userInterfaceManager.GetUIController().Open(targetUser); } else { - if (Guid.TryParse(args[0], out var guid)) - { - var targetUser = new NetUserId(guid); - IoCManager.Resolve().GetUIController().Open(targetUser); - } - else - { - shell.WriteLine("Bad GUID!"); - } + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error")); } } } diff --git a/Content.Client/Commands/SetMenuVisibilityCommand.cs b/Content.Client/Commands/SetMenuVisibilityCommand.cs index 91df58a374..ddfb0b1692 100644 --- a/Content.Client/Commands/SetMenuVisibilityCommand.cs +++ b/Content.Client/Commands/SetMenuVisibilityCommand.cs @@ -1,54 +1,54 @@ using Content.Client.Verbs; using JetBrains.Annotations; using Robust.Shared.Console; -using Robust.Shared.GameObjects; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +[UsedImplicitly] +internal sealed class SetMenuVisibilityCommand : LocalizedCommands { - [UsedImplicitly] - internal sealed class SetMenuVisibilityCommand : IConsoleCommand + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public override string Command => "menuvis"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - public const string CommandName = "menuvis"; + if (!TryParseArguments(shell, args, out var visibility)) + return; - public string Command => CommandName; - public string Description => "Set restrictions about what entities to show on the entity context menu."; - public string Help => $"Usage: {Command} [NoFoV] [InContainer] [Invisible] [All]"; + _entitySystemManager.GetEntitySystem().Visibility = visibility; + } - public void Execute(IConsoleShell shell, string argStr, string[] args) + private bool TryParseArguments(IConsoleShell shell, string[] args, out MenuVisibility visibility) + { + visibility = MenuVisibility.Default; + + foreach (var arg in args) { - if (!TryParseArguments(shell, args, out var visibility)) - return; - - EntitySystem.Get().Visibility = visibility; - } - - private bool TryParseArguments(IConsoleShell shell, string[] args, out MenuVisibility visibility) - { - visibility = MenuVisibility.Default; - - foreach (var arg in args) + switch (arg.ToLower()) { - switch (arg.ToLower()) - { - case "nofov": - visibility |= MenuVisibility.NoFov; - break; - case "incontainer": - visibility |= MenuVisibility.InContainer; - break; - case "invisible": - visibility |= MenuVisibility.Invisible; - break; - case "all": - visibility |= MenuVisibility.All; - break; - default: - shell.WriteLine($"Unknown visibility argument '{arg}'. Only 'NoFov', 'InContainer', 'Invisible' or 'All' are valid. Provide no arguments to set to default."); - return false; - } + // ReSharper disable once StringLiteralTypo + case "nofov": + visibility |= MenuVisibility.NoFov; + break; + // ReSharper disable once StringLiteralTypo + case "incontainer": + visibility |= MenuVisibility.InContainer; + break; + case "invisible": + visibility |= MenuVisibility.Invisible; + break; + case "all": + visibility |= MenuVisibility.All; + break; + default: + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", arg))); + return false; } - - return true; } + + return true; } } diff --git a/Content.Client/Commands/ShowMechanismsCommand.cs b/Content.Client/Commands/ShowMechanismsCommand.cs index b94278f8c9..4e3bb17cb6 100644 --- a/Content.Client/Commands/ShowMechanismsCommand.cs +++ b/Content.Client/Commands/ShowMechanismsCommand.cs @@ -1,30 +1,26 @@ -using Content.Shared.Body.Organ; -using Robust.Client.Console; +using Content.Shared.Body.Organ; using Robust.Client.GameObjects; using Robust.Shared.Console; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +public sealed class ShowMechanismsCommand : LocalizedCommands { - public sealed class ShowMechanismsCommand : IConsoleCommand + [Dependency] private readonly IEntityManager _entManager = default!; + + public const string CommandName = "showmechanisms"; + + public override string Command => CommandName; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - public const string CommandName = "showmechanisms"; + var query = _entManager.AllEntityQueryEnumerator(); - // ReSharper disable once StringLiteralTypo - public string Command => CommandName; - public string Description => "Makes mechanisms visible, even when they shouldn't be."; - public string Help => $"{Command}"; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + while (query.MoveNext(out _, out var sprite)) { - var entityManager = IoCManager.Resolve(); - var query = entityManager.AllEntityQueryEnumerator(); - - while (query.MoveNext(out _, out var sprite)) - { - sprite.ContainerOccluded = false; - } - - IoCManager.Resolve().ExecuteCommand("showcontainedcontext"); + sprite.ContainerOccluded = false; } } } diff --git a/Content.Client/Commands/ToggleHealthOverlayCommand.cs b/Content.Client/Commands/ToggleHealthOverlayCommand.cs index 76000f42a1..2a9490eb62 100644 --- a/Content.Client/Commands/ToggleHealthOverlayCommand.cs +++ b/Content.Client/Commands/ToggleHealthOverlayCommand.cs @@ -1,21 +1,21 @@ -using Content.Client.HealthOverlay; +using Content.Client.HealthOverlay; using Robust.Shared.Console; -using Robust.Shared.GameObjects; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +public sealed class ToggleHealthOverlayCommand : LocalizedCommands { - public sealed class ToggleHealthOverlayCommand : IConsoleCommand + [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; + + public override string Command => "togglehealthoverlay"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - public string Command => "togglehealthoverlay"; - public string Description => "Toggles a health bar above mobs."; - public string Help => $"Usage: {Command}"; + var system = _entitySystemManager.GetEntitySystem(); + system.Enabled = !system.Enabled; - public void Execute(IConsoleShell shell, string argStr, string[] args) - { - var system = EntitySystem.Get(); - system.Enabled = !system.Enabled; - - shell.WriteLine($"Health overlay system {(system.Enabled ? "enabled" : "disabled")}."); - } + shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-notify", ("state", system.Enabled ? "enabled" : "disabled"))); } } diff --git a/Content.Client/Commands/ToggleOutlineCommand.cs b/Content.Client/Commands/ToggleOutlineCommand.cs index 3f02435493..834c3cc995 100644 --- a/Content.Client/Commands/ToggleOutlineCommand.cs +++ b/Content.Client/Commands/ToggleOutlineCommand.cs @@ -2,27 +2,24 @@ using Content.Shared.Administration; using Content.Shared.CCVar; using Robust.Shared.Configuration; using Robust.Shared.Console; -using Robust.Shared.IoC; -namespace Content.Client.Commands +namespace Content.Client.Commands; + +[AnyCommand] +public sealed class ToggleOutlineCommand : LocalizedCommands { - [AnyCommand] - public sealed class ToggleOutlineCommand : IConsoleCommand + [Dependency] private readonly IConfigurationManager _configurationManager = default!; + + public override string Command => "toggleoutline"; + + public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command)); + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - public string Command => "toggleoutline"; + var cvar = CCVars.OutlineEnabled; + var old = _configurationManager.GetCVar(cvar); - public string Description => "Toggles outline drawing on entities."; - - public string Help => ""; - - public void Execute(IConsoleShell shell, string argStr, string[] args) - { - var configurationManager = IoCManager.Resolve(); - var cvar = CCVars.OutlineEnabled; - var old = configurationManager.GetCVar(cvar); - - configurationManager.SetCVar(cvar, !old); - shell.WriteLine($"Draw outlines set to: {configurationManager.GetCVar(cvar)}"); - } + _configurationManager.SetCVar(cvar, !old); + shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-notify", ("state", _configurationManager.GetCVar(cvar)))); } } diff --git a/Content.Client/Commands/ZoomCommand.cs b/Content.Client/Commands/ZoomCommand.cs index 2b8cdcbca9..2bdc85e1fe 100644 --- a/Content.Client/Commands/ZoomCommand.cs +++ b/Content.Client/Commands/ZoomCommand.cs @@ -1,26 +1,23 @@ -using System.Numerics; using Content.Client.Movement.Systems; using Content.Shared.Movement.Components; -using Content.Shared.Movement.Systems; using JetBrains.Annotations; using Robust.Client.Graphics; using Robust.Client.Player; using Robust.Shared.Console; +using System.Numerics; namespace Content.Client.Commands; [UsedImplicitly] -public sealed class ZoomCommand : IConsoleCommand +public sealed class ZoomCommand : LocalizedCommands { - [Dependency] private readonly IEntityManager _entManager = default!; - [Dependency] private readonly IEyeManager _eyeMan = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; - public string Command => "zoom"; - public string Description => Loc.GetString("zoom-command-description"); - public string Help => Loc.GetString("zoom-command-help"); + public override string Command => "zoom"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { Vector2 zoom; if (args.Length is not (1 or 2)) @@ -31,7 +28,7 @@ public sealed class ZoomCommand : IConsoleCommand if (!float.TryParse(args[0], out var arg0)) { - shell.WriteError(Loc.GetString("cmd-parse-failure-float", ("arg", args[0]))); + shell.WriteError(LocalizationManager.GetString("cmd-parse-failure-float", ("arg", args[0]))); return; } @@ -39,7 +36,7 @@ public sealed class ZoomCommand : IConsoleCommand zoom = new(arg0, arg0); else { - shell.WriteError(Loc.GetString("zoom-command-error")); + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error")); return; } @@ -47,7 +44,7 @@ public sealed class ZoomCommand : IConsoleCommand { if (!float.TryParse(args[1], out var arg1)) { - shell.WriteError(Loc.GetString("cmd-parse-failure-float", ("arg", args[1]))); + shell.WriteError(LocalizationManager.GetString("cmd-parse-failure-float", ("arg", args[1]))); return; } @@ -55,19 +52,19 @@ public sealed class ZoomCommand : IConsoleCommand zoom.Y = arg1; else { - shell.WriteError(Loc.GetString("zoom-command-error")); + shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error")); return; } } - var player = _playerManager.LocalPlayer?.ControlledEntity; + var player = _playerManager.LocalSession?.AttachedEntity; - if (_entManager.TryGetComponent(player, out var content)) + if (_entityManager.TryGetComponent(player, out var content)) { - _entManager.System().RequestZoom(player.Value, zoom, true, content); + _entityManager.System().RequestZoom(player.Value, zoom, true, content); return; } - _eyeMan.CurrentEye.Zoom = zoom; + _eyeManager.CurrentEye.Zoom = zoom; } } diff --git a/Resources/Locale/en-US/commands/actions-command.ftl b/Resources/Locale/en-US/commands/actions-command.ftl new file mode 100644 index 0000000000..b369da03d2 --- /dev/null +++ b/Resources/Locale/en-US/commands/actions-command.ftl @@ -0,0 +1,7 @@ +cmd-loadacts-desc = Loads action toolbar assignments from a user-file. +cmd-loadacts-help = Usage: {$command} +cmd-loadacts-error = Failed to load action assignments + +cmd-loadmapacts-desc = Loads the mapping preset action toolbar assignments. +cmd-loadmapacts-help = Usage: {$command} +cmd-loadmapacts-error = Failed to load action assignments \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/atmos-debug-command.ftl b/Resources/Locale/en-US/commands/atmos-debug-command.ftl new file mode 100644 index 0000000000..291a2cf113 --- /dev/null +++ b/Resources/Locale/en-US/commands/atmos-debug-command.ftl @@ -0,0 +1,16 @@ +cmd-atvrange-desc = Sets the atmos debug range (as two floats, start [red] and end [blue]) +cmd-atvrange-help = Usage: {$command} +cmd-atvrange-error-start = Bad float START +cmd-atvrange-error-end = Bad float END +cmd-atvrange-error-zero = Scale cannot be zero, as this would cause a division by zero in AtmosDebugOverlay. + +cmd-atvmode-desc = Sets the atmos debug mode. This will automatically reset the scale. +cmd-atvmode-help = Usage: {$command} [] +cmd-atvmode-error-invalid = Invalid mode +cmd-atvmode-error-target-gas = A target gas must be provided for this mode. +cmd-atvmode-error-out-of-range = Gas ID not parsable or out of range. +cmd-atvmode-error-info = No further information is required for this mode. + +cmd-atvcbm-desc = Changes from red/green/blue to greyscale +cmd-atvcbm-help = Usage: {$command} +cmd-atvcbm-error = Invalid flag diff --git a/Resources/Locale/en-US/commands/credits-command.ftl b/Resources/Locale/en-US/commands/credits-command.ftl new file mode 100644 index 0000000000..9e506fc2a9 --- /dev/null +++ b/Resources/Locale/en-US/commands/credits-command.ftl @@ -0,0 +1,2 @@ +cmd-credits-desc = Opens the credits window +cmd-credits-help = Usage: {$command} \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/debug-command.ftl b/Resources/Locale/en-US/commands/debug-command.ftl new file mode 100644 index 0000000000..a99cc2b449 --- /dev/null +++ b/Resources/Locale/en-US/commands/debug-command.ftl @@ -0,0 +1,11 @@ +cmd-showmarkers-desc = Toggles visibility of markers such as spawn points. +cmd-showmarkers-help = Usage: {$command} + +cmd-showsubfloor-desc = Makes entities below the floor always visible. +cmd-showsubfloor-help = Usage: {$command} + +cmd-showsubfloorforever-desc = Makes entities below the floor always visible until the client is restarted. +cmd-showsubfloorforever-help = Usage: {$command} + +cmd-notify-desc = Send a notify client side. +cmd-notify-help = Usage: {$command} diff --git a/Resources/Locale/en-US/commands/debug-pathfinding-command.ftl b/Resources/Locale/en-US/commands/debug-pathfinding-command.ftl new file mode 100644 index 0000000000..c1f0df9e8f --- /dev/null +++ b/Resources/Locale/en-US/commands/debug-pathfinding-command.ftl @@ -0,0 +1,4 @@ +cmd-pathfinder-desc = Toggles visibility of pathfinding debuggers. +cmd-pathfinder-help = Usage: {$command} [options] +cmd-pathfinder-error = Unrecognised pathfinder args {$arg} +cmd-pathfinder-notify = Toggled {$arg} to {$newMode} \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/grouping-entity-menu-command.ftl b/Resources/Locale/en-US/commands/grouping-entity-menu-command.ftl new file mode 100644 index 0000000000..eb519ae72d --- /dev/null +++ b/Resources/Locale/en-US/commands/grouping-entity-menu-command.ftl @@ -0,0 +1,4 @@ +cmd-entitymenug-desc = Sets the entity menu grouping type. +cmd-entitymenug-help = Usage: {$command} <0:{$groupingTypesCount}> +cmd-entitymenug-error = {$arg} is not a valid integer. +cmd-entitymenug-notify = Context Menu Grouping set to type: {$cvar} \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/hide-mechanisms-command.ftl b/Resources/Locale/en-US/commands/hide-mechanisms-command.ftl new file mode 100644 index 0000000000..75c9cbc815 --- /dev/null +++ b/Resources/Locale/en-US/commands/hide-mechanisms-command.ftl @@ -0,0 +1,2 @@ +cmd-hidemechanisms-desc = Reverts the effects of {$showMechanismsCommand} +cmd-hidemechanisms-help = Usage: {$command} \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/mapping-client-side-setup-command.ftl b/Resources/Locale/en-US/commands/mapping-client-side-setup-command.ftl new file mode 100644 index 0000000000..955d077db4 --- /dev/null +++ b/Resources/Locale/en-US/commands/mapping-client-side-setup-command.ftl @@ -0,0 +1,2 @@ +cmd-mappingclientsidesetup-desc = Sets up the lighting control and such settings client-side. Sent by 'mapping' to client. +cmd-mappingclientsidesetup-help = Usage: {$command} \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/open-a-help-command.ftl b/Resources/Locale/en-US/commands/open-a-help-command.ftl new file mode 100644 index 0000000000..a7e0e76c1d --- /dev/null +++ b/Resources/Locale/en-US/commands/open-a-help-command.ftl @@ -0,0 +1,3 @@ +cmd-openahelp-desc = Opens AHelp channel for a given NetUserID, or your personal channel if none given. +cmd-openahelp-help = Usage: {$command} [] +cmd-openahelp-error = Bad GUID! \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/set-menu-visibility-command.ftl b/Resources/Locale/en-US/commands/set-menu-visibility-command.ftl new file mode 100644 index 0000000000..e3bcd51216 --- /dev/null +++ b/Resources/Locale/en-US/commands/set-menu-visibility-command.ftl @@ -0,0 +1,3 @@ +cmd-menuvis-desc = Set restrictions about what entities to show on the entity context menu. +cmd-menuvis-help = Usage: {Command} [NoFoV] [InContainer] [Invisible] [All] +cmd-menuvis-error = Unknown visibility argument '{$arg}'. Only 'NoFov', 'InContainer', 'Invisible' or 'All' are valid. Provide no arguments to set to default. \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/show-mechanisms-command.ftl b/Resources/Locale/en-US/commands/show-mechanisms-command.ftl new file mode 100644 index 0000000000..0512381b63 --- /dev/null +++ b/Resources/Locale/en-US/commands/show-mechanisms-command.ftl @@ -0,0 +1,2 @@ +cmd-showmechanisms-desc = Makes mechanisms visible, even when they shouldn't be. +cmd-showmechanisms-help = Usage: {$command} \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/toggle-health-overlay-command.ftl b/Resources/Locale/en-US/commands/toggle-health-overlay-command.ftl new file mode 100644 index 0000000000..dd54e11d33 --- /dev/null +++ b/Resources/Locale/en-US/commands/toggle-health-overlay-command.ftl @@ -0,0 +1,3 @@ +cmd-togglehealthoverlay-desc = Toggles a health bar above mobs. +cmd-togglehealthoverlay-help = Usage: {$command} +cmd-togglehealthoverlay-notify = Health overlay system {$state}. \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/toggle-outline-command.ftl b/Resources/Locale/en-US/commands/toggle-outline-command.ftl new file mode 100644 index 0000000000..ac323f4dc8 --- /dev/null +++ b/Resources/Locale/en-US/commands/toggle-outline-command.ftl @@ -0,0 +1,3 @@ +cmd-toggleoutline-desc = Toggles outline drawing on entities. +cmd-toggleoutline-help = Usage: {$command} +cmd-toggleoutline-notify = Draw outlines set to: {$cvar} \ No newline at end of file diff --git a/Resources/Locale/en-US/commands/zoom-command.ftl b/Resources/Locale/en-US/commands/zoom-command.ftl index 981ebe9490..0132f22240 100644 --- a/Resources/Locale/en-US/commands/zoom-command.ftl +++ b/Resources/Locale/en-US/commands/zoom-command.ftl @@ -1,3 +1,3 @@ -zoom-command-description = Sets the zoom of the main eye. -zoom-command-help = zoom ( | ) -zoom-command-error = scale has to be greater than 0 +cmd-zoom-desc = Sets the zoom of the main eye. +cmd-zoom-help = zoom ( | ) +cmd-zoom-error = scale has to be greater than 0