Client commands: clean up and localize (#22897)

* action commands

* atmos debug commands

* comming

* credits command

* debug commands

* usage

* usings

* debug pathfinding command

* grouping entity menu command

* hide mechanisms command

* commit

* mapping client side setup command

* open ahelp command

* set menu visibility command

* commit

* show mechanisms command

* toggle health overlay command

* toggle outline command

* stage

* disable once

* ioc

* namespaces

* WriteError

* clean up command usage

* don't abbriviate

* ActionsCommands

* AtmosDebugCommands

* the rest

* oops

* undo
This commit is contained in:
PrPleGoo
2024-01-03 23:29:37 +01:00
committed by GitHub
parent e790e59e19
commit 0e306e7862
28 changed files with 495 additions and 447 deletions

View File

@@ -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} <user resource path>";
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} <user resource path>";
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<ActionsSystem>().LoadActionAssignments(args[0], true);
_entitySystemManager.GetEntitySystem<ActionsSystem>().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<MappingSystem>().LoadMappingActions();
_entitySystemManager.GetEntitySystem<MappingSystem>().LoadMappingActions();
}
catch
{
shell.WriteLine("Failed to load action assignments");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
}
}
}

View File

@@ -1,19 +1,20 @@
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
{
public string Command => "atvrange";
public string Description => "Sets the atmos debug range (as two floats, start [red] and end [blue])";
public string Help => "atvrange <start> <end>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
[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)
{
if (args.Length != 2)
{
@@ -22,32 +23,35 @@ namespace Content.Client.Commands
}
if (!float.TryParse(args[0], out var xStart))
{
shell.WriteLine("Bad float START");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-start"));
return;
}
if (!float.TryParse(args[1], out var xEnd))
{
shell.WriteLine("Bad float END");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-end"));
return;
}
if (xStart == xEnd)
{
shell.WriteLine("Scale cannot be zero, as this would cause a division by zero in AtmosDebugOverlay.");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-zero"));
return;
}
var sys = EntitySystem.Get<AtmosDebugOverlaySystem>();
var sys = _entitySystemManager.GetEntitySystem<AtmosDebugOverlaySystem>();
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 <TotalMoles/GasMoles/Temperature> [<gas ID (for GasMoles)>]";
public void Execute(IConsoleShell shell, string argStr, string[] args)
[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)
{
@@ -56,7 +60,7 @@ namespace Content.Client.Commands
}
if (!Enum.TryParse<AtmosDebugOverlayMode>(args[0], out var xMode))
{
shell.WriteLine("Invalid mode");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-invalid"));
return;
}
int xSpecificGas = 0;
@@ -66,12 +70,12 @@ namespace Content.Client.Commands
{
if (args.Length != 2)
{
shell.WriteLine("A target gas must be provided for this mode.");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-target-gas"));
return;
}
if (!AtmosCommandUtils.TryParseGasID(args[1], out xSpecificGas))
{
shell.WriteLine("Gas ID not parsable or out of range.");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error-out-of-range"));
return;
}
}
@@ -79,7 +83,7 @@ namespace Content.Client.Commands
{
if (args.Length != 1)
{
shell.WriteLine("No further information is required for this mode.");
shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-error-info"));
return;
}
if (xMode == AtmosDebugOverlayMode.Temperature)
@@ -89,21 +93,24 @@ namespace Content.Client.Commands
xScale = -160;
}
}
var sys = EntitySystem.Get<AtmosDebugOverlaySystem>();
var sys = _entitySystemManager.GetEntitySystem<AtmosDebugOverlaySystem>();
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 <true/false>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
[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)
{
@@ -112,11 +119,10 @@ namespace Content.Client.Commands
}
if (!bool.TryParse(args[0], out var xFlag))
{
shell.WriteLine("Invalid flag");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
return;
}
var sys = EntitySystem.Get<AtmosDebugOverlaySystem>();
var sys = _entitySystemManager.GetEntitySystem<AtmosDebugOverlaySystem>();
sys.CfgCBM = xFlag;
}
}
}

View File

@@ -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)
[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();
}
}
}

View File

@@ -6,44 +6,48 @@ 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)
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)
{
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<MarkerSystem>().MarkersVisible ^= true;
_entitySystemManager.GetEntitySystem<MarkerSystem>().MarkersVisible ^= true;
}
}
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)
{
_entitySystemManager.GetEntitySystem<SubFloorHideSystem>().ShowAll ^= true;
}
}
internal sealed class ShowSubFloor : IConsoleCommand
{
// ReSharper disable once StringLiteralTypo
public string Command => "showsubfloor";
public string Description => "Makes entities below the floor always visible.";
public string Help => $"Usage: {Command}";
internal sealed class ShowSubFloorForever : LocalizedCommands
{
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SubFloorHideSystem>().ShowAll ^= true;
}
}
public const string CommandName = "showsubfloorforever";
public override string Command => CommandName;
internal sealed class ShowSubFloorForever : IConsoleCommand
{
// 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}";
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)
{
EntitySystem.Get<SubFloorHideSystem>().ShowAll = true;
_entitySystemManager.GetEntitySystem<SubFloorHideSystem>().ShowAll = true;
var entMan = IoCManager.Resolve<IEntityManager>();
var components = entMan.EntityQuery<SubFloorHideComponent, SpriteComponent>(true);
@@ -53,19 +57,20 @@ namespace Content.Client.Commands
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 <message>";
internal sealed class NotifyCommand : LocalizedCommands
{
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public void Execute(IConsoleShell shell, string argStr, string[] args)
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];
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<PopupSystem>().PopupCursor(message);
}
_entitySystemManager.GetEntitySystem<PopupSystem>().PopupCursor(message);
}
}

