Console Unify API Changes (#3059)
* Remove unused IChatCommand. * Lots of refactoring into a shared context. * Removed ICommonSession from server concmd Execute. * Added argStr parameter to concmd execute. * The execute function of client concmds now returns void, use the new shell.RemoteExecuteCommand function to forward commands. * Finally move shells and commands into shared. * Console commands can now be registered directly without a class in a shared context. * Engine API Changes. * Repair rebase damage. * Update Submodule.
This commit is contained in:
@@ -78,7 +78,7 @@ namespace Content.Client.Chat
|
||||
private ChatChannel _filteredChannels;
|
||||
|
||||
[Dependency] private readonly IClientNetManager _netManager = default!;
|
||||
[Dependency] private readonly IClientConsole _console = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||
@@ -255,7 +255,7 @@ namespace Content.Client.Chat
|
||||
{
|
||||
// run locally
|
||||
var conInput = text.Substring(1);
|
||||
_console.ProcessCommand(conInput);
|
||||
_consoleHost.ExecuteCommand(conInput);
|
||||
break;
|
||||
}
|
||||
case OOCAlias:
|
||||
@@ -263,7 +263,7 @@ namespace Content.Client.Chat
|
||||
var conInput = text.Substring(1);
|
||||
if (string.IsNullOrWhiteSpace(conInput))
|
||||
return;
|
||||
_console.ProcessCommand($"ooc \"{CommandParsing.Escape(conInput)}\"");
|
||||
_consoleHost.ExecuteCommand($"ooc \"{CommandParsing.Escape(conInput)}\"");
|
||||
break;
|
||||
}
|
||||
case AdminChatAlias:
|
||||
@@ -273,11 +273,11 @@ namespace Content.Client.Chat
|
||||
return;
|
||||
if (_groupController.CanCommand("asay"))
|
||||
{
|
||||
_console.ProcessCommand($"asay \"{CommandParsing.Escape(conInput)}\"");
|
||||
_consoleHost.ExecuteCommand($"asay \"{CommandParsing.Escape(conInput)}\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
_console.ProcessCommand($"ooc \"{CommandParsing.Escape(conInput)}\"");
|
||||
_consoleHost.ExecuteCommand($"ooc \"{CommandParsing.Escape(conInput)}\"");
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -287,7 +287,7 @@ namespace Content.Client.Chat
|
||||
var conInput = text.Substring(1);
|
||||
if (string.IsNullOrWhiteSpace(conInput))
|
||||
return;
|
||||
_console.ProcessCommand($"me \"{CommandParsing.Escape(conInput)}\"");
|
||||
_consoleHost.ExecuteCommand($"me \"{CommandParsing.Escape(conInput)}\"");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -295,7 +295,7 @@ namespace Content.Client.Chat
|
||||
var conInput = _currentChatBox?.DefaultChatFormat != null
|
||||
? string.Format(_currentChatBox.DefaultChatFormat, CommandParsing.Escape(text))
|
||||
: text;
|
||||
_console.ProcessCommand(conInput);
|
||||
_consoleHost.ExecuteCommand(conInput);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ using System.Collections.Generic;
|
||||
using Content.Client.Interfaces;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Shared;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Client.Interfaces.Graphics.ClientEye;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.Interfaces.UserInterface;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -168,12 +168,11 @@ namespace Content.Client
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var arg = args[0];
|
||||
var mgr = IoCManager.Resolve<IClientNotifyManager>();
|
||||
mgr.PopupMessage(arg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Content.Shared.Atmos;
|
||||
using System;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
{
|
||||
@@ -13,32 +13,31 @@ namespace Content.Client.Commands
|
||||
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 bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
console.AddLine(Help);
|
||||
return false;
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
if (!float.TryParse(args[0], out var xStart))
|
||||
{
|
||||
console.AddLine("Bad float START");
|
||||
return false;
|
||||
shell.WriteLine("Bad float START");
|
||||
return;
|
||||
}
|
||||
if (!float.TryParse(args[1], out var xEnd))
|
||||
{
|
||||
console.AddLine("Bad float END");
|
||||
return false;
|
||||
shell.WriteLine("Bad float END");
|
||||
return;
|
||||
}
|
||||
if (xStart == xEnd)
|
||||
{
|
||||
console.AddLine("Scale cannot be zero, as this would cause a division by zero in AtmosDebugOverlay.");
|
||||
return false;
|
||||
shell.WriteLine("Scale cannot be zero, as this would cause a division by zero in AtmosDebugOverlay.");
|
||||
return;
|
||||
}
|
||||
var sys = EntitySystem.Get<AtmosDebugOverlaySystem>();
|
||||
sys.CfgBase = xStart;
|
||||
sys.CfgScale = xEnd - xStart;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,17 +47,17 @@ namespace Content.Client.Commands
|
||||
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 bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
console.AddLine(Help);
|
||||
return false;
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
if (!Enum.TryParse<AtmosDebugOverlayMode>(args[0], out var xMode))
|
||||
{
|
||||
console.AddLine("Invalid mode");
|
||||
return false;
|
||||
shell.WriteLine("Invalid mode");
|
||||
return;
|
||||
}
|
||||
int xSpecificGas = 0;
|
||||
float xBase = 0;
|
||||
@@ -67,21 +66,21 @@ namespace Content.Client.Commands
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
console.AddLine("A target gas must be provided for this mode.");
|
||||
return false;
|
||||
shell.WriteLine("A target gas must be provided for this mode.");
|
||||
return;
|
||||
}
|
||||
if (!AtmosCommandUtils.TryParseGasID(args[1], out xSpecificGas))
|
||||
{
|
||||
console.AddLine("Gas ID not parsable or out of range.");
|
||||
return false;
|
||||
shell.WriteLine("Gas ID not parsable or out of range.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
console.AddLine("No further information is required for this mode.");
|
||||
return false;
|
||||
shell.WriteLine("No further information is required for this mode.");
|
||||
return;
|
||||
}
|
||||
if (xMode == AtmosDebugOverlayMode.Temperature)
|
||||
{
|
||||
@@ -95,7 +94,6 @@ namespace Content.Client.Commands
|
||||
sys.CfgSpecificGas = xSpecificGas;
|
||||
sys.CfgBase = xBase;
|
||||
sys.CfgScale = xScale;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,21 +103,20 @@ namespace Content.Client.Commands
|
||||
public string Command => "atvcbm";
|
||||
public string Description => "Changes from red/green/blue to greyscale";
|
||||
public string Help => "atvcbm <true/false>";
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
console.AddLine(Help);
|
||||
return false;
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
if (!bool.TryParse(args[0], out var xFlag))
|
||||
{
|
||||
console.AddLine("Invalid flag");
|
||||
return false;
|
||||
shell.WriteLine("Invalid flag");
|
||||
return;
|
||||
}
|
||||
var sys = EntitySystem.Get<AtmosDebugOverlaySystem>();
|
||||
sys.CfgCBM = xFlag;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Client.UserInterface;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
{
|
||||
@@ -11,10 +11,9 @@ namespace Content.Client.Commands
|
||||
public string Description => "Opens the credits window";
|
||||
public string Help => "credits";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
new CreditsWindow().Open();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Client.GameObjects.EntitySystems.AI;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
@@ -16,12 +16,13 @@ namespace Content.Client.Commands
|
||||
public string Description => "Handles all tooltip debugging above AI mobs";
|
||||
public string Help => "debugai [hide/paths/thonk]";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
#if DEBUG
|
||||
if (args.Length < 1)
|
||||
{
|
||||
return true;
|
||||
shell.RemoteExecuteCommand(argStr);
|
||||
return;
|
||||
}
|
||||
|
||||
var anyAction = false;
|
||||
@@ -50,9 +51,10 @@ namespace Content.Client.Commands
|
||||
}
|
||||
}
|
||||
|
||||
return !anyAction;
|
||||
if(!anyAction)
|
||||
shell.RemoteExecuteCommand(argStr);
|
||||
#else
|
||||
return true;
|
||||
shell.RemoteExecuteCommand(argStr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using Content.Client.GameObjects.Components;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Client.Interfaces;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -17,12 +18,10 @@ namespace Content.Client.Commands
|
||||
public string Description => "Toggles visibility of markers such as spawn points.";
|
||||
public string Help => "";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
EntitySystem.Get<MarkerSystem>()
|
||||
.MarkersVisible ^= true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +32,10 @@ namespace Content.Client.Commands
|
||||
public string Description => "Makes entities below the floor always visible.";
|
||||
public string Help => $"Usage: {Command}";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
EntitySystem.Get<SubFloorHideSystem>()
|
||||
.EnableAll ^= true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +46,7 @@ namespace Content.Client.Commands
|
||||
public string Description => "Makes entities below the floor always visible until the client is restarted.";
|
||||
public string Help => $"Usage: {Command}";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
EntitySystem.Get<SubFloorHideSystem>()
|
||||
.EnableAll = true;
|
||||
@@ -64,8 +61,6 @@ namespace Content.Client.Commands
|
||||
sprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,14 +70,12 @@ namespace Content.Client.Commands
|
||||
public string Description => "Send a notify client side.";
|
||||
public string Help => "notify <message>";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var message = args[0];
|
||||
|
||||
var notifyManager = IoCManager.Resolve<IClientNotifyManager>();
|
||||
notifyManager.PopupMessage(message);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,18 +85,18 @@ namespace Content.Client.Commands
|
||||
public string Description => "Creates and teleports you to a new uninitialized map for mapping.";
|
||||
public string Help => $"Usage: {Command} <mapname> / {Command} <id> <mapname>";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
console.AddLine(Help);
|
||||
return false;
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
console.Commands["togglelight"].Execute(console);
|
||||
console.Commands["showsubfloorforever"].Execute(console);
|
||||
shell.ConsoleHost.RegisteredCommands["togglelight"].Execute(shell, string.Empty, Array.Empty<string>());
|
||||
shell.ConsoleHost.RegisteredCommands["showsubfloorforever"].Execute(shell, string.Empty, Array.Empty<string>());
|
||||
|
||||
return true;
|
||||
shell.RemoteExecuteCommand(argStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Client.GameObjects.EntitySystems.AI;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
@@ -13,12 +13,13 @@ namespace Content.Client.Commands
|
||||
public string Description => "Toggles visibility of pathfinding debuggers.";
|
||||
public string Help => "pathfinder [hide/nodes/routes/graph/regioncache/regions]";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
#if DEBUG
|
||||
if (args.Length < 1)
|
||||
{
|
||||
return true;
|
||||
shell.RemoteExecuteCommand(argStr);
|
||||
return;
|
||||
}
|
||||
|
||||
var anyAction = false;
|
||||
@@ -63,9 +64,10 @@ namespace Content.Client.Commands
|
||||
}
|
||||
}
|
||||
|
||||
return !anyAction;
|
||||
if(!anyAction)
|
||||
shell.RemoteExecuteCommand(argStr);
|
||||
#else
|
||||
return true;
|
||||
shell.RemoteExecuteCommand(argStr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,7 +14,7 @@ namespace Content.Client.Commands
|
||||
public string Description => $"Reverts the effects of {ShowMechanismsCommand.CommandName}";
|
||||
public string Help => $"{Command}";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var componentManager = IoCManager.Resolve<IComponentManager>();
|
||||
var mechanisms = componentManager.EntityQuery<IMechanism>();
|
||||
@@ -41,9 +41,7 @@ namespace Content.Client.Commands
|
||||
}
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand("hidecontainedcontext");
|
||||
|
||||
return false;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("hidecontainedcontext");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client.Commands
|
||||
public string Description => "Makes mechanisms visible, even when they shouldn't be.";
|
||||
public string Help => $"{Command}";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var componentManager = IoCManager.Resolve<IComponentManager>();
|
||||
var mechanisms = componentManager.EntityQuery<IMechanism>();
|
||||
@@ -29,9 +29,7 @@ namespace Content.Client.Commands
|
||||
}
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand("showcontainedcontext");
|
||||
|
||||
return false;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("showcontainedcontext");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Shared;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -13,16 +13,14 @@ namespace Content.Client.Commands
|
||||
|
||||
public string Help => "";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var configurationManager = IoCManager.Resolve<IConfigurationManager>();
|
||||
var cvar = CCVars.OutlineEnabled;
|
||||
var old = configurationManager.GetCVar(cvar);
|
||||
|
||||
configurationManager.SetCVar(cvar, !old);
|
||||
console.AddLine($"Draw outlines set to: {configurationManager.GetCVar(cvar)}");
|
||||
|
||||
return false;
|
||||
shell.WriteLine($"Draw outlines set to: {configurationManager.GetCVar(cvar)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.State;
|
||||
using Content.Client.State;
|
||||
using Content.Client.UserInterface;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
@@ -12,7 +12,7 @@ namespace Content.Client
|
||||
{
|
||||
internal sealed class EscapeMenuOwner : IEscapeMenuOwner
|
||||
{
|
||||
[Dependency] private readonly IClientConsole _clientConsole = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||
[Dependency] private readonly IGameHud _gameHud = default!;
|
||||
@@ -31,7 +31,7 @@ namespace Content.Client
|
||||
if (obj.NewState is GameScreenBase)
|
||||
{
|
||||
// Switched TO GameScreen.
|
||||
_escapeMenu = new EscapeMenu(_clientConsole);
|
||||
_escapeMenu = new EscapeMenu(_consoleHost);
|
||||
|
||||
_escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Content.Client.Sandbox
|
||||
|
||||
internal class SandboxManager : SharedSandboxManager, ISandboxManager
|
||||
{
|
||||
[Dependency] private readonly IClientConsole _console = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IGameHud _gameHud = default!;
|
||||
[Dependency] private readonly IClientNetManager _netManager = default!;
|
||||
[Dependency] private readonly IPlacementManager _placementManager = default!;
|
||||
@@ -314,37 +314,37 @@ namespace Content.Client.Sandbox
|
||||
|
||||
private void ToggleLight()
|
||||
{
|
||||
_console.ProcessCommand("togglelight");
|
||||
_consoleHost.ExecuteCommand("togglelight");
|
||||
}
|
||||
|
||||
private void ToggleFov()
|
||||
{
|
||||
_console.ProcessCommand("togglefov");
|
||||
_consoleHost.ExecuteCommand("togglefov");
|
||||
}
|
||||
|
||||
private void ToggleShadows()
|
||||
{
|
||||
_console.ProcessCommand("toggleshadows");
|
||||
_consoleHost.ExecuteCommand("toggleshadows");
|
||||
}
|
||||
|
||||
private void ToggleSubFloor()
|
||||
{
|
||||
_console.ProcessCommand("showsubfloor");
|
||||
_consoleHost.ExecuteCommand("showsubfloor");
|
||||
}
|
||||
|
||||
private void ShowMarkers()
|
||||
{
|
||||
_console.ProcessCommand("showmarkers");
|
||||
_consoleHost.ExecuteCommand("showmarkers");
|
||||
}
|
||||
|
||||
private void ShowBb()
|
||||
{
|
||||
_console.ProcessCommand("showbb");
|
||||
_consoleHost.ExecuteCommand("showbb");
|
||||
}
|
||||
|
||||
private void LinkMachines()
|
||||
{
|
||||
_console.ProcessCommand("signallink");
|
||||
_consoleHost.ExecuteCommand("signallink");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Client.State
|
||||
public class LobbyState : Robust.Client.State.State
|
||||
{
|
||||
[Dependency] private readonly IBaseClient _baseClient = default!;
|
||||
[Dependency] private readonly IClientConsole _console = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
@@ -87,7 +87,7 @@ namespace Content.Client.State
|
||||
_userInterfaceManager.StateRoot.AddChild(_characterSetup);
|
||||
};
|
||||
|
||||
_lobby.ObserveButton.OnPressed += args => _console.ProcessCommand("observe");
|
||||
_lobby.ObserveButton.OnPressed += args => _consoleHost.ExecuteCommand("observe");
|
||||
_lobby.ReadyButton.OnPressed += args =>
|
||||
{
|
||||
if (!_clientGameTicker.IsGameStarted)
|
||||
@@ -104,7 +104,7 @@ namespace Content.Client.State
|
||||
SetReady(args.Pressed);
|
||||
};
|
||||
|
||||
_lobby.LeaveButton.OnPressed += args => _console.ProcessCommand("disconnect");
|
||||
_lobby.LeaveButton.OnPressed += args => _consoleHost.ExecuteCommand("disconnect");
|
||||
_lobby.OptionsButton.OnPressed += args => new OptionsMenu().Open();
|
||||
|
||||
UpdatePlayerList();
|
||||
@@ -259,7 +259,7 @@ namespace Content.Client.State
|
||||
return;
|
||||
}
|
||||
|
||||
_console.ProcessCommand($"toggleready {newReady}");
|
||||
_consoleHost.ExecuteCommand($"toggleready {newReady}");
|
||||
UpdatePlayerList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
|
||||
public override void ButtonPressed(ButtonEventArgs args)
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand(RequiredCommand);
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(RequiredCommand);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -504,7 +504,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
Name = "Pause",
|
||||
Handler = () =>
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand("events pause");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("events pause");
|
||||
},
|
||||
},
|
||||
new CommandUIButton
|
||||
@@ -512,14 +512,14 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
Name = "Resume",
|
||||
Handler = () =>
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand("events resume");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("events resume");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
public override void Submit()
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand($"events run \"{_eventsDropDown.GetValue()}\"");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"events run \"{_eventsDropDown.GetValue()}\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
|
||||
public override void Submit()
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand($"kick \"{_playerDropDown.GetValue()}\" \"{CommandParsing.Escape(_reason.GetValue())}\"");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"kick \"{_playerDropDown.GetValue()}\" \"{CommandParsing.Escape(_reason.GetValue())}\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
|
||||
public override void Submit()
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand($"tpto \"{_playerDropDown.GetValue()}\"");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"tpto \"{_playerDropDown.GetValue()}\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +596,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
|
||||
public override void Submit()
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand($"addatmos {_grid.GetValue()}");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {_grid.GetValue()}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,7 +639,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
|
||||
public override void Submit()
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand($"fillgas {_grid.GetValue()} {_gas.GetValue()} {_amount.GetValue()}");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"fillgas {_grid.GetValue()} {_gas.GetValue()} {_amount.GetValue()}");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Client.UserInterface.AdminMenu.SetOutfit
|
||||
public partial class SetOutfitMenu : SS14Window
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IClientConsole _console = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
|
||||
public EntityUid? TargetEntityId { get; set; }
|
||||
protected override Vector2? CustomSize => (250, 320);
|
||||
@@ -49,7 +49,7 @@ namespace Content.Client.UserInterface.AdminMenu.SetOutfit
|
||||
if (TargetEntityId == null || _selectedOutfit == null)
|
||||
return;
|
||||
var command = $"setoutfit {TargetEntityId} {_selectedOutfit.ID}";
|
||||
_console.ProcessCommand(command);
|
||||
_consoleHost.ExecuteCommand(command);
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,16 +8,16 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
internal sealed class EscapeMenu : SS14Window
|
||||
{
|
||||
private readonly IClientConsole _console;
|
||||
private readonly IClientConsoleHost _consoleHost;
|
||||
|
||||
private BaseButton DisconnectButton;
|
||||
private BaseButton QuitButton;
|
||||
private BaseButton OptionsButton;
|
||||
private OptionsMenu optionsMenu;
|
||||
|
||||
public EscapeMenu(IClientConsole console)
|
||||
public EscapeMenu(IClientConsoleHost consoleHost)
|
||||
{
|
||||
_console = console;
|
||||
_consoleHost = consoleHost;
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
@@ -50,13 +50,13 @@ namespace Content.Client.UserInterface
|
||||
|
||||
private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
_console.ProcessCommand("quit");
|
||||
_consoleHost.ExecuteCommand("quit");
|
||||
Dispose();
|
||||
}
|
||||
|
||||
private void OnDisconnectButtonClicked(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
_console.ProcessCommand("disconnect");
|
||||
_consoleHost.ExecuteCommand("disconnect");
|
||||
Dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Client.UserInterface
|
||||
public sealed class LateJoinGui : SS14Window
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IClientConsole _console = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IClientGameTicker _gameTicker = default!;
|
||||
|
||||
protected override Vector2? CustomSize => (360, 560);
|
||||
@@ -147,7 +147,7 @@ namespace Content.Client.UserInterface
|
||||
SelectedId += jobId =>
|
||||
{
|
||||
Logger.InfoS("latejoin", $"Late joining as ID: {jobId}");
|
||||
_console.ProcessCommand($"joingame {CommandParsing.Escape(jobId)}");
|
||||
_consoleHost.ExecuteCommand($"joingame {CommandParsing.Escape(jobId)}");
|
||||
Close();
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ using Content.Shared.Roles;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Server.Mobs;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Commands.GameTicking;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
@@ -40,7 +41,7 @@ namespace Content.IntegrationTests.Tests.Commands
|
||||
tickBeforeRestart = entityManager.CurrentTick;
|
||||
|
||||
var command = new NewRoundCommand();
|
||||
command.Execute(null, null, new string[] { });
|
||||
command.Execute(null, string.Empty, Array.Empty<string>());
|
||||
|
||||
if (lobbyEnabled)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Client.GameObjects.Components.Items;
|
||||
@@ -7,7 +7,7 @@ using Content.Server.GameObjects.Components.Body;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -96,8 +96,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
|
||||
private void AddHand(IEntity to)
|
||||
{
|
||||
var shell = IoCManager.Resolve<IConsoleShell>();
|
||||
shell.ExecuteCommand($"addhand {to.Uid}");
|
||||
var host = IoCManager.Resolve<IServerConsoleHost>();
|
||||
host.ExecuteCommand(null, $"addhand {to.Uid}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
|
||||
await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
|
||||
|
||||
await client.WaitPost(() => IoCManager.Resolve<IClientConsole>().ProcessCommand("disconnect"));
|
||||
await client.WaitPost(() => IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("disconnect"));
|
||||
|
||||
// Run some ticks for the disconnect to complete and such.
|
||||
await RunTicksSync(client, server, 5);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration
|
||||
{
|
||||
@@ -13,7 +13,7 @@ namespace Content.Server.Administration
|
||||
/// </remarks>
|
||||
/// <seealso cref="AnyCommandAttribute"/>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
[BaseTypeRequired(typeof(IClientCommand))]
|
||||
[BaseTypeRequired(typeof(IConsoleCommand))]
|
||||
[MeansImplicitUse]
|
||||
public sealed class AdminCommandAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -12,9 +12,9 @@ using Content.Shared;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Network.NetMessages;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.Administration
|
||||
[Dependency] private readonly IServerNetManager _netMgr = default!;
|
||||
[Dependency] private readonly IConGroupController _conGroup = default!;
|
||||
[Dependency] private readonly IResourceManager _res = default!;
|
||||
[Dependency] private readonly IConsoleShell _consoleShell = default!;
|
||||
[Dependency] private readonly IServerConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IChatManager _chat = default!;
|
||||
|
||||
private readonly Dictionary<IPlayerSession, AdminReg> _admins = new();
|
||||
@@ -171,7 +171,7 @@ namespace Content.Server.Administration
|
||||
_netMgr.RegisterNetMessage<MsgUpdateAdminStatus>(MsgUpdateAdminStatus.NAME);
|
||||
|
||||
// Cache permissions for loaded console commands with the requisite attributes.
|
||||
foreach (var (cmdName, cmd) in _consoleShell.AvailableCommands)
|
||||
foreach (var (cmdName, cmd) in _consoleHost.RegisteredCommands)
|
||||
{
|
||||
var (isAvail, flagsReq) = GetRequiredFlag(cmd);
|
||||
|
||||
@@ -420,7 +420,7 @@ namespace Content.Server.Administration
|
||||
return false;
|
||||
}
|
||||
|
||||
private static (bool isAvail, AdminFlags[] flagsReq) GetRequiredFlag(IClientCommand cmd)
|
||||
private static (bool isAvail, AdminFlags[] flagsReq) GetRequiredFlag(IConsoleCommand cmd)
|
||||
{
|
||||
var type = cmd.GetType();
|
||||
if (Attribute.IsDefined(type, typeof(AnyCommandAttribute)))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration
|
||||
{
|
||||
@@ -9,7 +9,7 @@ namespace Content.Server.Administration
|
||||
/// </summary>
|
||||
/// <seealso cref="AdminCommandAttribute"/>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
[BaseTypeRequired(typeof(IClientCommand))]
|
||||
[BaseTypeRequired(typeof(IConsoleCommand))]
|
||||
[MeansImplicitUse]
|
||||
public sealed class AnyCommandAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -3,25 +3,26 @@ using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class AGhost : IClientCommand
|
||||
public class AGhost : IConsoleCommand
|
||||
{
|
||||
public string Command => "aghost";
|
||||
public string Description => "Makes you an admin ghost.";
|
||||
public string Help => "aghost";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Nah");
|
||||
shell.WriteLine("Nah");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (mind == null)
|
||||
{
|
||||
shell.SendText(player, "You can't ghost here!");
|
||||
shell.WriteLine("You can't ghost here!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
using Content.Server.Database;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
@@ -11,14 +11,15 @@ using Robust.Shared.Network;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Ban)]
|
||||
public sealed class BanCommand : IClientCommand
|
||||
public sealed class BanCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "ban";
|
||||
public string Description => "Bans somebody";
|
||||
public string Help => "Usage: <name or user ID> <reason> <duration in minutes, or 0 for permanent ban>";
|
||||
|
||||
public async void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var plyMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
var dbMan = IoCManager.Resolve<IServerDbManager>();
|
||||
|
||||
@@ -37,7 +38,7 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Unable to find user with that name.");
|
||||
shell.WriteLine("Unable to find user with that name.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,23 +12,24 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class ControlMob : IClientCommand
|
||||
class ControlMob : IConsoleCommand
|
||||
{
|
||||
public string Command => "controlmob";
|
||||
public string Description => Loc.GetString("Transfers user mind to the specified entity.");
|
||||
public string Help => Loc.GetString("Usage: controlmob <mobUid>.");
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Server cannot do this.");
|
||||
shell.WriteLine("Server cannot do this.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Wrong number of arguments."));
|
||||
shell.WriteLine(Loc.GetString("Wrong number of arguments."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +39,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!int.TryParse(args[0], out var targetId))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Argument must be a number."));
|
||||
shell.WriteLine(Loc.GetString("Argument must be a number."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,14 +47,14 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!eUid.IsValid() || !entityManager.EntityExists(eUid))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid entity ID."));
|
||||
shell.WriteLine(Loc.GetString("Invalid entity ID."));
|
||||
return;
|
||||
}
|
||||
|
||||
var target = entityManager.GetEntity(eUid);
|
||||
if (!target.TryGetComponent(out MindComponent mindComponent))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Target entity is not a mob!"));
|
||||
shell.WriteLine(Loc.GetString("Target entity is not a mob!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class DSay : IClientCommand
|
||||
class DSay : IConsoleCommand
|
||||
{
|
||||
public string Command => "dsay";
|
||||
|
||||
@@ -16,11 +16,12 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public string Help => Loc.GetString($"Usage: {Command} <message>");
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Only players can use this command");
|
||||
shell.WriteLine("Only players can use this command");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
#nullable enable
|
||||
@@ -10,17 +10,18 @@ namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[AdminCommand(AdminFlags.None)]
|
||||
public class DeAdminCommand : IClientCommand
|
||||
public class DeAdminCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "deadmin";
|
||||
public string Description => "Temporarily de-admins you so you can experience the round as a normal player.";
|
||||
public string Help => "Usage: deadmin\nUse readmin to re-admin after using this.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot use this command from the server console.");
|
||||
shell.WriteLine("You cannot use this command from the server console.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class DeleteComponent : IClientCommand
|
||||
public class DeleteComponent : IConsoleCommand
|
||||
{
|
||||
public string Command => "deletecomponent";
|
||||
public string Description => "Deletes all instances of the specified component.";
|
||||
public string Help => $"Usage: {Command} <name>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
switch (args.Length)
|
||||
{
|
||||
case 0:
|
||||
shell.SendText(player, $"Not enough arguments.\n{Help}");
|
||||
shell.WriteLine($"Not enough arguments.\n{Help}");
|
||||
break;
|
||||
default:
|
||||
var name = string.Join(" ", args);
|
||||
@@ -28,7 +28,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!componentFactory.TryGetRegistration(name, out var registration))
|
||||
{
|
||||
shell.SendText(player, $"No component exists with name {name}.");
|
||||
shell.WriteLine($"No component exists with name {name}.");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Administration.Commands
|
||||
i++;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Removed {i} components with name {name}.");
|
||||
shell.WriteLine($"Removed {i} components with name {name}.");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -11,7 +11,7 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class DeleteEntitiesWithComponent : IClientCommand
|
||||
class DeleteEntitiesWithComponent : IConsoleCommand
|
||||
{
|
||||
public string Command => "deleteewc";
|
||||
public string Description
|
||||
@@ -29,11 +29,11 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Server.Administration.Commands
|
||||
count += 1;
|
||||
}
|
||||
|
||||
shell.SendText(player, Loc.GetString("Deleted {0} entities", count));
|
||||
shell.WriteLine(Loc.GetString("Deleted {0} entities", count));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -9,17 +9,17 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class DeleteEntitiesWithId : IClientCommand
|
||||
public class DeleteEntitiesWithId : IConsoleCommand
|
||||
{
|
||||
public string Command => "deleteewi";
|
||||
public string Description => "Deletes entities with the specified prototype ID.";
|
||||
public string Help => $"Usage: {Command} <prototypeID>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Content.Server.Administration.Commands
|
||||
i++;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Deleted all entities with id {id}. Occurrences: {i}");
|
||||
shell.WriteLine($"Deleted all entities with id {id}. Occurrences: {i}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Explosions;
|
||||
using Content.Server.Explosions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
#nullable enable
|
||||
@@ -9,18 +9,19 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public sealed class ExplosionCommand : IClientCommand
|
||||
public sealed class ExplosionCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "explode";
|
||||
public string Description => "Train go boom";
|
||||
public string Help => "Usage: explode <x> <y> <dev> <heavy> <light> <flash>\n" +
|
||||
"The explosion happens on the same map as the user.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You must have an attached entity.");
|
||||
shell.WriteLine("You must have an attached entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Eui;
|
||||
using Content.Server.Eui;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
#nullable enable
|
||||
@@ -9,17 +9,18 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Permissions)]
|
||||
public sealed class OpenPermissionsCommand : IClientCommand
|
||||
public sealed class OpenPermissionsCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "permissions";
|
||||
public string Description => "Opens the admin permissions panel.";
|
||||
public string Help => "Usage: permissions";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "This does not work from the server console.");
|
||||
shell.WriteLine("This does not work from the server console.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class PromoteHostCommand : IClientCommand
|
||||
public sealed class PromoteHostCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "promotehost";
|
||||
public string Description => "Grants client temporary full host admin privileges. Use this to bootstrap admins.";
|
||||
public string Help => "Usage promotehost <player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly one argument.");
|
||||
shell.WriteLine("Expected exactly one argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
var plyMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
if (!plyMgr.TryGetSessionByUsername(args[0], out var targetPlayer))
|
||||
{
|
||||
shell.SendText(player, "Unable to find a player by that name.");
|
||||
shell.WriteLine("Unable to find a player by that name.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
#nullable enable
|
||||
@@ -7,17 +7,18 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AnyCommand]
|
||||
public class ReAdminCommand : IClientCommand
|
||||
public class ReAdminCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "readmin";
|
||||
public string Description => "Re-admins you if you previously de-adminned.";
|
||||
public string Help => "Usage: readmin";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot use this command from the server console.");
|
||||
shell.WriteLine("You cannot use this command from the server console.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (mgr.GetAdminData(player, includeDeAdmin: true) == null)
|
||||
{
|
||||
shell.SendText(player, "You're not an admin.");
|
||||
shell.WriteLine("You're not an admin.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
public class ReadyAll : IClientCommand
|
||||
public class ReadyAll : IConsoleCommand
|
||||
{
|
||||
public string Command => "readyall";
|
||||
public string Description => "Readies up all players in the lobby.";
|
||||
public string Help => $"{Command} | ̣{Command} <ready>";
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ready = true;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "This command can only be ran while in the lobby!");
|
||||
shell.WriteLine("This command can only be ran while in the lobby!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.GlobalVerbs;
|
||||
using Content.Server.GlobalVerbs;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -10,7 +10,7 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class Rejuvenate : IClientCommand
|
||||
class Rejuvenate : IConsoleCommand
|
||||
{
|
||||
public string Command => "rejuvenate";
|
||||
public string Description
|
||||
@@ -28,14 +28,15 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length < 1 && player != null) //Try to heal the users mob if applicable
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Healing the user's mob since no arguments were provided."));
|
||||
shell.WriteLine(Loc.GetString("Healing the user's mob since no arguments were provided."));
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("There's no entity attached to the user."));
|
||||
shell.WriteLine(Loc.GetString("There's no entity attached to the user."));
|
||||
return;
|
||||
}
|
||||
RejuvenateVerb.PerformRejuvenate(player.AttachedEntity);
|
||||
@@ -46,7 +47,7 @@ namespace Content.Server.Administration.Commands
|
||||
{
|
||||
if(!EntityUid.TryParse(arg, out var uid) || !entityManager.TryGetEntity(uid, out var entity))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Could not find entity {0}", arg));
|
||||
shell.WriteLine(Loc.GetString("Could not find entity {0}", arg));
|
||||
continue;
|
||||
}
|
||||
RejuvenateVerb.PerformRejuvenate(entity);
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,7 +14,7 @@ using Robust.Shared.Prototypes;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class SetOutfitCommand : IClientCommand
|
||||
class SetOutfitCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "setoutfit";
|
||||
|
||||
@@ -22,17 +22,17 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public string Help => Loc.GetString("Usage: {0} <entityUid> | {0} <entityUid> <outfitId>", Command);
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Wrong number of arguments."));
|
||||
shell.WriteLine(Loc.GetString("Wrong number of arguments."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var entityUid))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("EntityUid must be a number."));
|
||||
shell.WriteLine(Loc.GetString("EntityUid must be a number."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!eUid.IsValid() || !entityManager.EntityExists(eUid))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid entity ID."));
|
||||
shell.WriteLine(Loc.GetString("Invalid entity ID."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!target.TryGetComponent<InventoryComponent>(out var inventoryComponent))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Target entity does not have an inventory!"));
|
||||
shell.WriteLine(Loc.GetString("Target entity does not have an inventory!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace Content.Server.Administration.Commands
|
||||
{
|
||||
var eui = IoCManager.Resolve<EuiManager>();
|
||||
var ui = new SetOutfitEui(target);
|
||||
var player = shell.Player as IPlayerSession;
|
||||
eui.OpenEui(ui, player);
|
||||
return;
|
||||
}
|
||||
@@ -65,7 +66,7 @@ namespace Content.Server.Administration.Commands
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
if (!prototypeManager.TryIndex<StartingGearPrototype>(args[1], out var startingGear))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid outfit id"));
|
||||
shell.WriteLine(Loc.GetString("Invalid outfit id"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Markers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -14,7 +14,7 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class WarpCommand : IClientCommand
|
||||
public class WarpCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "warp";
|
||||
public string Description => "Teleports you to predefined areas on the map.";
|
||||
@@ -23,17 +23,18 @@ namespace Content.Server.Administration.Commands
|
||||
"warp <location>\nLocations you can teleport to are predefined by the map. " +
|
||||
"You can specify '?' as location to get a list of valid locations.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Only players can use this command");
|
||||
shell.WriteLine("Only players can use this command");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Expected a single argument.");
|
||||
shell.WriteLine("Expected a single argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,13 +49,13 @@ namespace Content.Server.Administration.Commands
|
||||
.OrderBy(p => p)
|
||||
.Distinct());
|
||||
|
||||
shell.SendText(player, locations);
|
||||
shell.WriteLine(locations);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You are not in-game!");
|
||||
shell.WriteLine("You are not in-game!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,7 +122,7 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "That location does not exist!");
|
||||
shell.WriteLine("That location does not exist!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Server.GameObjects.EntitySystems.AI;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -14,7 +14,7 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands.AI
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class AddAiCommand : IClientCommand
|
||||
public class AddAiCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addai";
|
||||
public string Description => "Add an ai component with a given processor to an entity.";
|
||||
@@ -22,11 +22,11 @@ namespace Content.Server.Commands.AI
|
||||
+ "\n processorId: Class that inherits AiLogicProcessor and has an AiLogicProcessor attribute."
|
||||
+ "\n entityID: Uid of entity to add the AiControllerComponent to. Open its VV menu to find this.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if(args.Length != 2)
|
||||
{
|
||||
shell.SendText(player, "Wrong number of args.");
|
||||
shell.WriteLine("Wrong number of args.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace Content.Server.Commands.AI
|
||||
|
||||
if (!aiSystem.ProcessorTypeExists(processorId))
|
||||
{
|
||||
shell.SendText(player, "Invalid processor type. Processor must inherit AiLogicProcessor and have an AiLogicProcessor attribute.");
|
||||
shell.WriteLine("Invalid processor type. Processor must inherit AiLogicProcessor and have an AiLogicProcessor attribute.");
|
||||
return;
|
||||
}
|
||||
if (ent.HasComponent<AiControllerComponent>())
|
||||
{
|
||||
shell.SendText(player, "Entity already has an AI component.");
|
||||
shell.WriteLine("Entity already has an AI component.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.Commands.AI
|
||||
|
||||
var comp = ent.AddComponent<AiControllerComponent>();
|
||||
comp.LogicName = processorId;
|
||||
shell.SendText(player, "AI component added.");
|
||||
shell.WriteLine("AI component added.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,22 +4,22 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.AI;
|
||||
using Content.Server.GameObjects.EntitySystems.AI;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Commands.AI
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public sealed class FactionCommand : IClientCommand
|
||||
public sealed class FactionCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "factions";
|
||||
public string Description => "Update / list factional relationships for NPCs.";
|
||||
public string Help => "faction <source> <friendly/hostile> target\n" +
|
||||
"faction <source> list: hostile factions";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
@@ -31,19 +31,19 @@ namespace Content.Server.Commands.AI
|
||||
result.Append(value + "\n");
|
||||
}
|
||||
|
||||
shell.SendText(player, result.ToString());
|
||||
shell.WriteLine(result.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length < 2)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Need more args"));
|
||||
shell.WriteLine(Loc.GetString("Need more args"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[0], true, out Faction faction))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid faction"));
|
||||
shell.WriteLine(Loc.GetString("Invalid faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,40 +54,40 @@ namespace Content.Server.Commands.AI
|
||||
case "friendly":
|
||||
if (args.Length < 3)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Need to supply a target faction"));
|
||||
shell.WriteLine(Loc.GetString("Need to supply a target faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[2], true, out targetFaction))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid target faction"));
|
||||
shell.WriteLine(Loc.GetString("Invalid target faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySystem.Get<AiFactionTagSystem>().MakeFriendly(faction, targetFaction);
|
||||
shell.SendText(player, Loc.GetString("Command successful"));
|
||||
shell.WriteLine(Loc.GetString("Command successful"));
|
||||
break;
|
||||
case "hostile":
|
||||
if (args.Length < 3)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Need to supply a target faction"));
|
||||
shell.WriteLine(Loc.GetString("Need to supply a target faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[2], true, out targetFaction))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid target faction"));
|
||||
shell.WriteLine(Loc.GetString("Invalid target faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySystem.Get<AiFactionTagSystem>().MakeHostile(faction, targetFaction);
|
||||
shell.SendText(player, Loc.GetString("Command successful"));
|
||||
shell.WriteLine(Loc.GetString("Command successful"));
|
||||
break;
|
||||
case "list":
|
||||
shell.SendText(player, EntitySystem.Get<AiFactionTagSystem>().GetHostileFactions(faction).ToString());
|
||||
shell.WriteLine(EntitySystem.Get<AiFactionTagSystem>().GetHostileFactions(faction).ToString());
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Loc.GetString("Unknown faction arg"));
|
||||
shell.WriteLine(Loc.GetString("Unknown faction arg"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Actions
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class CooldownAction : IClientCommand
|
||||
public sealed class CooldownAction : IConsoleCommand
|
||||
{
|
||||
public string Command => "coolaction";
|
||||
public string Description => "Sets a cooldown on an action for a player, defaulting to current player";
|
||||
public string Help => "coolaction <actionType> <seconds> <name or userID, omit for current player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null) return;
|
||||
var attachedEntity = player.AttachedEntity;
|
||||
if (args.Length > 2)
|
||||
@@ -31,14 +32,14 @@ namespace Content.Server.Commands.Actions
|
||||
if (attachedEntity == null) return;
|
||||
if (!attachedEntity.TryGetComponent(out ServerActionsComponent? actionsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no actions component");
|
||||
shell.WriteLine("user has no actions component");
|
||||
return;
|
||||
}
|
||||
|
||||
var actionTypeRaw = args[0];
|
||||
if (!Enum.TryParse<ActionType>(actionTypeRaw, out var actionType))
|
||||
{
|
||||
shell.SendText(player, "unrecognized ActionType enum value, please" +
|
||||
shell.WriteLine("unrecognized ActionType enum value, please" +
|
||||
" ensure you used correct casing: " + actionTypeRaw);
|
||||
return;
|
||||
}
|
||||
@@ -46,14 +47,14 @@ namespace Content.Server.Commands.Actions
|
||||
|
||||
if (!actionMgr.TryGet(actionType, out var action))
|
||||
{
|
||||
shell.SendText(player, "unrecognized actionType " + actionType);
|
||||
shell.WriteLine("unrecognized actionType " + actionType);
|
||||
return;
|
||||
}
|
||||
|
||||
var cooldownStart = IoCManager.Resolve<IGameTiming>().CurTime;
|
||||
if (!uint.TryParse(args[1], out var seconds))
|
||||
{
|
||||
shell.SendText(player, "cannot parse seconds: " + args[1]);
|
||||
shell.WriteLine("cannot parse seconds: " + args[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Actions
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class GrantAction : IClientCommand
|
||||
public sealed class GrantAction : IConsoleCommand
|
||||
{
|
||||
public string Command => "grantaction";
|
||||
public string Description => "Grants an action to a player, defaulting to current player";
|
||||
public string Help => "grantaction <actionType> <name or userID, omit for current player>";
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null) return;
|
||||
var attachedEntity = player.AttachedEntity;
|
||||
if (args.Length > 1)
|
||||
@@ -29,21 +30,21 @@ namespace Content.Server.Commands.Actions
|
||||
if (attachedEntity == null) return;
|
||||
if (!attachedEntity.TryGetComponent(out ServerActionsComponent? actionsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no actions component");
|
||||
shell.WriteLine("user has no actions component");
|
||||
return;
|
||||
}
|
||||
|
||||
var actionTypeRaw = args[0];
|
||||
if (!Enum.TryParse<ActionType>(actionTypeRaw, out var actionType))
|
||||
{
|
||||
shell.SendText(player, "unrecognized ActionType enum value, please" +
|
||||
shell.WriteLine("unrecognized ActionType enum value, please" +
|
||||
" ensure you used correct casing: " + actionTypeRaw);
|
||||
return;
|
||||
}
|
||||
var actionMgr = IoCManager.Resolve<ActionManager>();
|
||||
if (!actionMgr.TryGet(actionType, out var action))
|
||||
{
|
||||
shell.SendText(player, "unrecognized actionType " + actionType);
|
||||
shell.WriteLine("unrecognized actionType " + actionType);
|
||||
return;
|
||||
}
|
||||
actionsComponent.Grant(action.ActionType);
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Actions
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class RevokeAction : IClientCommand
|
||||
public sealed class RevokeAction : IConsoleCommand
|
||||
{
|
||||
public string Command => "revokeaction";
|
||||
public string Description => "Revokes an action from a player, defaulting to current player";
|
||||
public string Help => "revokeaction <actionType> <name or userID, omit for current player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null) return;
|
||||
var attachedEntity = player.AttachedEntity;
|
||||
if (args.Length > 1)
|
||||
@@ -29,21 +30,21 @@ namespace Content.Server.Commands.Actions
|
||||
if (attachedEntity == null) return;
|
||||
if (!attachedEntity.TryGetComponent(out ServerActionsComponent? actionsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no actions component");
|
||||
shell.WriteLine("user has no actions component");
|
||||
return;
|
||||
}
|
||||
|
||||
var actionTypeRaw = args[0];
|
||||
if (!Enum.TryParse<ActionType>(actionTypeRaw, out var actionType))
|
||||
{
|
||||
shell.SendText(player, "unrecognized ActionType enum value, please" +
|
||||
shell.WriteLine("unrecognized ActionType enum value, please" +
|
||||
" ensure you used correct casing: " + actionTypeRaw);
|
||||
return;
|
||||
}
|
||||
var actionMgr = IoCManager.Resolve<ActionManager>();
|
||||
if (!actionMgr.TryGet(actionType, out var action))
|
||||
{
|
||||
shell.SendText(player, "unrecognized actionType " + actionType);
|
||||
shell.WriteLine("unrecognized actionType " + actionType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Alert;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Alerts
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class ClearAlert : IClientCommand
|
||||
public sealed class ClearAlert : IConsoleCommand
|
||||
{
|
||||
public string Command => "clearalert";
|
||||
public string Description => "Clears an alert for a player, defaulting to current player";
|
||||
public string Help => "clearalert <alertType> <name or userID, omit for current player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity.");
|
||||
shell.WriteLine("You don't have an entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ namespace Content.Server.Commands.Alerts
|
||||
|
||||
if (!attachedEntity.TryGetComponent(out ServerAlertsComponent? alertsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no alerts component");
|
||||
shell.WriteLine("user has no alerts component");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@ namespace Content.Server.Commands.Alerts
|
||||
var alertMgr = IoCManager.Resolve<AlertManager>();
|
||||
if (!alertMgr.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
|
||||
{
|
||||
shell.SendText(player, "unrecognized alertType " + alertType);
|
||||
shell.WriteLine("unrecognized alertType " + alertType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Alert;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Alerts
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class ShowAlert : IClientCommand
|
||||
public sealed class ShowAlert : IConsoleCommand
|
||||
{
|
||||
public string Command => "showalert";
|
||||
public string Description => "Shows an alert for a player, defaulting to current player";
|
||||
public string Help => "showalert <alertType> <severity, -1 if no severity> <name or userID, omit for current player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot run this command from the server.");
|
||||
shell.WriteLine("You cannot run this command from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace Content.Server.Commands.Alerts
|
||||
|
||||
if (attachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity.");
|
||||
shell.WriteLine("You don't have an entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace Content.Server.Commands.Alerts
|
||||
|
||||
if (!attachedEntity.TryGetComponent(out ServerAlertsComponent? alertsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no alerts component");
|
||||
shell.WriteLine("user has no alerts component");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,12 +51,12 @@ namespace Content.Server.Commands.Alerts
|
||||
var alertMgr = IoCManager.Resolve<AlertManager>();
|
||||
if (!alertMgr.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
|
||||
{
|
||||
shell.SendText(player, "unrecognized alertType " + alertType);
|
||||
shell.WriteLine("unrecognized alertType " + alertType);
|
||||
return;
|
||||
}
|
||||
if (!short.TryParse(severity, out var sevint))
|
||||
{
|
||||
shell.SendText(player, "invalid severity " + sevint);
|
||||
shell.WriteLine("invalid severity " + sevint);
|
||||
return;
|
||||
}
|
||||
alertsComponent.ShowAlert(alert.AlertType, sevint == -1 ? (short?) null : sevint);
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,23 +13,23 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddAtmosCommand : IClientCommand
|
||||
public class AddAtmosCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addatmos";
|
||||
public string Description => "Adds atmos support to a grid.";
|
||||
public string Help => $"{Command} <GridId>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,19 +47,19 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (grid.HasComponent<IGridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid already has an atmosphere.");
|
||||
shell.WriteLine("Grid already has an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
grid.AddComponent<GridAtmosphereComponent>();
|
||||
|
||||
shell.SendText(player, $"Added atmosphere to grid {id}.");
|
||||
shell.WriteLine($"Added atmosphere to grid {id}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,13 +14,13 @@ using Robust.Shared.Maths;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddGasCommand : IClientCommand
|
||||
public class AddGasCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addgas";
|
||||
public string Description => "Adds gas at a certain position.";
|
||||
public string Help => "addgas <X> <Y> <GridId> <Gas> <moles>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 5) return;
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
@@ -35,7 +35,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,13 +59,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
shell.SendText(player, "Invalid coordinates.");
|
||||
shell.WriteLine("Invalid coordinates.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tile.Air == null)
|
||||
{
|
||||
shell.SendText(player, "Can't add gas to that tile.");
|
||||
shell.WriteLine("Can't add gas to that tile.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,23 +13,23 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddUnsimulatedAtmosCommand : IClientCommand
|
||||
public class AddUnsimulatedAtmosCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addunsimulatedatmos";
|
||||
public string Description => "Adds unimulated atmos support to a grid.";
|
||||
public string Help => $"{Command} <GridId>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,19 +47,19 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (grid.HasComponent<IGridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid already has an atmosphere.");
|
||||
shell.WriteLine("Grid already has an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
grid.AddComponent<UnsimulatedGridAtmosphereComponent>();
|
||||
|
||||
shell.SendText(player, $"Added unsimulated atmosphere to grid {id}.");
|
||||
shell.WriteLine($"Added unsimulated atmosphere to grid {id}.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,14 +14,15 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class DeleteGasCommand : IClientCommand
|
||||
public class DeleteGasCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "deletegas";
|
||||
public string Description => "Removes all gases from a grid, or just of one type if specified.";
|
||||
public string Help => $"Usage: {Command} <GridId> <Gas> / {Command} <GridId> / {Command} <Gas> / {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
GridId gridId;
|
||||
Gas? gas = null;
|
||||
|
||||
@@ -30,13 +31,13 @@ namespace Content.Server.Commands.Atmos
|
||||
case 0:
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "A grid must be specified when the command isn't used by a player.");
|
||||
shell.WriteLine("A grid must be specified when the command isn't used by a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You have no entity to get a grid from.");
|
||||
shell.WriteLine("You have no entity to get a grid from.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,7 +45,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.SendText(player, "You aren't on a grid to delete gas from.");
|
||||
shell.WriteLine("You aren't on a grid to delete gas from.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,13 +57,13 @@ namespace Content.Server.Commands.Atmos
|
||||
// Argument is a gas
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "A grid id must be specified if not using this command as a player.");
|
||||
shell.WriteLine("A grid id must be specified if not using this command as a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You have no entity from which to get a grid id.");
|
||||
shell.WriteLine("You have no entity from which to get a grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,13 +71,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.SendText(player, "You aren't on a grid to delete gas from.");
|
||||
shell.WriteLine("You aren't on a grid to delete gas from.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse<Gas>(args[0], true, out var parsedGas))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid gas name.");
|
||||
shell.WriteLine($"{args[0]} is not a valid gas name.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,7 +100,7 @@ namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
if (!int.TryParse(args[0], out var first))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer for a grid id.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer for a grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,13 +108,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse<Gas>(args[1], true, out var parsedGas))
|
||||
{
|
||||
shell.SendText(player, $"{args[1]} is not a valid gas.");
|
||||
shell.WriteLine($"{args[1]} is not a valid gas.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ namespace Content.Server.Commands.Atmos
|
||||
break;
|
||||
}
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,7 +131,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
{
|
||||
shell.SendText(player, $"No grid exists with id {gridId}");
|
||||
shell.WriteLine($"No grid exists with id {gridId}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -138,13 +139,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||
{
|
||||
shell.SendText(player, $"Grid {gridId} has no entity.");
|
||||
shell.WriteLine($"Grid {gridId} has no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gridEntity.TryGetComponent(out GridAtmosphereComponent? atmosphere))
|
||||
{
|
||||
shell.SendText(player, $"Grid {gridId} has no {nameof(GridAtmosphereComponent)}");
|
||||
shell.WriteLine($"Grid {gridId} has no {nameof(GridAtmosphereComponent)}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -182,11 +183,11 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gas == null)
|
||||
{
|
||||
shell.SendText(player, $"Removed {moles} moles from {tiles} tiles.");
|
||||
shell.WriteLine($"Removed {moles} moles from {tiles} tiles.");
|
||||
return;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Removed {moles} moles of gas {gas} from {tiles} tiles.");
|
||||
shell.WriteLine($"Removed {moles} moles of gas {gas} from {tiles} tiles.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,13 +13,13 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class FillGas : IClientCommand
|
||||
public class FillGas : IConsoleCommand
|
||||
{
|
||||
public string Command => "fillgas";
|
||||
public string Description => "Adds gas to all tiles in a grid.";
|
||||
public string Help => "fillgas <GridId> <Gas> <moles>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 3) return;
|
||||
if(!int.TryParse(args[0], out var id)
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,13 +40,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,26 +2,26 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class ListGasesCommand : IClientCommand
|
||||
public class ListGasesCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "listgases";
|
||||
public string Description => "Prints a list of gases and their indices.";
|
||||
public string Help => "listgases";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
foreach (var gasPrototype in atmosSystem.Gases)
|
||||
{
|
||||
shell.SendText(player, $"{gasPrototype.Name} ID: {gasPrototype.ID}");
|
||||
shell.WriteLine($"{gasPrototype.Name} ID: {gasPrototype.ID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,13 +13,13 @@ using Robust.Shared.Maths;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class RemoveGasCommand : IClientCommand
|
||||
public class RemoveGasCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "removegas";
|
||||
public string Description => "Removes an amount of gases.";
|
||||
public string Help => "removegas <X> <Y> <GridId> <amount> <ratio>\nIf <ratio> is true, amount will be treated as the ratio of gas to be removed.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 5) return;
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
@@ -34,7 +34,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,13 +42,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,13 +58,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
shell.SendText(player, "Invalid coordinates.");
|
||||
shell.WriteLine("Invalid coordinates.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tile.Air == null)
|
||||
{
|
||||
shell.SendText(player, "Can't remove gas from that tile.");
|
||||
shell.WriteLine("Can't remove gas from that tile.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,13 +13,13 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SetAtmosTemperatureCommand : IClientCommand
|
||||
public class SetAtmosTemperatureCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "setatmostemp";
|
||||
public string Description => "Sets a grid's temperature (in kelvin).";
|
||||
public string Help => "Usage: setatmostemp <GridId> <Temperature>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 2) return;
|
||||
if(!int.TryParse(args[0], out var id)
|
||||
@@ -31,13 +31,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (temperature < Atmospherics.TCMB)
|
||||
{
|
||||
shell.SendText(player, "Invalid temperature.");
|
||||
shell.WriteLine("Invalid temperature.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Content.Server.Commands.Atmos
|
||||
tile.Invalidate();
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Changed the temperature of {tiles} tiles.");
|
||||
shell.WriteLine($"Changed the temperature of {tiles} tiles.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,13 +14,13 @@ using Robust.Shared.Maths;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SetTemperatureCommand : IClientCommand
|
||||
public class SetTemperatureCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "settemp";
|
||||
public string Description => "Sets a tile's temperature (in kelvin).";
|
||||
public string Help => "Usage: settemp <X> <Y> <GridId> <Temperature>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 4) return;
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
@@ -34,13 +34,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (temperature < Atmospherics.TCMB)
|
||||
{
|
||||
shell.SendText(player, "Invalid temperature.");
|
||||
shell.WriteLine("Invalid temperature.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,13 +64,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
shell.SendText(player, "Invalid coordinates.");
|
||||
shell.WriteLine("Invalid coordinates.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tile.Air == null)
|
||||
{
|
||||
shell.SendText(player, "Can't change that tile's temperature.");
|
||||
shell.WriteLine("Can't change that tile's temperature.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class ShowAtmos : IClientCommand
|
||||
public class ShowAtmos : IConsoleCommand
|
||||
{
|
||||
public string Command => "showatmos";
|
||||
public string Description => "Toggles seeing atmos debug overlay.";
|
||||
public string Help => $"Usage: {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You must be a player to use this command.");
|
||||
shell.WriteLine("You must be a player to use this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
var atmosDebug = EntitySystem.Get<AtmosDebugOverlaySystem>();
|
||||
var enabled = atmosDebug.ToggleObserver(player);
|
||||
|
||||
shell.SendText(player, enabled
|
||||
shell.WriteLine(enabled
|
||||
? "Enabled the atmospherics debug overlay."
|
||||
: "Disabled the atmospherics debug overlay.");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Body.Part;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,14 +13,15 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class AttachBodyPartCommand : IClientCommand
|
||||
public class AttachBodyPartCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "attachbodypart";
|
||||
public string Description => "Attaches a body part to you or someone else.";
|
||||
public string Help => $"{Command} <partEntityUid> / {Command} <entityUid> <partEntityUid>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
IEntity entity;
|
||||
@@ -31,19 +32,19 @@ namespace Content.Server.Commands
|
||||
case 1:
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, $"You need to specify an entity to attach the part to if you aren't a player.\n{Help}");
|
||||
shell.WriteLine($"You need to specify an entity to attach the part to if you aren't a player.\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, $"You need to specify an entity to attach the part to if you aren't attached to an entity.\n{Help}");
|
||||
shell.WriteLine($"You need to specify an entity to attach the part to if you aren't attached to an entity.\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityUid.TryParse(args[0], out partUid))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid entity uid.");
|
||||
shell.WriteLine($"{args[0]} is not a valid entity uid.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,50 +54,50 @@ namespace Content.Server.Commands
|
||||
case 2:
|
||||
if (!EntityUid.TryParse(args[0], out var entityUid))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid entity uid.");
|
||||
shell.WriteLine($"{args[0]} is not a valid entity uid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityUid.TryParse(args[1], out partUid))
|
||||
{
|
||||
shell.SendText(player, $"{args[1]} is not a valid entity uid.");
|
||||
shell.WriteLine($"{args[1]} is not a valid entity uid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.TryGetEntity(entityUid, out var tempEntity))
|
||||
{
|
||||
shell.SendText(player, $"{entityUid} is not a valid entity.");
|
||||
shell.WriteLine($"{entityUid} is not a valid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
entity = tempEntity;
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.TryGetComponent(out IBody? body))
|
||||
{
|
||||
shell.SendText(player, $"Entity {entity.Name} with uid {entity.Uid} does not have a {nameof(IBody)} component.");
|
||||
shell.WriteLine($"Entity {entity.Name} with uid {entity.Uid} does not have a {nameof(IBody)} component.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.TryGetEntity(partUid, out var partEntity))
|
||||
{
|
||||
shell.SendText(player, $"{partUid} is not a valid entity.");
|
||||
shell.WriteLine($"{partUid} is not a valid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!partEntity.TryGetComponent(out IBodyPart? part))
|
||||
{
|
||||
shell.SendText(player, $"Entity {partEntity.Name} with uid {args[0]} does not have a {nameof(IBodyPart)} component.");
|
||||
shell.WriteLine($"Entity {partEntity.Name} with uid {args[0]} does not have a {nameof(IBodyPart)} component.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (body.HasPart(part))
|
||||
{
|
||||
shell.SendText(player, $"Body part {partEntity.Name} with uid {partEntity.Uid} is already attached to entity {entity.Name} with uid {entity.Uid}");
|
||||
shell.WriteLine($"Body part {partEntity.Name} with uid {partEntity.Uid} is already attached to entity {entity.Name} with uid {entity.Uid}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
@@ -15,7 +15,7 @@ using Robust.Shared.Random;
|
||||
namespace Content.Server.Commands.Body
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
class AddHandCommand : IClientCommand
|
||||
class AddHandCommand : IConsoleCommand
|
||||
{
|
||||
public const string DefaultHandPrototype = "LeftHandHuman";
|
||||
|
||||
@@ -23,11 +23,12 @@ namespace Content.Server.Commands.Body
|
||||
public string Description => "Adds a hand to your entity.";
|
||||
public string Help => $"Usage: {Command} <entityUid> <handPrototypeId> / {Command} <entityUid> / {Command} <handPrototypeId> / {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length > 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,13 +44,13 @@ namespace Content.Server.Commands.Body
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "Only a player can run this command without arguments.");
|
||||
shell.WriteLine("Only a player can run this command without arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity to add a hand to.");
|
||||
shell.WriteLine("You don't have an entity to add a hand to.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ namespace Content.Server.Commands.Body
|
||||
{
|
||||
if (!entityManager.TryGetEntity(uid, out var parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity found with uid {uid}");
|
||||
shell.WriteLine($"No entity found with uid {uid}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,14 +75,13 @@ namespace Content.Server.Commands.Body
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player,
|
||||
"You must specify an entity to add a hand to when using this command from the server terminal.");
|
||||
shell.WriteLine("You must specify an entity to add a hand to when using this command from the server terminal.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity to add a hand to.");
|
||||
shell.WriteLine("You don't have an entity to add a hand to.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,13 +95,13 @@ namespace Content.Server.Commands.Body
|
||||
{
|
||||
if (!EntityUid.TryParse(args[0], out var uid))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid entity uid.");
|
||||
shell.WriteLine($"{args[0]} is not a valid entity uid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.TryGetEntity(uid, out var parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity exists with uid {uid}.");
|
||||
shell.WriteLine($"No entity exists with uid {uid}.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Content.Server.Commands.Body
|
||||
|
||||
if (!prototypeManager.HasIndex<EntityPrototype>(args[1]))
|
||||
{
|
||||
shell.SendText(player, $"No hand entity exists with id {args[1]}.");
|
||||
shell.WriteLine($"No hand entity exists with id {args[1]}.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Content.Server.Commands.Body
|
||||
}
|
||||
default:
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -129,13 +129,13 @@ namespace Content.Server.Commands.Body
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
|
||||
|
||||
shell.SendText(player, text);
|
||||
shell.WriteLine(text);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hand.TryGetComponent(out IBodyPart? part))
|
||||
{
|
||||
shell.SendText(player, $"Hand entity {hand} does not have a {nameof(IBodyPart)} component.");
|
||||
shell.WriteLine($"Hand entity {hand} does not have a {nameof(IBodyPart)} component.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Content.Server.Commands.Body
|
||||
? $"Added hand to entity {entity.Name}"
|
||||
: $"Error occurred trying to add a hand to entity {entity.Name}";
|
||||
|
||||
shell.SendText(player, response);
|
||||
shell.WriteLine(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
@@ -11,29 +11,30 @@ using Robust.Shared.Random;
|
||||
namespace Content.Server.Commands.Body
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
class DestroyMechanismCommand : IClientCommand
|
||||
class DestroyMechanismCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "destroymechanism";
|
||||
public string Description => "Destroys a mechanism from your entity";
|
||||
public string Help => $"Usage: {Command} <mechanism>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "Only a player can run this command.");
|
||||
shell.WriteLine("Only a player can run this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You have no entity.");
|
||||
shell.WriteLine("You have no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ namespace Content.Server.Commands.Body
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
|
||||
|
||||
shell.SendText(player, text);
|
||||
shell.WriteLine(text);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,12 +55,12 @@ namespace Content.Server.Commands.Body
|
||||
if (mechanism.Name.ToLowerInvariant() == mechanismName)
|
||||
{
|
||||
part.DeleteMechanism(mechanism);
|
||||
shell.SendText(player, $"Mechanism with name {mechanismName} has been destroyed.");
|
||||
shell.WriteLine($"Mechanism with name {mechanismName} has been destroyed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
shell.SendText(player, $"No mechanism was found with name {mechanismName}.");
|
||||
shell.WriteLine($"No mechanism was found with name {mechanismName}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
@@ -13,23 +13,24 @@ using Robust.Shared.Random;
|
||||
namespace Content.Server.Commands.Body
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
class RemoveHandCommand : IClientCommand
|
||||
class RemoveHandCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "removehand";
|
||||
public string Description => "Removes a hand from your entity.";
|
||||
public string Help => $"Usage: {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "Only a player can run this command.");
|
||||
shell.WriteLine("Only a player can run this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You have no entity.");
|
||||
shell.WriteLine("You have no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,14 +39,14 @@ namespace Content.Server.Commands.Body
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
|
||||
|
||||
shell.SendText(player, text);
|
||||
shell.WriteLine(text);
|
||||
return;
|
||||
}
|
||||
|
||||
var (_, hand) = body.Parts.FirstOrDefault(x => x.Value.PartType == BodyPartType.Hand);
|
||||
if (hand == null)
|
||||
{
|
||||
shell.SendText(player, "You have no hands.");
|
||||
shell.WriteLine("You have no hands.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
internal class AdminChatCommand : IClientCommand
|
||||
internal class AdminChatCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "asay";
|
||||
public string Description => "Send chat messages to the private admin chat channel.";
|
||||
public string Help => "asay <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length < 1)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AnyCommand]
|
||||
internal class MeCommand : IClientCommand
|
||||
internal class MeCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "me";
|
||||
public string Description => "Perform an action.";
|
||||
public string Help => "me <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "This command cannot be run from the server.");
|
||||
shell.WriteLine("This command cannot be run from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
if (mindComponent == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have a mind!");
|
||||
shell.WriteLine("You don't have a mind!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AnyCommand]
|
||||
internal class OOCCommand : IClientCommand
|
||||
internal class OOCCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "ooc";
|
||||
public string Description => "Send Out Of Character chat messages.";
|
||||
public string Help => "ooc <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length < 1)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AnyCommand]
|
||||
internal class SayCommand : IClientCommand
|
||||
internal class SayCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "say";
|
||||
public string Description => "Send chat messages to the local channel or a specified radio channel.";
|
||||
public string Help => "say <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "This command cannot be run from the server.");
|
||||
shell.WriteLine("This command cannot be run from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,7 +41,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
if (playerEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity!");
|
||||
shell.WriteLine("You don't have an entity!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
if (mindComponent == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have a mind!");
|
||||
shell.WriteLine("You don't have a mind!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
@@ -12,8 +12,8 @@ using Content.Server.Utility;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -22,7 +22,7 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AnyCommand]
|
||||
internal class SuicideCommand : IClientCommand
|
||||
internal class SuicideCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "suicide";
|
||||
|
||||
@@ -56,11 +56,12 @@ namespace Content.Server.Commands.Chat
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot run this command from the server.");
|
||||
shell.WriteLine("You cannot run this command from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +73,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
if (owner == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have a mind!");
|
||||
shell.WriteLine("You don't have a mind!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
// Prevent the player from returning to the body. Yes, this is an ugly hack.
|
||||
var ghost = new Ghost(){CanReturn = false};
|
||||
ghost.Execute(shell, player, Array.Empty<string>());
|
||||
ghost.Execute(shell, argStr, Array.Empty<string>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
@@ -26,11 +27,11 @@ namespace Content.Server.Commands
|
||||
if (Guid.TryParse(usernameOrId, out var targetGuid))
|
||||
{
|
||||
if (plyMgr.TryGetSessionById(new NetUserId(targetGuid), out session)) return true;
|
||||
shell.SendText(performer, "Unable to find user with that name/id.");
|
||||
shell.WriteLine("Unable to find user with that name/id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
shell.SendText(performer, "Unable to find user with that name/id.");
|
||||
shell.WriteLine("Unable to find user with that name/id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,7 +46,7 @@ namespace Content.Server.Commands
|
||||
if (!TryGetSessionByUsernameOrId(shell, usernameOrId, performer, out var session)) return false;
|
||||
if (session.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(performer, "User has no attached entity.");
|
||||
shell.WriteLine("User has no attached entity.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Commands.Damage
|
||||
{
|
||||
@@ -13,15 +14,16 @@ namespace Content.Server.Commands.Damage
|
||||
public override string Description => "Adds a damage flag to your entity or another.";
|
||||
public override string Help => $"Usage: {Command} <flag> / {Command} <entityUid> <flag>";
|
||||
|
||||
public override void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (!TryGetEntity(shell, player, args, true, out var entity, out var flag, out var damageable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
damageable.AddFlag(flag);
|
||||
shell.SendText(player, $"Added damage flag {flag} to entity {entity.Name}");
|
||||
shell.WriteLine($"Added damage flag {flag} to entity {entity.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Damage
|
||||
{
|
||||
public abstract class DamageFlagCommand : IClientCommand
|
||||
public abstract class DamageFlagCommand : IConsoleCommand
|
||||
{
|
||||
public abstract string Command { get; }
|
||||
public abstract string Description { get; }
|
||||
public abstract string Help { get; }
|
||||
|
||||
public abstract void Execute(IConsoleShell shell, IPlayerSession? player, string[] args);
|
||||
public abstract void Execute(IConsoleShell shell, string argStr, string[] args);
|
||||
|
||||
public bool TryGetEntity(
|
||||
IConsoleShell shell,
|
||||
@@ -41,19 +41,19 @@ namespace Content.Server.Commands.Damage
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "An entity needs to be specified when the command isn't used by a player.");
|
||||
shell.WriteLine("An entity needs to be specified when the command isn't used by a player.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "An entity needs to be specified when you aren't attached to an entity.");
|
||||
shell.WriteLine("An entity needs to be specified when you aren't attached to an entity.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[0], true, out parsedFlag))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid damage flag.");
|
||||
shell.WriteLine($"{args[0]} is not a valid damage flag.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,44 +65,44 @@ namespace Content.Server.Commands.Damage
|
||||
{
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid entity id.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid entity id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(id, out parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity found with id {id}.");
|
||||
shell.WriteLine($"No entity found with id {id}.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[1], true, out parsedFlag))
|
||||
{
|
||||
shell.SendText(player, $"{args[1]} is not a valid damage flag.");
|
||||
shell.WriteLine($"{args[1]} is not a valid damage flag.");
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parsedEntity.TryGetComponent(out parsedDamageable))
|
||||
{
|
||||
shell.SendText(player, $"Entity {parsedEntity.Name} doesn't have a {nameof(IDamageableComponent)}");
|
||||
shell.WriteLine($"Entity {parsedEntity.Name} doesn't have a {nameof(IDamageableComponent)}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parsedDamageable.HasFlag(parsedFlag) && adding)
|
||||
{
|
||||
shell.SendText(player, $"Entity {parsedEntity.Name} already has damage flag {parsedFlag}.");
|
||||
shell.WriteLine($"Entity {parsedEntity.Name} already has damage flag {parsedFlag}.");
|
||||
return false;
|
||||
}
|
||||
else if (!parsedDamageable.HasFlag(parsedFlag) && !adding)
|
||||
{
|
||||
shell.SendText(player, $"Entity {parsedEntity.Name} doesn't have damage flag {parsedFlag}.");
|
||||
shell.WriteLine($"Entity {parsedEntity.Name} doesn't have damage flag {parsedFlag}.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -12,14 +12,15 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands.Damage
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class GodModeCommand : IClientCommand
|
||||
public class GodModeCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "godmode";
|
||||
public string Description => "Makes your entity or another invulnerable to almost anything. May have irreversible changes.";
|
||||
public string Help => $"Usage: {Command} / {Command} <entityUid>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
IEntity entity;
|
||||
|
||||
switch (args.Length)
|
||||
@@ -27,13 +28,13 @@ namespace Content.Server.Commands.Damage
|
||||
case 0:
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "An entity needs to be specified when the command isn't used by a player.");
|
||||
shell.WriteLine("An entity needs to be specified when the command isn't used by a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "An entity needs to be specified when you aren't attached to an entity.");
|
||||
shell.WriteLine("An entity needs to be specified when you aren't attached to an entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,28 +43,28 @@ namespace Content.Server.Commands.Damage
|
||||
case 1:
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid entity id.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid entity id.");
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(id, out var parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity found with id {id}.");
|
||||
shell.WriteLine($"No entity found with id {id}.");
|
||||
return;
|
||||
}
|
||||
|
||||
entity = parsedEntity;
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
var godmodeSystem = EntitySystem.Get<GodmodeSystem>();
|
||||
var enabled = godmodeSystem.ToggleGodmode(entity);
|
||||
|
||||
shell.SendText(player, enabled
|
||||
shell.WriteLine(enabled
|
||||
? $"Enabled godmode for entity {entity.Name} with id {entity.Uid}"
|
||||
: $"Disabled godmode for entity {entity.Name} with id {entity.Uid}");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Commands.Damage
|
||||
{
|
||||
@@ -13,15 +14,16 @@ namespace Content.Server.Commands.Damage
|
||||
public override string Description => "Removes a damage flag from your entity or another.";
|
||||
public override string Help => $"Usage: {Command} <flag> / {Command} <entityUid> <flag>";
|
||||
|
||||
public override void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (!TryGetEntity(shell, player, args, false, out var entity, out var flag, out var damageable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
damageable.RemoveFlag(flag);
|
||||
shell.SendText(player, $"Removed damage flag {flag} from entity {entity.Name}");
|
||||
shell.WriteLine($"Removed damage flag {flag} from entity {entity.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Disposal;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,42 +12,43 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Commands.Disposal
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class TubeConnectionsCommand : IClientCommand
|
||||
public class TubeConnectionsCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "tubeconnections";
|
||||
public string Description => Loc.GetString("Shows all the directions that a tube can connect in.");
|
||||
public string Help => $"Usage: {Command} <entityUid>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Only players can use this command"));
|
||||
shell.WriteLine(Loc.GetString("Only players can use this command"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("{0} isn't a valid entity uid", args[0]));
|
||||
shell.WriteLine(Loc.GetString("{0} isn't a valid entity uid", args[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(id, out var entity))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("No entity exists with uid {0}", id));
|
||||
shell.WriteLine(Loc.GetString("No entity exists with uid {0}", id));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.TryGetComponent(out IDisposalTubeComponent? tube))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Entity with uid {0} doesn't have a {1} component", id, nameof(IDisposalTubeComponent)));
|
||||
shell.WriteLine(Loc.GetString("Entity with uid {0} doesn't have a {1} component", id, nameof(IDisposalTubeComponent)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,17 +12,17 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Mapping)]
|
||||
public class FindEntitiesWithComponents : IClientCommand
|
||||
public class FindEntitiesWithComponents : IConsoleCommand
|
||||
{
|
||||
public string Command => "findentitieswithcomponents";
|
||||
public string Description => "Finds entities with all of the specified components.";
|
||||
public string Help => $"{Command} <componentName1> <componentName2>...";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
shell.SendText(player, $"Invalid amount of arguments: {args.Length}.\n{Help}");
|
||||
shell.WriteLine($"Invalid amount of arguments: {args.Length}.\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (invalidArgs.Count > 0)
|
||||
{
|
||||
shell.SendText(player, $"No component found for component names: {string.Join(", ", invalidArgs)}");
|
||||
shell.WriteLine($"No component found for component names: {string.Join(", ", invalidArgs)}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ namespace Content.Server.Commands
|
||||
|
||||
if (entityIds.Count == 0)
|
||||
{
|
||||
shell.SendText(player, $"No entities found with components {string.Join(", ", args)}.");
|
||||
shell.WriteLine($"No entities found with components {string.Join(", ", args)}.");
|
||||
return;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"{entityIds.Count} entities found:\n{string.Join("\n", entityIds)}");
|
||||
shell.WriteLine($"{entityIds.Count} entities found:\n{string.Join("\n", entityIds)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,51 +3,51 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class DelayStartCommand : IClientCommand
|
||||
class DelayStartCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "delaystart";
|
||||
public string Description => "Delays the round start.";
|
||||
public string Help => $"Usage: {Command} <seconds>\nPauses/Resumes the countdown if no argument is provided.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "This can only be executed while the game is in the pre-round lobby.");
|
||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
var paused = ticker.TogglePause();
|
||||
shell.SendText(player, paused ? "Paused the countdown." : "Resumed the countdown.");
|
||||
shell.WriteLine(paused ? "Paused the countdown." : "Resumed the countdown.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Need zero or one arguments.");
|
||||
shell.WriteLine("Need zero or one arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!uint.TryParse(args[0], out var seconds) || seconds == 0)
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid amount of seconds.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid amount of seconds.");
|
||||
return;
|
||||
}
|
||||
|
||||
var time = TimeSpan.FromSeconds(seconds);
|
||||
if (!ticker.DelayStart(time))
|
||||
{
|
||||
shell.SendText(player, "An unknown error has occurred.");
|
||||
shell.WriteLine("An unknown error has occurred.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,26 +3,26 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class EndRoundCommand : IClientCommand
|
||||
class EndRoundCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "endround";
|
||||
public string Description => "Ends the round and moves the server to PostRound.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
|
||||
if (ticker.RunLevel != GameRunLevel.InRound)
|
||||
{
|
||||
shell.SendText(player, "This can only be executed while the game is in a round.");
|
||||
shell.WriteLine("This can only be executed while the game is in a round.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,43 +2,43 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class ForcePresetCommand : IClientCommand
|
||||
class ForcePresetCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "forcepreset";
|
||||
public string Description => "Forces a specific game preset to start for the current lobby.";
|
||||
public string Help => $"Usage: {Command} <preset>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "This can only be executed while the game is in the pre-round lobby.");
|
||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Need exactly one argument.");
|
||||
shell.WriteLine("Need exactly one argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
var name = args[0];
|
||||
if (!ticker.TryGetPreset(name, out var type))
|
||||
{
|
||||
shell.SendText(player, $"No preset exists with name {name}.");
|
||||
shell.WriteLine($"No preset exists with name {name}.");
|
||||
return;
|
||||
}
|
||||
|
||||
ticker.SetStartPreset(type, true);
|
||||
shell.SendText(player, $"Forced the game to start with preset {name}.");
|
||||
shell.WriteLine($"Forced the game to start with preset {name}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -13,12 +13,12 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
public class GoLobbyCommand : IClientCommand
|
||||
public class GoLobbyCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "golobby";
|
||||
public string Description => "Enables the lobby and restarts the round.";
|
||||
public string Help => $"Usage: {Command} / {Command} <preset>";
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
Type? preset = null;
|
||||
var presetName = string.Join(" ", args);
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
if (!ticker.TryGetPreset(presetName, out preset))
|
||||
{
|
||||
shell.SendText(player, $"No preset found with name {presetName}");
|
||||
shell.WriteLine($"No preset found with name {presetName}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
ticker.SetStartPreset(preset);
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Enabling the lobby and restarting the round.{(preset == null ? "" : $"\nPreset set to {presetName}")}");
|
||||
shell.WriteLine($"Enabling the lobby and restarting the round.{(preset == null ? "" : $"\nPreset set to {presetName}")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AnyCommand]
|
||||
class JoinGameCommand : IClientCommand
|
||||
class JoinGameCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -23,8 +23,9 @@ namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var output = string.Join(".", args);
|
||||
if (player == null)
|
||||
{
|
||||
@@ -34,7 +35,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
if (ticker.RunLevel == GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "Round has not started.");
|
||||
shell.WriteLine("Round has not started.");
|
||||
return;
|
||||
}
|
||||
else if(ticker.RunLevel == GameRunLevel.InRound)
|
||||
@@ -45,7 +46,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
if(positions.GetValueOrDefault(ID, 0) == 0) //n < 0 is treated as infinite
|
||||
{
|
||||
var jobPrototype = _prototypeManager.Index<JobPrototype>(ID);
|
||||
shell.SendText(player, $"{jobPrototype.Name} has no available slots.");
|
||||
shell.WriteLine($"{jobPrototype.Name} has no available slots.");
|
||||
return;
|
||||
}
|
||||
ticker.MakeJoinGame(player, args[0].ToString());
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Server.Interfaces.Timing;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -11,17 +11,18 @@ using Robust.Shared.Utility;
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server | AdminFlags.Mapping)]
|
||||
class MappingCommand : IClientCommand
|
||||
class MappingCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "mapping";
|
||||
public string Description => "Creates and teleports you to a new uninitialized map for mapping.";
|
||||
public string Help => $"Usage: {Command} <mapname> / {Command} <id> <mapname>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "Only players can use this command");
|
||||
shell.WriteLine("Only players can use this command");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,7 +35,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
case 1:
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "The map name argument cannot be omitted if you have no entity.");
|
||||
shell.WriteLine("The map name argument cannot be omitted if you have no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,7 +45,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
case 2:
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,21 +53,21 @@ namespace Content.Server.Commands.GameTicking
|
||||
mapName = args[1];
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
shell.ExecuteCommand(player, $"addmap {mapId} false");
|
||||
shell.ExecuteCommand(player, $"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true");
|
||||
shell.ExecuteCommand(player, "aghost");
|
||||
shell.ExecuteCommand(player, $"tp 0 0 {mapId}");
|
||||
shell.ExecuteCommand($"addmap {mapId} false");
|
||||
shell.ExecuteCommand($"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true");
|
||||
shell.ExecuteCommand("aghost");
|
||||
shell.ExecuteCommand($"tp 0 0 {mapId}");
|
||||
|
||||
var newGrid = mapManager.GetAllGrids().OrderByDescending(g => (int) g.Index).First();
|
||||
var pauseManager = IoCManager.Resolve<IPauseManager>();
|
||||
|
||||
pauseManager.SetMapPaused(newGrid.ParentMapId, true);
|
||||
|
||||
shell.SendText(player, $"Created unloaded map from file {mapName} with id {mapId}. Use \"savebp {newGrid.Index} foo.yml\" to save the new grid as a map.");
|
||||
shell.WriteLine($"Created unloaded map from file {mapName} with id {mapId}. Use \"savebp {newGrid.Index} foo.yml\" to save the new grid as a map.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
public class NewRoundCommand : IClientCommand
|
||||
public class NewRoundCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "restartround";
|
||||
public string Description => "Moves the server from PostRound to a new PreRoundLobby.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
ticker.RestartRound();
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AnyCommand]
|
||||
class ObserveCommand : IClientCommand
|
||||
class ObserveCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "observe";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
class RespawnCommand : IClientCommand
|
||||
class RespawnCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "respawn";
|
||||
public string Description => "Respawns a player, kicking them back to the lobby.";
|
||||
public string Help => "respawn [player]";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length > 1)
|
||||
{
|
||||
shell.SendText(player, "Must provide <= 1 argument.");
|
||||
shell.WriteLine("Must provide <= 1 argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession)null, "If not a player, an argument must be given.");
|
||||
shell.WriteLine("If not a player, an argument must be given.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +38,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
}
|
||||
else if (!playerMgr.TryGetUserId(args[0], out userId))
|
||||
{
|
||||
shell.SendText(player, "Unknown player");
|
||||
shell.WriteLine("Unknown player");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,13 +46,12 @@ namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
if (!playerMgr.TryGetPlayerData(userId, out var data))
|
||||
{
|
||||
shell.SendText(player, "Unknown player");
|
||||
shell.WriteLine("Unknown player");
|
||||
return;
|
||||
}
|
||||
|
||||
data.ContentData().WipeMind();
|
||||
shell.SendText(player,
|
||||
"Player is not currently online, but they will respawn if they come back online");
|
||||
shell.WriteLine("Player is not currently online, but they will respawn if they come back online");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class SetGamePresetCommand : IClientCommand
|
||||
class SetGamePresetCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "setgamepreset";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Need exactly one argument.");
|
||||
shell.WriteLine("Need exactly one argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,26 +3,26 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class StartRoundCommand : IClientCommand
|
||||
class StartRoundCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "startround";
|
||||
public string Description => "Ends PreRoundLobby state and starts the round.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "This can only be executed while the game is in the pre-round lobby.");
|
||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Components.Transform;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
@@ -12,15 +12,16 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Mapping)]
|
||||
class TileWallsCommand : IClientCommand
|
||||
class TileWallsCommand : IConsoleCommand
|
||||
{
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
public string Command => "tilewalls";
|
||||
public string Description => "Puts an underplating tile below every wall on a grid.";
|
||||
public string Help => $"Usage: {Command} <gridId> | {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
GridId gridId;
|
||||
|
||||
switch (args.Length)
|
||||
@@ -28,7 +29,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
case 0:
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Only a player can run this command.");
|
||||
shell.WriteLine("Only a player can run this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,28 +38,28 @@ namespace Content.Server.Commands.GameTicking
|
||||
case 1:
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = new GridId(id);
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
{
|
||||
shell.SendText(player, $"No grid exists with id {gridId}");
|
||||
shell.WriteLine($"No grid exists with id {gridId}");
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||
{
|
||||
shell.SendText(player, $"Grid {gridId} doesn't have an associated grid entity.");
|
||||
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
changed++;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Changed {changed} tiles.");
|
||||
shell.WriteLine($"Changed {changed} tiles.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class ToggleDisallowLateJoinCommand : IClientCommand
|
||||
class ToggleDisallowLateJoinCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "toggledisallowlatejoin";
|
||||
public string Description => "Allows or disallows latejoining during mid-game.";
|
||||
public string Help => $"Usage: {Command} <disallow>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Need exactly one argument.");
|
||||
shell.WriteLine("Need exactly one argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace Content.Server.Commands.GameTicking
|
||||
if (bool.TryParse(args[0], out var result))
|
||||
{
|
||||
ticker.ToggleDisallowLateJoin(bool.Parse(args[0]));
|
||||
shell.SendText(player, result ? "Late joining has been disabled." : "Late joining has been enabled.");
|
||||
shell.WriteLine(result ? "Late joining has been disabled." : "Late joining has been enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Invalid argument.");
|
||||
shell.WriteLine("Invalid argument.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AnyCommand]
|
||||
class ToggleReadyCommand : IClientCommand
|
||||
class ToggleReadyCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "toggleready";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class HideContainedContextCommand : IClientCommand
|
||||
public class HideContainedContextCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "hidecontainedcontext";
|
||||
public string Description => $"Reverts the effects of {ShowContainedContextCommand.CommandName}";
|
||||
public string Help => $"{Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You need to be a player to use this command.");
|
||||
shell.WriteLine("You need to be a player to use this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Nutrition;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class Hungry : IClientCommand
|
||||
public class Hungry : IConsoleCommand
|
||||
{
|
||||
public string Command => "hungry";
|
||||
public string Description => "Makes you hungry.";
|
||||
public string Help => $"{Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot use this command unless you are a player.");
|
||||
shell.WriteLine("You cannot use this command unless you are a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot use this command without an entity.");
|
||||
shell.WriteLine("You cannot use this command without an entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.AttachedEntity.TryGetComponent(out HungerComponent? hunger))
|
||||
{
|
||||
shell.SendText(player, $"Your entity does not have a {nameof(HungerComponent)} component.");
|
||||
shell.WriteLine($"Your entity does not have a {nameof(HungerComponent)} component.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
@@ -6,8 +6,8 @@ using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -15,7 +15,7 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
class HurtCommand : IClientCommand
|
||||
class HurtCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "hurt";
|
||||
public string Description => "Ouch";
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (playerEntity == null)
|
||||
{
|
||||
shell.SendText(player, $"You must have a player entity to use this command without specifying an entity.\n{Help}");
|
||||
shell.WriteLine($"You must have a player entity to use this command without specifying an entity.\n{Help}");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (!EntityUid.TryParse(arg, out var entityUid))
|
||||
{
|
||||
shell.SendText(player, $"{arg} is not a valid entity uid.\n{Help}");
|
||||
shell.WriteLine($"{arg} is not a valid entity uid.\n{Help}");
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (!entityManager.TryGetEntity(entityUid, out var parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity found with uid {entityUid}");
|
||||
shell.WriteLine($"No entity found with uid {entityUid}");
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace Content.Server.Commands
|
||||
{
|
||||
if (!int.TryParse(args[1], out var amount))
|
||||
{
|
||||
shell.SendText(player, $"{args[1]} is not a valid damage integer.");
|
||||
shell.WriteLine($"{args[1]} is not a valid damage integer.");
|
||||
|
||||
func = null;
|
||||
return false;
|
||||
@@ -101,20 +101,19 @@ namespace Content.Server.Commands
|
||||
{
|
||||
if (!damageable.DamageClasses.ContainsKey(damageClass))
|
||||
{
|
||||
shell.SendText(player, $"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} can not be damaged with damage class {damageClass}");
|
||||
shell.WriteLine($"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} can not be damaged with damage class {damageClass}");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!damageable.ChangeDamage(damageClass, amount, ignoreResistances))
|
||||
{
|
||||
shell.SendText(player, $"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} received no damage.");
|
||||
shell.WriteLine($"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} received no damage.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
shell.SendText(player,
|
||||
$"Damaged entity {damageable.Owner.Name} with id {damageable.Owner.Uid} for {amount} {damageClass} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
shell.WriteLine($"Damaged entity {damageable.Owner.Name} with id {damageable.Owner.Uid} for {amount} {damageClass} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
};
|
||||
|
||||
return true;
|
||||
@@ -126,37 +125,38 @@ namespace Content.Server.Commands
|
||||
{
|
||||
if (!damageable.DamageTypes.ContainsKey(damageType))
|
||||
{
|
||||
shell.SendText(player, $"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} can not be damaged with damage class {damageType}");
|
||||
shell.WriteLine($"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} can not be damaged with damage class {damageType}");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!damageable.ChangeDamage(damageType, amount, ignoreResistances))
|
||||
{
|
||||
shell.SendText(player, $"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} received no damage.");
|
||||
shell.WriteLine($"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} received no damage.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Damaged entity {damageable.Owner.Name} with id {damageable.Owner.Uid} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
shell.WriteLine($"Damaged entity {damageable.Owner.Name} with id {damageable.Owner.Uid} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid damage class or type.");
|
||||
shell.WriteLine($"{args[0]} is not a valid damage class or type.");
|
||||
|
||||
var types = DamageTypes();
|
||||
shell.SendText(player, types);
|
||||
shell.WriteLine(types);
|
||||
|
||||
func = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
bool ignoreResistances;
|
||||
IEntity entity;
|
||||
Damage? damageFunc;
|
||||
@@ -172,12 +172,12 @@ namespace Content.Server.Commands
|
||||
types = types.Replace('e', 'é');
|
||||
}
|
||||
|
||||
shell.SendText(player, types);
|
||||
shell.WriteLine(types);
|
||||
|
||||
return;
|
||||
// Not enough args
|
||||
case var n when n < 2:
|
||||
shell.SendText(player, $"Invalid number of arguments ({args.Length}).\n{Help}");
|
||||
shell.WriteLine($"Invalid number of arguments ({args.Length}).\n{Help}");
|
||||
return;
|
||||
case var n when n >= 2 && n <= 4:
|
||||
if (!TryParseDamageArgs(shell, player, args, out damageFunc))
|
||||
@@ -198,7 +198,7 @@ namespace Content.Server.Commands
|
||||
{
|
||||
if (!bool.TryParse(args[3], out ignoreResistances))
|
||||
{
|
||||
shell.SendText(player, $"{args[3]} is not a valid boolean value for ignoreResistances.\n{Help}");
|
||||
shell.WriteLine($"{args[3]} is not a valid boolean value for ignoreResistances.\n{Help}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -209,13 +209,13 @@ namespace Content.Server.Commands
|
||||
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, $"Invalid amount of arguments ({args.Length}).\n{Help}");
|
||||
shell.WriteLine($"Invalid amount of arguments ({args.Length}).\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.TryGetComponent(out IDamageableComponent? damageable))
|
||||
{
|
||||
shell.SendText(player, $"Entity {entity.Name} with id {entity.Uid} does not have a {nameof(IDamageableComponent)}.");
|
||||
shell.WriteLine($"Entity {entity.Name} with id {entity.Uid} does not have a {nameof(IDamageableComponent)}.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Interactable
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
class AnchorCommand : IClientCommand
|
||||
class AnchorCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "anchor";
|
||||
public string Description => "Anchors all entities in a radius around the user";
|
||||
public string Help => $"Usage: {Command} <radius>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
return;
|
||||
@@ -26,19 +27,19 @@ namespace Content.Server.Commands.Interactable
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var radius))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid integer.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
shell.SendText(player, "Radius must be positive.");
|
||||
shell.WriteLine("Radius must be positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -15,14 +15,15 @@ namespace Content.Server.Commands.Interactable
|
||||
/// <see cref="TilePryingComponent.TryPryTile"/>
|
||||
/// </summary>
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
class TilePryCommand : IClientCommand
|
||||
class TilePryCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "tilepry";
|
||||
public string Description => "Pries up all tiles in a radius around the user.";
|
||||
public string Help => $"Usage: {Command} <radius>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
return;
|
||||
@@ -30,19 +31,19 @@ namespace Content.Server.Commands.Interactable
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var radius))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid integer.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
shell.SendText(player, "Radius must be positive.");
|
||||
shell.WriteLine("Radius must be positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Interactable
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
class UnAnchorCommand : IClientCommand
|
||||
class UnAnchorCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "unanchor";
|
||||
public string Description => "Unanchors all anchorable entities in a radius around the user";
|
||||
public string Help => $"Usage: {Command} <radius>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
return;
|
||||
@@ -26,19 +27,19 @@ namespace Content.Server.Commands.Interactable
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var radius))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid integer.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
shell.SendText(player, "Radius must be positive.");
|
||||
shell.WriteLine("Radius must be positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.MachineLinking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SignalLinkerCommand : IClientCommand
|
||||
public class SignalLinkerCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "signallink";
|
||||
|
||||
@@ -17,8 +17,9 @@ namespace Content.Server.Commands.MachineLinking
|
||||
|
||||
public string Help => "signallink (on/off)";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
bool? enable = null;
|
||||
if (args.Length > 0)
|
||||
{
|
||||
@@ -43,7 +44,7 @@ namespace Content.Server.Commands.MachineLinking
|
||||
}
|
||||
|
||||
var ret = system.SignalLinkerKeybind(player.UserId, enable);
|
||||
shell.SendText(player, ret ? "Enabled" : "Disabled");
|
||||
shell.WriteLine(ret ? "Enabled" : "Disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,23 +12,23 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class MakeSentientCommand : IClientCommand
|
||||
public class MakeSentientCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "makesentient";
|
||||
public string Description => "Makes an entity sentient (able to be controlled by a player)";
|
||||
public string Help => "makesentient <entity id>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Wrong number of arguments.");
|
||||
shell.WriteLine("Wrong number of arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, "Invalid argument.");
|
||||
shell.WriteLine("Invalid argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (!entityManager.TryGetEntity(entId, out var entity) || entity.Deleted)
|
||||
{
|
||||
shell.SendText(player, "Invalid entity specified!");
|
||||
shell.WriteLine("Invalid entity specified!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ using Content.Server.Mobs.Roles;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Commands.Mobs
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class AddRoleCommand : IClientCommand
|
||||
public class AddRoleCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Content.Server.Commands.Mobs
|
||||
|
||||
public string Help => "addrole <session ID> <Role Type>\nThat role type is the actual C# type name.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly 2 arguments.");
|
||||
shell.WriteLine("Expected exactly 2 arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Commands.Mobs
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Can't find that mind");
|
||||
shell.WriteLine("Can't find that mind");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Mobs
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class MindInfoCommand : IClientCommand
|
||||
public class MindInfoCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "mindinfo";
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace Content.Server.Commands.Mobs
|
||||
|
||||
public string Help => "mindinfo <session ID>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly 1 argument.");
|
||||
shell.WriteLine("Expected exactly 1 argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace Content.Server.Commands.Mobs
|
||||
builder.AppendFormat("{0} ", role.Name);
|
||||
}
|
||||
|
||||
shell.SendText(player, builder.ToString());
|
||||
shell.WriteLine(builder.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Can't find that mind");
|
||||
shell.WriteLine("Can't find that mind");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ using Content.Server.Mobs.Roles;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Commands.Mobs
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class RemoveRoleCommand : IClientCommand
|
||||
public class RemoveRoleCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Content.Server.Commands.Mobs
|
||||
|
||||
public string Help => "rmrole <session ID> <Role Type>\nThat role type is the actual C# type name.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly 2 arguments.");
|
||||
shell.WriteLine("Expected exactly 2 arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Commands.Mobs
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Can't find that mind");
|
||||
shell.WriteLine("Can't find that mind");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -10,13 +10,13 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands.Notify
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class PopupMsgCommand : IClientCommand
|
||||
public class PopupMsgCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "srvpopupmsg";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var entityMgr = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
|
||||
@@ -3,31 +3,31 @@ using Content.Server.Administration;
|
||||
using Content.Server.Objectives;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Commands.Objectives
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class AddObjectiveCommand : IClientCommand
|
||||
public class AddObjectiveCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addobjective";
|
||||
public string Description => "Adds an objective to the player's mind.";
|
||||
public string Help => "addobjective <username> <objectiveID>";
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly 2 arguments.");
|
||||
shell.WriteLine("Expected exactly 2 arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
var mgr = IoCManager.Resolve<IPlayerManager>();
|
||||
if (!mgr.TryGetPlayerDataByUsername(args[0], out var data))
|
||||
{
|
||||
shell.SendText(player, "Can't find the playerdata.");
|
||||
shell.WriteLine("Can't find the playerdata.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,20 +35,20 @@ namespace Content.Server.Commands.Objectives
|
||||
var mind = data.ContentData()?.Mind;
|
||||
if (mind == null)
|
||||
{
|
||||
shell.SendText(player, "Can't find the mind.");
|
||||
shell.WriteLine("Can't find the mind.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IPrototypeManager>()
|
||||
.TryIndex<ObjectivePrototype>(args[1], out var objectivePrototype))
|
||||
{
|
||||
shell.SendText(player, $"Can't find matching ObjectivePrototype {objectivePrototype}");
|
||||
shell.WriteLine($"Can't find matching ObjectivePrototype {objectivePrototype}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mind.TryAddObjective(objectivePrototype))
|
||||
{
|
||||
shell.SendText(player, "Objective requirements dont allow that objective to be added.");
|
||||
shell.WriteLine("Objective requirements dont allow that objective to be added.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user