View File

@@ -1,22 +1,23 @@
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
{
// ReSharper disable once StringLiteralTypo
public string Command => "pathfinder";
public string Description => "Toggles visibility of pathfinding debuggers.";
public string Help => "pathfinder [options]";
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public void Execute(IConsoleShell shell, string argStr, string[] args)
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)
{
var system = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<PathfindingSystem>();
var system = _entitySystemManager.GetEntitySystem<PathfindingSystem>();
if (args.Length == 0)
{
@@ -28,12 +29,12 @@ namespace Content.Client.Commands
{
if (!Enum.TryParse<PathfindingDebugMode>(arg, out var mode))
{
shell.WriteError($"Unrecognised pathfinder args {arg}");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", arg)));
continue;
}
system.Modes ^= mode;
shell.WriteLine($"Toggled {arg} to {(system.Modes & mode) != 0x0}");
shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-notify", ("arg", arg), ("newMode", (system.Modes & mode) != 0x0)));
}
}
@@ -57,5 +58,4 @@ namespace Content.Client.Commands
return CompletionResult.FromOptions(options);
}
}
}

View File

@@ -2,18 +2,18 @@ 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
{
public string Command => "entitymenug";
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
public string Description => "Sets the entity menu grouping type.";
public override string Command => "entitymenug";
public string Help => $"Usage: entitymenug <0:{EntityMenuUIController.GroupingTypesCount}>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command), ("groupingTypesCount", EntityMenuUIController.GroupingTypesCount));
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
@@ -23,21 +23,19 @@ namespace Content.Client.Commands
if (!int.TryParse(args[0], out var id))
{
shell.WriteLine($"{args[0]} is not a valid integer.");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", args[0])));
return;
}
if (id < 0 ||id > EntityMenuUIController.GroupingTypesCount - 1)
if (id < 0 || id > EntityMenuUIController.GroupingTypesCount - 1)
{
shell.WriteLine($"{args[0]} is not a valid integer.");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", args[0])));
return;
}
var configurationManager = IoCManager.Resolve<IConfigurationManager>();
var cvar = CCVars.EntityMenuGroupingType;
configurationManager.SetCVar(cvar, id);
shell.WriteLine($"Context Menu Grouping set to type: {configurationManager.GetCVar(cvar)}");
}
_configurationManager.SetCVar(cvar, id);
shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-notify", ("cvar", _configurationManager.GetCVar(cvar))));
}
}

View File

@@ -1,26 +1,28 @@
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
{
public sealed class HideMechanismsCommand : IConsoleCommand
{
public string Command => "hidemechanisms";
public string Description => $"Reverts the effects of {ShowMechanismsCommand.CommandName}";
public string Help => $"{Command}";
namespace Content.Client.Commands;
public void Execute(IConsoleShell shell, string argStr, string[] args)
public sealed class HideMechanismsCommand : LocalizedCommands
{
[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)
{
var entityManager = IoCManager.Resolve<IEntityManager>();
var containerSys = entityManager.System<SharedContainerSystem>();
var query = entityManager.AllEntityQueryEnumerator<OrganComponent>();
var containerSys = _entityManager.System<SharedContainerSystem>();
var query = _entityManager.AllEntityQueryEnumerator<OrganComponent>();
while (query.MoveNext(out var uid, out _))
{
if (!entityManager.TryGetComponent(uid, out SpriteComponent? sprite))
if (!_entityManager.TryGetComponent(uid, out SpriteComponent? sprite))
{
continue;
}
@@ -39,8 +41,5 @@ namespace Content.Client.Commands
tempParent = container.Owner;
}
}
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("hidecontainedcontext");
}
}
}

View File

@@ -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;
/// <summary>
/// Sent by mapping command to client.
/// This is because the debug commands for some of these options are on toggles.
/// </summary>
[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<ILightManager>();
if (!mgr.LockConsoleAccess)
if (!_lightManager.LockConsoleAccess)
{
EntitySystem.Get<MarkerSystem>().MarkersVisible = true;
mgr.Enabled = false;
shell.ExecuteCommand("showsubfloorforever");
shell.ExecuteCommand("loadmapacts");
_entitySystemManager.GetEntitySystem<MarkerSystem>().MarkersVisible = true;
_lightManager.Enabled = false;
shell.ExecuteCommand(ShowSubFloorForever.CommandName);
shell.ExecuteCommand(LoadMappingActionsCommand.CommandName);
}
}
}

View File

@@ -1,24 +1,21 @@
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} [<netuserid>]";
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)
{
@@ -27,19 +24,18 @@ namespace Content.Client.Commands
}
if (args.Length == 0)
{
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<AHelpUIController>().Open();
_userInterfaceManager.GetUIController<AHelpUIController>().Open();
}
else
{
if (Guid.TryParse(args[0], out var guid))
{
var targetUser = new NetUserId(guid);
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<AHelpUIController>().Open(targetUser);
_userInterfaceManager.GetUIController<AHelpUIController>().Open(targetUser);
}
else
{
shell.WriteLine("Bad GUID!");
}
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
}
}
}

View File

@@ -1,25 +1,24 @@
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
{
public const string CommandName = "menuvis";
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
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]";
public override string Command => "menuvis";
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)
{
if (!TryParseArguments(shell, args, out var visibility))
return;
EntitySystem.Get<VerbSystem>().Visibility = visibility;
_entitySystemManager.GetEntitySystem<VerbSystem>().Visibility = visibility;
}
private bool TryParseArguments(IConsoleShell shell, string[] args, out MenuVisibility visibility)
@@ -30,9 +29,11 @@ namespace Content.Client.Commands
{
switch (arg.ToLower())
{
// ReSharper disable once StringLiteralTypo
case "nofov":
visibility |= MenuVisibility.NoFov;
break;
// ReSharper disable once StringLiteralTypo
case "incontainer":
visibility |= MenuVisibility.InContainer;
break;
@@ -43,12 +44,11 @@ namespace Content.Client.Commands
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.");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", arg)));
return false;
}
}
return true;
}
}
}

View File

@@ -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";
// 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 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)
{
var entityManager = IoCManager.Resolve<IEntityManager>();
var query = entityManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
var query = _entManager.AllEntityQueryEnumerator<OrganComponent, SpriteComponent>();
while (query.MoveNext(out _, out var sprite))
{
sprite.ContainerOccluded = false;
}
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("showcontainedcontext");
}
}
}

View File

@@ -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
{
public string Command => "togglehealthoverlay";
public string Description => "Toggles a health bar above mobs.";
public string Help => $"Usage: {Command}";
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public void Execute(IConsoleShell shell, string argStr, string[] args)
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)
{
var system = EntitySystem.Get<HealthOverlaySystem>();
var system = _entitySystemManager.GetEntitySystem<HealthOverlaySystem>();
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")));
}
}

View File

@@ -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";
public string Description => "Toggles outline drawing on entities.";
public string Help => "";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var configurationManager = IoCManager.Resolve<IConfigurationManager>();
var cvar = CCVars.OutlineEnabled;
var old = configurationManager.GetCVar(cvar);
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))));
}
}

View File

@@ -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<ContentEyeComponent>(player, out var content))
if (_entityManager.TryGetComponent<ContentEyeComponent>(player, out var content))
{
_entManager.System<ContentEyeSystem>().RequestZoom(player.Value, zoom, true, content);
_entityManager.System<ContentEyeSystem>().RequestZoom(player.Value, zoom, true, content);
return;
}
_eyeMan.CurrentEye.Zoom = zoom;
_eyeManager.CurrentEye.Zoom = zoom;
}
}

View File

@@ -0,0 +1,7 @@
cmd-loadacts-desc = Loads action toolbar assignments from a user-file.
cmd-loadacts-help = Usage: {$command} <user resource path>
cmd-loadacts-error = Failed to load action assignments
cmd-loadmapacts-desc = Loads the mapping preset action toolbar assignments.
cmd-loadmapacts-help = Usage: {$command} <user resource path>
cmd-loadmapacts-error = Failed to load action assignments

View File

@@ -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} <start> <end>
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} <TotalMoles/GasMoles/Temperature> [<gas ID (for GasMoles)>]
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} <true/false>
cmd-atvcbm-error = Invalid flag

View File

@@ -0,0 +1,2 @@
cmd-credits-desc = Opens the credits window
cmd-credits-help = Usage: {$command}

View File

@@ -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} <message>

View File

@@ -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}

View File

@@ -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}

View File

@@ -0,0 +1,2 @@
cmd-hidemechanisms-desc = Reverts the effects of {$showMechanismsCommand}
cmd-hidemechanisms-help = Usage: {$command}

View File

@@ -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}

View File

@@ -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} [<netuserid>]
cmd-openahelp-error = Bad GUID!

View File

@@ -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.

View File

@@ -0,0 +1,2 @@
cmd-showmechanisms-desc = Makes mechanisms visible, even when they shouldn't be.
cmd-showmechanisms-help = Usage: {$command}

View File

@@ -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}.

View File

@@ -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}

View File

@@ -1,3 +1,3 @@
zoom-command-description = Sets the zoom of the main eye.
zoom-command-help = zoom ( <scale> | <X-scale> <Y-scale> )
zoom-command-error = scale has to be greater than 0
cmd-zoom-desc = Sets the zoom of the main eye.
cmd-zoom-help = zoom ( <scale> | <X-scale> <Y-scale> )
cmd-zoom-error = scale has to be greater than 0