diff --git a/Content.Client/Chat/ChatManager.cs b/Content.Client/Chat/ChatManager.cs index 96910110f8..490bdd7a0c 100644 --- a/Content.Client/Chat/ChatManager.cs +++ b/Content.Client/Chat/ChatManager.cs @@ -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; } } diff --git a/Content.Client/ClientNotifyManager.cs b/Content.Client/ClientNotifyManager.cs index 847417aac5..818c0829b1 100644 --- a/Content.Client/ClientNotifyManager.cs +++ b/Content.Client/ClientNotifyManager.cs @@ -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(); mgr.PopupMessage(arg); - return false; } } } diff --git a/Content.Client/Commands/AtmosDebugCommands.cs b/Content.Client/Commands/AtmosDebugCommands.cs index 823d1183e7..10f6856f01 100644 --- a/Content.Client/Commands/AtmosDebugCommands.cs +++ b/Content.Client/Commands/AtmosDebugCommands.cs @@ -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 "; - 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(); 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 []"; - 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(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 "; - 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(); sys.CfgCBM = xFlag; - return false; } } } diff --git a/Content.Client/Commands/CreditsCommand.cs b/Content.Client/Commands/CreditsCommand.cs index 47643b11ac..f3fa57e85e 100644 --- a/Content.Client/Commands/CreditsCommand.cs +++ b/Content.Client/Commands/CreditsCommand.cs @@ -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; } } } diff --git a/Content.Client/Commands/DebugAiCommand.cs b/Content.Client/Commands/DebugAiCommand.cs index 065da01bab..ddaadc153d 100644 --- a/Content.Client/Commands/DebugAiCommand.cs +++ b/Content.Client/Commands/DebugAiCommand.cs @@ -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 } } diff --git a/Content.Client/Commands/DebugCommands.cs b/Content.Client/Commands/DebugCommands.cs index aa9eef2a94..0ea5efc6c7 100644 --- a/Content.Client/Commands/DebugCommands.cs +++ b/Content.Client/Commands/DebugCommands.cs @@ -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() .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() .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() .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 "; - 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(); 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} / {Command} "; - 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()); + shell.ConsoleHost.RegisteredCommands["showsubfloorforever"].Execute(shell, string.Empty, Array.Empty()); - return true; + shell.RemoteExecuteCommand(argStr); } } } diff --git a/Content.Client/Commands/DebugPathfindingCommand.cs b/Content.Client/Commands/DebugPathfindingCommand.cs index 9c79bec8e7..0d6135abbb 100644 --- a/Content.Client/Commands/DebugPathfindingCommand.cs +++ b/Content.Client/Commands/DebugPathfindingCommand.cs @@ -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 } } diff --git a/Content.Client/Commands/HideMechanismsCommand.cs b/Content.Client/Commands/HideMechanismsCommand.cs index 7570055038..9e7bde255c 100644 --- a/Content.Client/Commands/HideMechanismsCommand.cs +++ b/Content.Client/Commands/HideMechanismsCommand.cs @@ -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(); var mechanisms = componentManager.EntityQuery(); @@ -41,9 +41,7 @@ namespace Content.Client.Commands } } - IoCManager.Resolve().ProcessCommand("hidecontainedcontext"); - - return false; + IoCManager.Resolve().ExecuteCommand("hidecontainedcontext"); } } } diff --git a/Content.Client/Commands/ShowMechanismsCommand.cs b/Content.Client/Commands/ShowMechanismsCommand.cs index 86e18c33a9..fe0381a3c6 100644 --- a/Content.Client/Commands/ShowMechanismsCommand.cs +++ b/Content.Client/Commands/ShowMechanismsCommand.cs @@ -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(); var mechanisms = componentManager.EntityQuery(); @@ -29,9 +29,7 @@ namespace Content.Client.Commands } } - IoCManager.Resolve().ProcessCommand("showcontainedcontext"); - - return false; + IoCManager.Resolve().ExecuteCommand("showcontainedcontext"); } } } diff --git a/Content.Client/Commands/ToggleOutlineCommand.cs b/Content.Client/Commands/ToggleOutlineCommand.cs index ca96762eac..af7aa9e80e 100644 --- a/Content.Client/Commands/ToggleOutlineCommand.cs +++ b/Content.Client/Commands/ToggleOutlineCommand.cs @@ -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(); 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)}"); } } } diff --git a/Content.Client/EscapeMenuOwner.cs b/Content.Client/EscapeMenuOwner.cs index b57a67653d..1f8de2f5b6 100644 --- a/Content.Client/EscapeMenuOwner.cs +++ b/Content.Client/EscapeMenuOwner.cs @@ -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; diff --git a/Content.Client/Sandbox/SandboxManager.cs b/Content.Client/Sandbox/SandboxManager.cs index a7a79fe884..aa91bb7264 100644 --- a/Content.Client/Sandbox/SandboxManager.cs +++ b/Content.Client/Sandbox/SandboxManager.cs @@ -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"); } } } diff --git a/Content.Client/State/LobbyState.cs b/Content.Client/State/LobbyState.cs index 866c65c463..6b6ae5d6bf 100644 --- a/Content.Client/State/LobbyState.cs +++ b/Content.Client/State/LobbyState.cs @@ -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(); } } diff --git a/Content.Client/UserInterface/AdminMenu/AdminMenuWindow.cs b/Content.Client/UserInterface/AdminMenu/AdminMenuWindow.cs index c166d2e0d0..56331156ef 100644 --- a/Content.Client/UserInterface/AdminMenu/AdminMenuWindow.cs +++ b/Content.Client/UserInterface/AdminMenu/AdminMenuWindow.cs @@ -440,7 +440,7 @@ namespace Content.Client.UserInterface.AdminMenu public override void ButtonPressed(ButtonEventArgs args) { - IoCManager.Resolve().ProcessCommand(RequiredCommand); + IoCManager.Resolve().ExecuteCommand(RequiredCommand); } } #endregion @@ -504,7 +504,7 @@ namespace Content.Client.UserInterface.AdminMenu Name = "Pause", Handler = () => { - IoCManager.Resolve().ProcessCommand("events pause"); + IoCManager.Resolve().ExecuteCommand("events pause"); }, }, new CommandUIButton @@ -512,14 +512,14 @@ namespace Content.Client.UserInterface.AdminMenu Name = "Resume", Handler = () => { - IoCManager.Resolve().ProcessCommand("events resume"); + IoCManager.Resolve().ExecuteCommand("events resume"); }, }, }; public override void Submit() { - IoCManager.Resolve().ProcessCommand($"events run \"{_eventsDropDown.GetValue()}\""); + IoCManager.Resolve().ExecuteCommand($"events run \"{_eventsDropDown.GetValue()}\""); } } @@ -548,7 +548,7 @@ namespace Content.Client.UserInterface.AdminMenu public override void Submit() { - IoCManager.Resolve().ProcessCommand($"kick \"{_playerDropDown.GetValue()}\" \"{CommandParsing.Escape(_reason.GetValue())}\""); + IoCManager.Resolve().ExecuteCommand($"kick \"{_playerDropDown.GetValue()}\" \"{CommandParsing.Escape(_reason.GetValue())}\""); } } @@ -572,7 +572,7 @@ namespace Content.Client.UserInterface.AdminMenu public override void Submit() { - IoCManager.Resolve().ProcessCommand($"tpto \"{_playerDropDown.GetValue()}\""); + IoCManager.Resolve().ExecuteCommand($"tpto \"{_playerDropDown.GetValue()}\""); } } @@ -596,7 +596,7 @@ namespace Content.Client.UserInterface.AdminMenu public override void Submit() { - IoCManager.Resolve().ProcessCommand($"addatmos {_grid.GetValue()}"); + IoCManager.Resolve().ExecuteCommand($"addatmos {_grid.GetValue()}"); } } @@ -639,7 +639,7 @@ namespace Content.Client.UserInterface.AdminMenu public override void Submit() { - IoCManager.Resolve().ProcessCommand($"fillgas {_grid.GetValue()} {_gas.GetValue()} {_amount.GetValue()}"); + IoCManager.Resolve().ExecuteCommand($"fillgas {_grid.GetValue()} {_gas.GetValue()} {_amount.GetValue()}"); } } #endregion diff --git a/Content.Client/UserInterface/AdminMenu/SetOutfit/SetOutfitMenu.xaml.cs b/Content.Client/UserInterface/AdminMenu/SetOutfit/SetOutfitMenu.xaml.cs index 0f1fba1fbf..9590db8768 100644 --- a/Content.Client/UserInterface/AdminMenu/SetOutfit/SetOutfitMenu.xaml.cs +++ b/Content.Client/UserInterface/AdminMenu/SetOutfit/SetOutfitMenu.xaml.cs @@ -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(); } diff --git a/Content.Client/UserInterface/EscapeMenu.cs b/Content.Client/UserInterface/EscapeMenu.cs index 25c8dc85c6..ec346d7522 100644 --- a/Content.Client/UserInterface/EscapeMenu.cs +++ b/Content.Client/UserInterface/EscapeMenu.cs @@ -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(); } diff --git a/Content.Client/UserInterface/LateJoinGui.cs b/Content.Client/UserInterface/LateJoinGui.cs index c1449ceb11..f4bbc7ecef 100644 --- a/Content.Client/UserInterface/LateJoinGui.cs +++ b/Content.Client/UserInterface/LateJoinGui.cs @@ -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(); }; diff --git a/Content.IntegrationTests/DummyGameTicker.cs b/Content.IntegrationTests/DummyGameTicker.cs index 9a98794513..8b8ea88887 100644 --- a/Content.IntegrationTests/DummyGameTicker.cs +++ b/Content.IntegrationTests/DummyGameTicker.cs @@ -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; diff --git a/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs b/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs index bd1484508e..e978f10629 100644 --- a/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs +++ b/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs @@ -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()); if (lobbyEnabled) { diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/CuffUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/CuffUnitTest.cs index 96105a3c24..2259df9c43 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/CuffUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/CuffUnitTest.cs @@ -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(); - shell.ExecuteCommand($"addhand {to.Uid}"); + var host = IoCManager.Resolve(); + host.ExecuteCommand(null, $"addhand {to.Uid}"); } } } diff --git a/Content.IntegrationTests/Tests/Networking/ReconnectTest.cs b/Content.IntegrationTests/Tests/Networking/ReconnectTest.cs index aea01d41c5..780dd49f02 100644 --- a/Content.IntegrationTests/Tests/Networking/ReconnectTest.cs +++ b/Content.IntegrationTests/Tests/Networking/ReconnectTest.cs @@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests.Networking await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); - await client.WaitPost(() => IoCManager.Resolve().ProcessCommand("disconnect")); + await client.WaitPost(() => IoCManager.Resolve().ExecuteCommand("disconnect")); // Run some ticks for the disconnect to complete and such. await RunTicksSync(client, server, 5); diff --git a/Content.Server/Administration/AdminCommandAttribute.cs b/Content.Server/Administration/AdminCommandAttribute.cs index 79ae7fc769..0c9730df82 100644 --- a/Content.Server/Administration/AdminCommandAttribute.cs +++ b/Content.Server/Administration/AdminCommandAttribute.cs @@ -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 /// /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] - [BaseTypeRequired(typeof(IClientCommand))] + [BaseTypeRequired(typeof(IConsoleCommand))] [MeansImplicitUse] public sealed class AdminCommandAttribute : Attribute { diff --git a/Content.Server/Administration/AdminManager.cs b/Content.Server/Administration/AdminManager.cs index 4ca81c52fc..c66d4163d1 100644 --- a/Content.Server/Administration/AdminManager.cs +++ b/Content.Server/Administration/AdminManager.cs @@ -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 _admins = new(); @@ -171,7 +171,7 @@ namespace Content.Server.Administration _netMgr.RegisterNetMessage(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))) diff --git a/Content.Server/Administration/AnyCommandAttribute.cs b/Content.Server/Administration/AnyCommandAttribute.cs index ab9895f728..0185cff723 100644 --- a/Content.Server/Administration/AnyCommandAttribute.cs +++ b/Content.Server/Administration/AnyCommandAttribute.cs @@ -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 /// /// [AttributeUsage(AttributeTargets.Class)] - [BaseTypeRequired(typeof(IClientCommand))] + [BaseTypeRequired(typeof(IConsoleCommand))] [MeansImplicitUse] public sealed class AnyCommandAttribute : Attribute { diff --git a/Content.Server/Administration/Commands/AGhost.cs b/Content.Server/Administration/Commands/AGhost.cs index eddc879dde..7d7bd0720f 100644 --- a/Content.Server/Administration/Commands/AGhost.cs +++ b/Content.Server/Administration/Commands/AGhost.cs @@ -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; } diff --git a/Content.Server/Administration/Commands/BanCommand.cs b/Content.Server/Administration/Commands/BanCommand.cs index f542d1c0c2..3d906be036 100644 --- a/Content.Server/Administration/Commands/BanCommand.cs +++ b/Content.Server/Administration/Commands/BanCommand.cs @@ -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: "; - 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(); var dbMan = IoCManager.Resolve(); @@ -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; } diff --git a/Content.Server/Administration/Commands/ControlMob.cs b/Content.Server/Administration/Commands/ControlMob.cs index 1e979e633a..2e830269df 100644 --- a/Content.Server/Administration/Commands/ControlMob.cs +++ b/Content.Server/Administration/Commands/ControlMob.cs @@ -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 ."); - 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; } diff --git a/Content.Server/Administration/Commands/DSay.cs b/Content.Server/Administration/Commands/DSay.cs index 40bf93b5b5..b2a1d021af 100644 --- a/Content.Server/Administration/Commands/DSay.cs +++ b/Content.Server/Administration/Commands/DSay.cs @@ -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} "); - 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; } diff --git a/Content.Server/Administration/Commands/DeAdminCommand.cs b/Content.Server/Administration/Commands/DeAdminCommand.cs index 81a61194cf..057d942218 100644 --- a/Content.Server/Administration/Commands/DeAdminCommand.cs +++ b/Content.Server/Administration/Commands/DeAdminCommand.cs @@ -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; } diff --git a/Content.Server/Administration/Commands/DeleteComponent.cs b/Content.Server/Administration/Commands/DeleteComponent.cs index 2fbeb0ce91..8a6777d7fc 100644 --- a/Content.Server/Administration/Commands/DeleteComponent.cs +++ b/Content.Server/Administration/Commands/DeleteComponent.cs @@ -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} "; - 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; } diff --git a/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs b/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs index f87bd7a99b..c8849b1e2b 100644 --- a/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs +++ b/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs @@ -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)); } } } diff --git a/Content.Server/Administration/Commands/DeleteEntitiesWithId.cs b/Content.Server/Administration/Commands/DeleteEntitiesWithId.cs index d7ff635c10..8ff64ce231 100644 --- a/Content.Server/Administration/Commands/DeleteEntitiesWithId.cs +++ b/Content.Server/Administration/Commands/DeleteEntitiesWithId.cs @@ -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} "; - 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}"); } } } diff --git a/Content.Server/Administration/Commands/ExplosionCommand.cs b/Content.Server/Administration/Commands/ExplosionCommand.cs index 768f01b8d5..eef777b895 100644 --- a/Content.Server/Administration/Commands/ExplosionCommand.cs +++ b/Content.Server/Administration/Commands/ExplosionCommand.cs @@ -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 \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; } diff --git a/Content.Server/Administration/Commands/OpenPermissionsCommand.cs b/Content.Server/Administration/Commands/OpenPermissionsCommand.cs index 093a10733a..eeb8551f0a 100644 --- a/Content.Server/Administration/Commands/OpenPermissionsCommand.cs +++ b/Content.Server/Administration/Commands/OpenPermissionsCommand.cs @@ -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; } diff --git a/Content.Server/Administration/Commands/PromoteHostCommand.cs b/Content.Server/Administration/Commands/PromoteHostCommand.cs index 058557fa14..b81efefb04 100644 --- a/Content.Server/Administration/Commands/PromoteHostCommand.cs +++ b/Content.Server/Administration/Commands/PromoteHostCommand.cs @@ -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 "; - 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(); 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; } diff --git a/Content.Server/Administration/Commands/ReAdminCommand.cs b/Content.Server/Administration/Commands/ReAdminCommand.cs index 8f78442689..100bdf92ef 100644 --- a/Content.Server/Administration/Commands/ReAdminCommand.cs +++ b/Content.Server/Administration/Commands/ReAdminCommand.cs @@ -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; } diff --git a/Content.Server/Administration/Commands/ReadyAll.cs b/Content.Server/Administration/Commands/ReadyAll.cs index ec703bb5b7..f37ef7c7dd 100644 --- a/Content.Server/Administration/Commands/ReadyAll.cs +++ b/Content.Server/Administration/Commands/ReadyAll.cs @@ -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} "; - 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; } diff --git a/Content.Server/Administration/Commands/Rejuvenate.cs b/Content.Server/Administration/Commands/Rejuvenate.cs index 69c79a36b8..7134e5d590 100644 --- a/Content.Server/Administration/Commands/Rejuvenate.cs +++ b/Content.Server/Administration/Commands/Rejuvenate.cs @@ -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); diff --git a/Content.Server/Administration/Commands/SetOutfitCommand.cs b/Content.Server/Administration/Commands/SetOutfitCommand.cs index f6e0b2b064..ea6b84bc8a 100644 --- a/Content.Server/Administration/Commands/SetOutfitCommand.cs +++ b/Content.Server/Administration/Commands/SetOutfitCommand.cs @@ -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} | {0} ", 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(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(); 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(); if (!prototypeManager.TryIndex(args[1], out var startingGear)) { - shell.SendText(player, Loc.GetString("Invalid outfit id")); + shell.WriteLine(Loc.GetString("Invalid outfit id")); return; } diff --git a/Content.Server/Administration/Commands/WarpCommand.cs b/Content.Server/Administration/Commands/WarpCommand.cs index 6e48b9637d..a8972487b7 100644 --- a/Content.Server/Administration/Commands/WarpCommand.cs +++ b/Content.Server/Administration/Commands/WarpCommand.cs @@ -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 \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!"); } } } diff --git a/Content.Server/Commands/AI/AddAiCommand.cs b/Content.Server/Commands/AI/AddAiCommand.cs index 395bae79bf..184341fc1f 100644 --- a/Content.Server/Commands/AI/AddAiCommand.cs +++ b/Content.Server/Commands/AI/AddAiCommand.cs @@ -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()) { - 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(); comp.LogicName = processorId; - shell.SendText(player, "AI component added."); + shell.WriteLine("AI component added."); } } } diff --git a/Content.Server/Commands/AI/FactionCommand.cs b/Content.Server/Commands/AI/FactionCommand.cs index ae0107ff62..a040c082a3 100644 --- a/Content.Server/Commands/AI/FactionCommand.cs +++ b/Content.Server/Commands/AI/FactionCommand.cs @@ -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 target\n" + "faction 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().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().MakeHostile(faction, targetFaction); - shell.SendText(player, Loc.GetString("Command successful")); + shell.WriteLine(Loc.GetString("Command successful")); break; case "list": - shell.SendText(player, EntitySystem.Get().GetHostileFactions(faction).ToString()); + shell.WriteLine(EntitySystem.Get().GetHostileFactions(faction).ToString()); break; default: - shell.SendText(player, Loc.GetString("Unknown faction arg")); + shell.WriteLine(Loc.GetString("Unknown faction arg")); break; } diff --git a/Content.Server/Commands/Actions/CooldownAction.cs b/Content.Server/Commands/Actions/CooldownAction.cs index 15c9b9a903..7c8367af09 100644 --- a/Content.Server/Commands/Actions/CooldownAction.cs +++ b/Content.Server/Commands/Actions/CooldownAction.cs @@ -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 "; - 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,29 +32,29 @@ 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(actionTypeRaw, out var actionType)) { - shell.SendText(player, "unrecognized ActionType enum value, please" + - " ensure you used correct casing: " + actionTypeRaw); + shell.WriteLine("unrecognized ActionType enum value, please" + + " ensure you used correct casing: " + actionTypeRaw); return; } var actionMgr = IoCManager.Resolve(); if (!actionMgr.TryGet(actionType, out var action)) { - shell.SendText(player, "unrecognized actionType " + actionType); + shell.WriteLine("unrecognized actionType " + actionType); return; } var cooldownStart = IoCManager.Resolve().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; } diff --git a/Content.Server/Commands/Actions/GrantAction.cs b/Content.Server/Commands/Actions/GrantAction.cs index fd2cd3d6b8..a6bb3f410b 100644 --- a/Content.Server/Commands/Actions/GrantAction.cs +++ b/Content.Server/Commands/Actions/GrantAction.cs @@ -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 "; - 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(actionTypeRaw, out var actionType)) { - shell.SendText(player, "unrecognized ActionType enum value, please" + - " ensure you used correct casing: " + actionTypeRaw); + shell.WriteLine("unrecognized ActionType enum value, please" + + " ensure you used correct casing: " + actionTypeRaw); return; } var actionMgr = IoCManager.Resolve(); if (!actionMgr.TryGet(actionType, out var action)) { - shell.SendText(player, "unrecognized actionType " + actionType); + shell.WriteLine("unrecognized actionType " + actionType); return; } actionsComponent.Grant(action.ActionType); diff --git a/Content.Server/Commands/Actions/RevokeAction.cs b/Content.Server/Commands/Actions/RevokeAction.cs index be7ca6082d..78a0d0cae3 100644 --- a/Content.Server/Commands/Actions/RevokeAction.cs +++ b/Content.Server/Commands/Actions/RevokeAction.cs @@ -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 "; - 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(actionTypeRaw, out var actionType)) { - shell.SendText(player, "unrecognized ActionType enum value, please" + - " ensure you used correct casing: " + actionTypeRaw); + shell.WriteLine("unrecognized ActionType enum value, please" + + " ensure you used correct casing: " + actionTypeRaw); return; } var actionMgr = IoCManager.Resolve(); if (!actionMgr.TryGet(actionType, out var action)) { - shell.SendText(player, "unrecognized actionType " + actionType); + shell.WriteLine("unrecognized actionType " + actionType); return; } diff --git a/Content.Server/Commands/Alerts/ClearAlert.cs b/Content.Server/Commands/Alerts/ClearAlert.cs index c8fabad81c..761f08b7c6 100644 --- a/Content.Server/Commands/Alerts/ClearAlert.cs +++ b/Content.Server/Commands/Alerts/ClearAlert.cs @@ -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 "; - 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(); if (!alertMgr.TryGet(Enum.Parse(alertType), out var alert)) { - shell.SendText(player, "unrecognized alertType " + alertType); + shell.WriteLine("unrecognized alertType " + alertType); return; } diff --git a/Content.Server/Commands/Alerts/ShowAlert.cs b/Content.Server/Commands/Alerts/ShowAlert.cs index 20a08cc809..2381c14fa3 100644 --- a/Content.Server/Commands/Alerts/ShowAlert.cs +++ b/Content.Server/Commands/Alerts/ShowAlert.cs @@ -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 "; - 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(); if (!alertMgr.TryGet(Enum.Parse(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); diff --git a/Content.Server/Commands/Atmos/AddAtmosCommand.cs b/Content.Server/Commands/Atmos/AddAtmosCommand.cs index 48298d0641..e2e1c2322c 100644 --- a/Content.Server/Commands/Atmos/AddAtmosCommand.cs +++ b/Content.Server/Commands/Atmos/AddAtmosCommand.cs @@ -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} "; - 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()) { - shell.SendText(player, "Grid already has an atmosphere."); + shell.WriteLine("Grid already has an atmosphere."); return; } grid.AddComponent(); - shell.SendText(player, $"Added atmosphere to grid {id}."); + shell.WriteLine($"Added atmosphere to grid {id}."); } } } diff --git a/Content.Server/Commands/Atmos/AddGasCommand.cs b/Content.Server/Commands/Atmos/AddGasCommand.cs index 73c3ab28a1..a73d005137 100644 --- a/Content.Server/Commands/Atmos/AddGasCommand.cs +++ b/Content.Server/Commands/Atmos/AddGasCommand.cs @@ -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 "; - 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()) { - 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; } diff --git a/Content.Server/Commands/Atmos/AddUnsimulatedAtmosCommand.cs b/Content.Server/Commands/Atmos/AddUnsimulatedAtmosCommand.cs index 9b39a92653..e6ec43ec27 100644 --- a/Content.Server/Commands/Atmos/AddUnsimulatedAtmosCommand.cs +++ b/Content.Server/Commands/Atmos/AddUnsimulatedAtmosCommand.cs @@ -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} "; - 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()) { - shell.SendText(player, "Grid already has an atmosphere."); + shell.WriteLine("Grid already has an atmosphere."); return; } grid.AddComponent(); - shell.SendText(player, $"Added unsimulated atmosphere to grid {id}."); + shell.WriteLine($"Added unsimulated atmosphere to grid {id}."); } } diff --git a/Content.Server/Commands/Atmos/DeleteGasCommand.cs b/Content.Server/Commands/Atmos/DeleteGasCommand.cs index dd92aeb957..ac11c85360 100644 --- a/Content.Server/Commands/Atmos/DeleteGasCommand.cs +++ b/Content.Server/Commands/Atmos/DeleteGasCommand.cs @@ -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} / {Command} / {Command} / {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(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(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."); } } diff --git a/Content.Server/Commands/Atmos/FillGasCommand.cs b/Content.Server/Commands/Atmos/FillGasCommand.cs index 63efd89b63..1bac6ace5d 100644 --- a/Content.Server/Commands/Atmos/FillGasCommand.cs +++ b/Content.Server/Commands/Atmos/FillGasCommand.cs @@ -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 "; - 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()) { - shell.SendText(player, "Grid doesn't have an atmosphere."); + shell.WriteLine("Grid doesn't have an atmosphere."); return; } diff --git a/Content.Server/Commands/Atmos/ListGasesCommand.cs b/Content.Server/Commands/Atmos/ListGasesCommand.cs index 57c56c5420..129719e866 100644 --- a/Content.Server/Commands/Atmos/ListGasesCommand.cs +++ b/Content.Server/Commands/Atmos/ListGasesCommand.cs @@ -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(); foreach (var gasPrototype in atmosSystem.Gases) { - shell.SendText(player, $"{gasPrototype.Name} ID: {gasPrototype.ID}"); + shell.WriteLine($"{gasPrototype.Name} ID: {gasPrototype.ID}"); } } } diff --git a/Content.Server/Commands/Atmos/RemoveGasCommand.cs b/Content.Server/Commands/Atmos/RemoveGasCommand.cs index 7bf83f33dd..84f0cadcee 100644 --- a/Content.Server/Commands/Atmos/RemoveGasCommand.cs +++ b/Content.Server/Commands/Atmos/RemoveGasCommand.cs @@ -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 \nIf 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()) { - 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; } diff --git a/Content.Server/Commands/Atmos/SetAtmosTemperatureCommand.cs b/Content.Server/Commands/Atmos/SetAtmosTemperatureCommand.cs index 6d935e004a..28b2452397 100644 --- a/Content.Server/Commands/Atmos/SetAtmosTemperatureCommand.cs +++ b/Content.Server/Commands/Atmos/SetAtmosTemperatureCommand.cs @@ -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 "; - 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()) { - 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."); } } } diff --git a/Content.Server/Commands/Atmos/SetTemperatureCommand.cs b/Content.Server/Commands/Atmos/SetTemperatureCommand.cs index c761c9cac4..33be481d12 100644 --- a/Content.Server/Commands/Atmos/SetTemperatureCommand.cs +++ b/Content.Server/Commands/Atmos/SetTemperatureCommand.cs @@ -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 "; - 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()) { - 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; } diff --git a/Content.Server/Commands/Atmos/ShowAtmosCommand.cs b/Content.Server/Commands/Atmos/ShowAtmosCommand.cs index 01e1ccc61d..bd3f8cf6ca 100644 --- a/Content.Server/Commands/Atmos/ShowAtmosCommand.cs +++ b/Content.Server/Commands/Atmos/ShowAtmosCommand.cs @@ -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(); var enabled = atmosDebug.ToggleObserver(player); - shell.SendText(player, enabled + shell.WriteLine(enabled ? "Enabled the atmospherics debug overlay." : "Disabled the atmospherics debug overlay."); } diff --git a/Content.Server/Commands/AttachBodyPartCommand.cs b/Content.Server/Commands/AttachBodyPartCommand.cs index 72128390b5..07b9e92fdd 100644 --- a/Content.Server/Commands/AttachBodyPartCommand.cs +++ b/Content.Server/Commands/AttachBodyPartCommand.cs @@ -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} / {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; var entityManager = IoCManager.Resolve(); 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; } diff --git a/Content.Server/Commands/Body/AddHandCommand.cs b/Content.Server/Commands/Body/AddHandCommand.cs index a448df85f7..e0dedf53af 100644 --- a/Content.Server/Commands/Body/AddHandCommand.cs +++ b/Content.Server/Commands/Body/AddHandCommand.cs @@ -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} / {Command} / {Command} / {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(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(); 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); } } } diff --git a/Content.Server/Commands/Body/DestroyMechanismCommand.cs b/Content.Server/Commands/Body/DestroyMechanismCommand.cs index 76fe801165..59aa109a10 100644 --- a/Content.Server/Commands/Body/DestroyMechanismCommand.cs +++ b/Content.Server/Commands/Body/DestroyMechanismCommand.cs @@ -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} "; - 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(); 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}."); } } } diff --git a/Content.Server/Commands/Body/RemoveHandCommand.cs b/Content.Server/Commands/Body/RemoveHandCommand.cs index 6491c5525e..9a3bcd87fa 100644 --- a/Content.Server/Commands/Body/RemoveHandCommand.cs +++ b/Content.Server/Commands/Body/RemoveHandCommand.cs @@ -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(); 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 { diff --git a/Content.Server/Commands/Chat/AdminChatCommand.cs b/Content.Server/Commands/Chat/AdminChatCommand.cs index 9c793b2125..a138ac68ae 100644 --- a/Content.Server/Commands/Chat/AdminChatCommand.cs +++ b/Content.Server/Commands/Chat/AdminChatCommand.cs @@ -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 "; - 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; diff --git a/Content.Server/Commands/Chat/MeCommand.cs b/Content.Server/Commands/Chat/MeCommand.cs index bb371a6c7c..f22d82f054 100644 --- a/Content.Server/Commands/Chat/MeCommand.cs +++ b/Content.Server/Commands/Chat/MeCommand.cs @@ -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 "; - 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; } diff --git a/Content.Server/Commands/Chat/OOCCommand.cs b/Content.Server/Commands/Chat/OOCCommand.cs index 1c7d85ce53..7233d2f96a 100644 --- a/Content.Server/Commands/Chat/OOCCommand.cs +++ b/Content.Server/Commands/Chat/OOCCommand.cs @@ -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 "; - 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; diff --git a/Content.Server/Commands/Chat/SayCommand.cs b/Content.Server/Commands/Chat/SayCommand.cs index ed01c97006..530e029636 100644 --- a/Content.Server/Commands/Chat/SayCommand.cs +++ b/Content.Server/Commands/Chat/SayCommand.cs @@ -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 "; - 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; } diff --git a/Content.Server/Commands/Chat/SuicideCommand.cs b/Content.Server/Commands/Chat/SuicideCommand.cs index aa73ff4913..c20e82f8a7 100644 --- a/Content.Server/Commands/Chat/SuicideCommand.cs +++ b/Content.Server/Commands/Chat/SuicideCommand.cs @@ -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()); + ghost.Execute(shell, argStr, Array.Empty()); } } } diff --git a/Content.Server/Commands/CommandUtils.cs b/Content.Server/Commands/CommandUtils.cs index 66e36773fb..c291c0b36c 100644 --- a/Content.Server/Commands/CommandUtils.cs +++ b/Content.Server/Commands/CommandUtils.cs @@ -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; } diff --git a/Content.Server/Commands/Damage/AddDamageFlagCommand.cs b/Content.Server/Commands/Damage/AddDamageFlagCommand.cs index 21d353b078..698a9a4b07 100644 --- a/Content.Server/Commands/Damage/AddDamageFlagCommand.cs +++ b/Content.Server/Commands/Damage/AddDamageFlagCommand.cs @@ -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} / {Command} "; - 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}"); } } } diff --git a/Content.Server/Commands/Damage/DamageFlagCommand.cs b/Content.Server/Commands/Damage/DamageFlagCommand.cs index 1edf0e973b..b1eee70281 100644 --- a/Content.Server/Commands/Damage/DamageFlagCommand.cs +++ b/Content.Server/Commands/Damage/DamageFlagCommand.cs @@ -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(); 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; } diff --git a/Content.Server/Commands/Damage/GodModeCommand.cs b/Content.Server/Commands/Damage/GodModeCommand.cs index 77c05fc24c..cedd3b1fb1 100644 --- a/Content.Server/Commands/Damage/GodModeCommand.cs +++ b/Content.Server/Commands/Damage/GodModeCommand.cs @@ -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} "; - 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(); 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(); 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}"); } diff --git a/Content.Server/Commands/Damage/RemoveDamageFlagCommand.cs b/Content.Server/Commands/Damage/RemoveDamageFlagCommand.cs index 631eaae370..c315723273 100644 --- a/Content.Server/Commands/Damage/RemoveDamageFlagCommand.cs +++ b/Content.Server/Commands/Damage/RemoveDamageFlagCommand.cs @@ -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} / {Command} "; - 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}"); } } } diff --git a/Content.Server/Commands/Disposal/TubeConnectionsCommand.cs b/Content.Server/Commands/Disposal/TubeConnectionsCommand.cs index eb13975d74..5188893165 100644 --- a/Content.Server/Commands/Disposal/TubeConnectionsCommand.cs +++ b/Content.Server/Commands/Disposal/TubeConnectionsCommand.cs @@ -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} "; - 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(); 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; } diff --git a/Content.Server/Commands/FindEntitiesWithComponents.cs b/Content.Server/Commands/FindEntitiesWithComponents.cs index 947ab82def..85daab24c6 100644 --- a/Content.Server/Commands/FindEntitiesWithComponents.cs +++ b/Content.Server/Commands/FindEntitiesWithComponents.cs @@ -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} ..."; - 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)}"); } } } diff --git a/Content.Server/Commands/GameTicking/DelayStartCommand.cs b/Content.Server/Commands/GameTicking/DelayStartCommand.cs index ff9a219d58..a74293779f 100644 --- a/Content.Server/Commands/GameTicking/DelayStartCommand.cs +++ b/Content.Server/Commands/GameTicking/DelayStartCommand.cs @@ -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} \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(); 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."); } } } diff --git a/Content.Server/Commands/GameTicking/EndRoundCommand.cs b/Content.Server/Commands/GameTicking/EndRoundCommand.cs index b274ed61cf..12afa279cb 100644 --- a/Content.Server/Commands/GameTicking/EndRoundCommand.cs +++ b/Content.Server/Commands/GameTicking/EndRoundCommand.cs @@ -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(); 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; } diff --git a/Content.Server/Commands/GameTicking/ForcePresetCommand.cs b/Content.Server/Commands/GameTicking/ForcePresetCommand.cs index 06c7cd67e4..bdd92c6500 100644 --- a/Content.Server/Commands/GameTicking/ForcePresetCommand.cs +++ b/Content.Server/Commands/GameTicking/ForcePresetCommand.cs @@ -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} "; - public void Execute(IConsoleShell shell, IPlayerSession player, string[] args) + public void Execute(IConsoleShell shell, string argStr, string[] args) { var ticker = IoCManager.Resolve(); 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}."); } } } \ No newline at end of file diff --git a/Content.Server/Commands/GameTicking/GoLobbyCommand.cs b/Content.Server/Commands/GameTicking/GoLobbyCommand.cs index 35d2691f00..7ca9c0c76b 100644 --- a/Content.Server/Commands/GameTicking/GoLobbyCommand.cs +++ b/Content.Server/Commands/GameTicking/GoLobbyCommand.cs @@ -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} "; - 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}")}"); } } } diff --git a/Content.Server/Commands/GameTicking/JoinGameCommand.cs b/Content.Server/Commands/GameTicking/JoinGameCommand.cs index 95006d5781..b160a1fe08 100644 --- a/Content.Server/Commands/GameTicking/JoinGameCommand.cs +++ b/Content.Server/Commands/GameTicking/JoinGameCommand.cs @@ -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(); 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(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()); @@ -55,4 +56,4 @@ namespace Content.Server.Commands.GameTicking ticker.MakeJoinGame(player, null); } } -} \ No newline at end of file +} diff --git a/Content.Server/Commands/GameTicking/MappingCommand.cs b/Content.Server/Commands/GameTicking/MappingCommand.cs index abf94258b5..332e5d57c5 100644 --- a/Content.Server/Commands/GameTicking/MappingCommand.cs +++ b/Content.Server/Commands/GameTicking/MappingCommand.cs @@ -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} / {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 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(); 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."); } } } diff --git a/Content.Server/Commands/GameTicking/NewRoundCommand.cs b/Content.Server/Commands/GameTicking/NewRoundCommand.cs index da10407a77..98d90cfab4 100644 --- a/Content.Server/Commands/GameTicking/NewRoundCommand.cs +++ b/Content.Server/Commands/GameTicking/NewRoundCommand.cs @@ -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(); ticker.RestartRound(); diff --git a/Content.Server/Commands/GameTicking/ObserveCommand.cs b/Content.Server/Commands/GameTicking/ObserveCommand.cs index 4596418418..fcc0e867a6 100644 --- a/Content.Server/Commands/GameTicking/ObserveCommand.cs +++ b/Content.Server/Commands/GameTicking/ObserveCommand.cs @@ -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; @@ -24,4 +25,4 @@ namespace Content.Server.Commands.GameTicking ticker.MakeObserve(player); } } -} \ No newline at end of file +} diff --git a/Content.Server/Commands/GameTicking/RespawnCommand.cs b/Content.Server/Commands/GameTicking/RespawnCommand.cs index 94286c3bcd..9af7ed05d8 100644 --- a/Content.Server/Commands/GameTicking/RespawnCommand.cs +++ b/Content.Server/Commands/GameTicking/RespawnCommand.cs @@ -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,17 +46,16 @@ 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; } ticker.Respawn(targetPlayer); } } -} \ No newline at end of file +} diff --git a/Content.Server/Commands/GameTicking/SetGamePresetCommand.cs b/Content.Server/Commands/GameTicking/SetGamePresetCommand.cs index 5a5c1c7f90..b085164e96 100644 --- a/Content.Server/Commands/GameTicking/SetGamePresetCommand.cs +++ b/Content.Server/Commands/GameTicking/SetGamePresetCommand.cs @@ -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; } diff --git a/Content.Server/Commands/GameTicking/StartRoundCommand.cs b/Content.Server/Commands/GameTicking/StartRoundCommand.cs index b8f3804bbe..14a74caf86 100644 --- a/Content.Server/Commands/GameTicking/StartRoundCommand.cs +++ b/Content.Server/Commands/GameTicking/StartRoundCommand.cs @@ -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(); 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; } diff --git a/Content.Server/Commands/GameTicking/TileWallsCommand.cs b/Content.Server/Commands/GameTicking/TileWallsCommand.cs index 668ea461c1..e2c7445763 100644 --- a/Content.Server/Commands/GameTicking/TileWallsCommand.cs +++ b/Content.Server/Commands/GameTicking/TileWallsCommand.cs @@ -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} | {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(); 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(); 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."); } } } diff --git a/Content.Server/Commands/GameTicking/ToggleDisallowLateJoinCommand.cs b/Content.Server/Commands/GameTicking/ToggleDisallowLateJoinCommand.cs index ffb1be19c0..d519ba5754 100644 --- a/Content.Server/Commands/GameTicking/ToggleDisallowLateJoinCommand.cs +++ b/Content.Server/Commands/GameTicking/ToggleDisallowLateJoinCommand.cs @@ -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} "; - 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."); } } } diff --git a/Content.Server/Commands/GameTicking/ToggleReadyCommand.cs b/Content.Server/Commands/GameTicking/ToggleReadyCommand.cs index 0f56e148ce..f710c59fb1 100644 --- a/Content.Server/Commands/GameTicking/ToggleReadyCommand.cs +++ b/Content.Server/Commands/GameTicking/ToggleReadyCommand.cs @@ -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; @@ -24,4 +25,4 @@ namespace Content.Server.Commands.GameTicking ticker.ToggleReady(player, bool.Parse(args[0])); } } -} \ No newline at end of file +} diff --git a/Content.Server/Commands/HideContainedContextCommand.cs b/Content.Server/Commands/HideContainedContextCommand.cs index ad975313a1..caf3384abe 100644 --- a/Content.Server/Commands/HideContainedContextCommand.cs +++ b/Content.Server/Commands/HideContainedContextCommand.cs @@ -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; } diff --git a/Content.Server/Commands/Hungry.cs b/Content.Server/Commands/Hungry.cs index 39daf0caf9..02ddebe18c 100644 --- a/Content.Server/Commands/Hungry.cs +++ b/Content.Server/Commands/Hungry.cs @@ -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; } diff --git a/Content.Server/Commands/HurtCommand.cs b/Content.Server/Commands/HurtCommand.cs index 1810852aaf..532af0304e 100644 --- a/Content.Server/Commands/HurtCommand.cs +++ b/Content.Server/Commands/HurtCommand.cs @@ -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; } diff --git a/Content.Server/Commands/Interactable/AnchorCommand.cs b/Content.Server/Commands/Interactable/AnchorCommand.cs index c84637ebb9..1d891fbb43 100644 --- a/Content.Server/Commands/Interactable/AnchorCommand.cs +++ b/Content.Server/Commands/Interactable/AnchorCommand.cs @@ -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} "; - 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; } diff --git a/Content.Server/Commands/Interactable/TilePryCommand.cs b/Content.Server/Commands/Interactable/TilePryCommand.cs index 06c390373b..9691736f51 100644 --- a/Content.Server/Commands/Interactable/TilePryCommand.cs +++ b/Content.Server/Commands/Interactable/TilePryCommand.cs @@ -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 /// /// [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} "; - 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; } diff --git a/Content.Server/Commands/Interactable/UnAnchorCommand.cs b/Content.Server/Commands/Interactable/UnAnchorCommand.cs index 3eca799b2e..5fdf8c23f0 100644 --- a/Content.Server/Commands/Interactable/UnAnchorCommand.cs +++ b/Content.Server/Commands/Interactable/UnAnchorCommand.cs @@ -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} "; - 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; } diff --git a/Content.Server/Commands/MachineLinking/SignalLinkerCommand.cs b/Content.Server/Commands/MachineLinking/SignalLinkerCommand.cs index a836885fe5..d729edddff 100644 --- a/Content.Server/Commands/MachineLinking/SignalLinkerCommand.cs +++ b/Content.Server/Commands/MachineLinking/SignalLinkerCommand.cs @@ -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"); } } -} \ No newline at end of file +} diff --git a/Content.Server/Commands/MakeSentientCommand.cs b/Content.Server/Commands/MakeSentientCommand.cs index 53197b3908..aa9c99cdb0 100644 --- a/Content.Server/Commands/MakeSentientCommand.cs +++ b/Content.Server/Commands/MakeSentientCommand.cs @@ -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 "; - 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; } diff --git a/Content.Server/Commands/Mobs/AddRoleCommand.cs b/Content.Server/Commands/Mobs/AddRoleCommand.cs index af714411f1..eedec5dfbc 100644 --- a/Content.Server/Commands/Mobs/AddRoleCommand.cs +++ b/Content.Server/Commands/Mobs/AddRoleCommand.cs @@ -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 \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"); } } } diff --git a/Content.Server/Commands/Mobs/MindInfoCommand.cs b/Content.Server/Commands/Mobs/MindInfoCommand.cs index 9a546b7ce9..520fdde43a 100644 --- a/Content.Server/Commands/Mobs/MindInfoCommand.cs +++ b/Content.Server/Commands/Mobs/MindInfoCommand.cs @@ -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 "; - 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"); } } } diff --git a/Content.Server/Commands/Mobs/RemoveRoleCommand.cs b/Content.Server/Commands/Mobs/RemoveRoleCommand.cs index 691082f849..11763ea74e 100644 --- a/Content.Server/Commands/Mobs/RemoveRoleCommand.cs +++ b/Content.Server/Commands/Mobs/RemoveRoleCommand.cs @@ -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 \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"); } } } diff --git a/Content.Server/Commands/Notify/PopupMsgCommand.cs b/Content.Server/Commands/Notify/PopupMsgCommand.cs index a86e07e217..524439e34e 100644 --- a/Content.Server/Commands/Notify/PopupMsgCommand.cs +++ b/Content.Server/Commands/Notify/PopupMsgCommand.cs @@ -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(); diff --git a/Content.Server/Commands/Objectives/AddObjectiveCommand.cs b/Content.Server/Commands/Objectives/AddObjectiveCommand.cs index 233a2d1650..24785024e3 100644 --- a/Content.Server/Commands/Objectives/AddObjectiveCommand.cs +++ b/Content.Server/Commands/Objectives/AddObjectiveCommand.cs @@ -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 "; - 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(); 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() .TryIndex(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."); } } diff --git a/Content.Server/Commands/Objectives/ListObjectivesCommand.cs b/Content.Server/Commands/Objectives/ListObjectivesCommand.cs index c7b4338a14..536b4e536f 100644 --- a/Content.Server/Commands/Objectives/ListObjectivesCommand.cs +++ b/Content.Server/Commands/Objectives/ListObjectivesCommand.cs @@ -1,22 +1,23 @@ -#nullable enable +#nullable enable using System.Linq; 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.Objectives { [AdminCommand(AdminFlags.Admin)] - public class ListObjectivesCommand : IClientCommand + public class ListObjectivesCommand : IConsoleCommand { public string Command => "lsobjectives"; public string Description => "Lists all objectives in a players mind."; public string Help => "lsobjectives []"; - public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args) + public void Execute(IConsoleShell shell, string argStr, string[] args) { + var player = shell.Player as IPlayerSession; IPlayerData? data; if (args.Length == 0 && player != null) { @@ -24,26 +25,26 @@ namespace Content.Server.Commands.Objectives } else if (player == null || !IoCManager.Resolve().TryGetPlayerDataByUsername(args[0], out data)) { - shell.SendText(player, "Can't find the playerdata."); + shell.WriteLine("Can't find the playerdata."); return; } var mind = data.ContentData()?.Mind; if (mind == null) { - shell.SendText(player, "Can't find the mind."); + shell.WriteLine("Can't find the mind."); return; } - shell.SendText(player, $"Objectives for player {data.UserId}:"); + shell.WriteLine($"Objectives for player {data.UserId}:"); var objectives = mind.AllObjectives.ToList(); if (objectives.Count == 0) { - shell.SendText(player, "None."); + shell.WriteLine("None."); } for (var i = 0; i < objectives.Count; i++) { - shell.SendText(player, $"- [{i}] {objectives[i]}"); + shell.WriteLine($"- [{i}] {objectives[i]}"); } } diff --git a/Content.Server/Commands/Objectives/RemoveObjectiveCommand.cs b/Content.Server/Commands/Objectives/RemoveObjectiveCommand.cs index 2fcc87f646..988090c25d 100644 --- a/Content.Server/Commands/Objectives/RemoveObjectiveCommand.cs +++ b/Content.Server/Commands/Objectives/RemoveObjectiveCommand.cs @@ -2,23 +2,23 @@ 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.Objectives { [AdminCommand(AdminFlags.Admin)] - public class RemoveObjectiveCommand : IClientCommand + public class RemoveObjectiveCommand : IConsoleCommand { public string Command => "rmobjective"; public string Description => "Removes an objective from the player's mind."; public string Help => "rmobjective "; - 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; } @@ -28,25 +28,24 @@ 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 (int.TryParse(args[1], out var i)) { - shell.SendText(player, - mind.TryRemoveObjective(i) - ? "Objective successfully removed!" - : "Objective removing failed. Maybe the index is out of bounds? Check lsobjectives!"); + shell.WriteLine(mind.TryRemoveObjective(i) + ? "Objective successfully removed!" + : "Objective removing failed. Maybe the index is out of bounds? Check lsobjectives!"); } else { - shell.SendText(player, $"Invalid index {args[1]}!"); + shell.WriteLine($"Invalid index {args[1]}!"); } } else { - shell.SendText(player, "Can't find the playerdata."); + shell.WriteLine("Can't find the playerdata."); } } } diff --git a/Content.Server/Commands/Observer/Ghost.cs b/Content.Server/Commands/Observer/Ghost.cs index 6aa887dd47..18be076486 100644 --- a/Content.Server/Commands/Observer/Ghost.cs +++ b/Content.Server/Commands/Observer/Ghost.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.Administration; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Observer; @@ -8,39 +8,40 @@ using Content.Shared.Damage; using Content.Shared.GameObjects.Components.Damage; using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Mobs.State; -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.Observer { [AnyCommand] - public class Ghost : IClientCommand + public class Ghost : IConsoleCommand { public string Command => "ghost"; public string Description => "Give up on life and become a ghost."; public string Help => "ghost"; public bool CanReturn { get; set; } = true; - 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 have no session, you can't ghost."); + shell?.WriteLine("You have no session, you can't ghost."); return; } var mind = player.ContentData()?.Mind; if (mind == null) { - shell?.SendText(player, "You have no Mind, you can't ghost."); + shell?.WriteLine("You have no Mind, you can't ghost."); return; } if (!IoCManager.Resolve().OnGhostAttempt(mind, CanReturn)) { - shell?.SendText(player, "You can't ghost right now."); + shell?.WriteLine("You can't ghost right now."); return; } } diff --git a/Content.Server/Commands/RemoveExtraComponents.cs b/Content.Server/Commands/RemoveExtraComponents.cs index b5b269fb83..d2bb8bb2ce 100644 --- a/Content.Server/Commands/RemoveExtraComponents.cs +++ b/Content.Server/Commands/RemoveExtraComponents.cs @@ -1,8 +1,8 @@ #nullable enable 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; @@ -11,12 +11,12 @@ using Robust.Shared.Prototypes; namespace Content.Server.Commands { [AdminCommand(AdminFlags.Mapping)] - public class RemoveExtraComponents : IClientCommand + public class RemoveExtraComponents : IConsoleCommand { public string Command => "removeextracomponents"; public string Description => "Removes all components from all entities of the specified id if that component is not in its prototype.\nIf no id is specified, it matches all entities."; public string Help => $"{Command} / {Command}"; - public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args) + public void Execute(IConsoleShell shell, string argStr, string[] args) { var id = args.Length == 0 ? null : string.Join(" ", args); var entityManager = IoCManager.Resolve(); @@ -32,7 +32,7 @@ namespace Content.Server.Commands { if (!prototypeManager.TryIndex(id, out EntityPrototype prototype)) { - shell.SendText(player, $"No entity prototype found with id {id}."); + shell.WriteLine($"No entity prototype found with id {id}."); return; } @@ -68,7 +68,7 @@ namespace Content.Server.Commands } } - shell.SendText(player, $"Removed {components} components from {entities} entities{(id == null ? "." : $" with id {id}")}"); + shell.WriteLine($"Removed {components} components from {entities} entities{(id == null ? "." : $" with id {id}")}"); } } } diff --git a/Content.Server/Commands/SetAnchorCommand.cs b/Content.Server/Commands/SetAnchorCommand.cs index 532458d55e..3dc2a16cf5 100644 --- a/Content.Server/Commands/SetAnchorCommand.cs +++ b/Content.Server/Commands/SetAnchorCommand.cs @@ -1,8 +1,8 @@ #nullable enable 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.GameObjects.Components; using Robust.Shared.Interfaces.GameObjects; @@ -11,22 +11,22 @@ using Robust.Shared.IoC; namespace Content.Server.Commands { [AdminCommand(AdminFlags.Debug)] - public class SetAnchorCommand : IClientCommand + public class SetAnchorCommand : IConsoleCommand { public string Command => "setanchor"; public string Description => "Sets the anchoring state of an entity."; public string Help => "setanchor "; - public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args) + public void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length == 0 || args.Length > 2) { - shell.SendText(player, "Invalid number of argument!"); + shell.WriteLine("Invalid number of argument!"); return; } if (!int.TryParse(args[0], out var id)) { - shell.SendText(player, "Invalid argument specified!"); + shell.WriteLine("Invalid argument specified!"); return; } @@ -36,7 +36,7 @@ namespace Content.Server.Commands if (!entityManager.TryGetEntity(entId, out var entity) || entity.Deleted || !entity.TryGetComponent(out PhysicsComponent? physics)) { - shell.SendText(player, "Invalid entity specified!"); + shell.WriteLine("Invalid entity specified!"); return; } @@ -44,7 +44,7 @@ namespace Content.Server.Commands { if (!bool.TryParse(args[1], out var value)) { - shell.SendText(player, "Invalid argument specified!"); + shell.WriteLine("Invalid argument specified!"); return; } diff --git a/Content.Server/Commands/ShowContainedContextCommand.cs b/Content.Server/Commands/ShowContainedContextCommand.cs index 8afcc5501b..fc93c08a7f 100644 --- a/Content.Server/Commands/ShowContainedContextCommand.cs +++ b/Content.Server/Commands/ShowContainedContextCommand.cs @@ -1,15 +1,15 @@ -#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 ShowContainedContextCommand : IClientCommand + public class ShowContainedContextCommand : IConsoleCommand { public const string CommandName = "showcontainedcontext"; @@ -18,11 +18,12 @@ namespace Content.Server.Commands public string Description => "Makes contained entities visible on the context menu, even when they shouldn't be."; 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; } diff --git a/Content.Server/Commands/Speech/AddAccent.cs b/Content.Server/Commands/Speech/AddAccent.cs index 530049c124..df410a8248 100644 --- a/Content.Server/Commands/Speech/AddAccent.cs +++ b/Content.Server/Commands/Speech/AddAccent.cs @@ -1,34 +1,35 @@ -#nullable enable +#nullable enable using System; using System.Linq; using Content.Server.Administration; using Content.Server.GameObjects.Components.Mobs.Speech; 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.Speech { [AdminCommand(AdminFlags.Fun)] - public class AddAccent : IClientCommand + public class AddAccent : IConsoleCommand { public string Command => "addaccent"; public string Description => "Add a speech component to the current player"; 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?.AttachedEntity == null) { - shell.SendText(player, "You don't have an entity!"); + shell.WriteLine("You don't have an entity!"); return; } if (args.Length == 0) { - shell.SendText(player, Help); + shell.WriteLine(Help); return; } @@ -44,7 +45,7 @@ namespace Content.Server.Commands.Speech { msg += $"{compFactory.GetRegistration(s).Name}\n"; } - shell.SendText(player, msg); + shell.WriteLine(msg); } else { @@ -58,7 +59,7 @@ namespace Content.Server.Commands.Speech } catch (Exception) { - shell.SendText(player, $"Accent {name} not found. Try {Command} ? to get a list of all appliable accents."); + shell.WriteLine($"Accent {name} not found. Try {Command} ? to get a list of all appliable accents."); return; } @@ -66,7 +67,7 @@ namespace Content.Server.Commands.Speech try { var comp = player.AttachedEntity.GetComponent(type); - shell.SendText(player, "You already have this accent!"); + shell.WriteLine("You already have this accent!"); return; } catch (Exception) diff --git a/Content.Server/Commands/StartSingularityEngineCommand.cs b/Content.Server/Commands/StartSingularityEngineCommand.cs index 1a0b703434..4a9695fae4 100644 --- a/Content.Server/Commands/StartSingularityEngineCommand.cs +++ b/Content.Server/Commands/StartSingularityEngineCommand.cs @@ -6,8 +6,8 @@ using Content.Server.GameObjects.Components.Singularity; using Content.Server.GameObjects.Components.PA; using Content.Shared.Administration; using Content.Shared.GameObjects.Components; -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,17 +15,17 @@ using Robust.Shared.IoC; namespace Content.Server.Commands { [AdminCommand(AdminFlags.Admin)] - public class StartSingularityEngineCommand : IClientCommand + public class StartSingularityEngineCommand : IConsoleCommand { public string Command => "startsingularityengine"; public string Description => "Automatically turns on the particle accelerator and containment field emitters."; public string Help => $"{Command}"; - 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; } @@ -41,7 +41,7 @@ namespace Content.Server.Commands pacb.SetStrength(ParticleAcceleratorPowerState.Level1); pacb.SwitchOn(); } - shell.SendText(player, "Done!"); + shell.WriteLine("Done!"); } } } diff --git a/Content.Server/Commands/StationEvents/StationEventCommand.cs b/Content.Server/Commands/StationEvents/StationEventCommand.cs index 95c8b910fd..99f28ce5a0 100644 --- a/Content.Server/Commands/StationEvents/StationEventCommand.cs +++ b/Content.Server/Commands/StationEvents/StationEventCommand.cs @@ -1,16 +1,16 @@ -#nullable enable +#nullable enable using Content.Server.Administration; using Content.Server.GameObjects.EntitySystems.StationEvents; 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.StationEvents { [AdminCommand(AdminFlags.Server)] - public sealed class StationEventCommand : IClientCommand + public sealed class StationEventCommand : IConsoleCommand { public string Command => "events"; public string Description => "Provides admin control to station events"; @@ -27,11 +27,12 @@ namespace Content.Server.Commands.StationEvents private const string RunHelp = "run : start a particular event now; is case-insensitive and not localized"; - 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 == 0) { - shell.SendText(player, $"Invalid amount of arguments.\n{Help}"); + shell.WriteLine($"Invalid amount of arguments.\n{Help}"); return; } @@ -56,14 +57,14 @@ namespace Content.Server.Commands.StationEvents case "run": if (args.Length != 2) { - shell.SendText(player, $"Need 2 arguments, there were {args.Length}.\n{RunHelp}"); + shell.WriteLine($"Need 2 arguments, there were {args.Length}.\n{RunHelp}"); break; } Run(shell, player, args[1]); break; default: - shell.SendText(player, Loc.GetString($"Invalid events command.\n{Help}")); + shell.WriteLine(Loc.GetString($"Invalid events command.\n{Help}")); break; } } @@ -76,7 +77,7 @@ namespace Content.Server.Commands.StationEvents ? stationSystem.RunRandomEvent() : stationSystem.RunEvent(eventName); - shell.SendText(player, resultText); + shell.WriteLine(resultText); } private void Running(IConsoleShell shell, IPlayerSession? player) @@ -84,18 +85,18 @@ namespace Content.Server.Commands.StationEvents var eventName = EntitySystem.Get().CurrentEvent?.Name; if (!string.IsNullOrEmpty(eventName)) { - shell.SendText(player, eventName); + shell.WriteLine(eventName); } else { - shell.SendText(player, Loc.GetString("No station event running")); + shell.WriteLine(Loc.GetString("No station event running")); } } private void List(IConsoleShell shell, IPlayerSession? player) { var resultText = "Random\n" + EntitySystem.Get().GetEventNames(); - shell.SendText(player, resultText); + shell.WriteLine(resultText); } private void Pause(IConsoleShell shell, IPlayerSession? player) @@ -104,12 +105,12 @@ namespace Content.Server.Commands.StationEvents if (!stationEventSystem.Enabled) { - shell.SendText(player, Loc.GetString("Station events are already paused")); + shell.WriteLine(Loc.GetString("Station events are already paused")); } else { stationEventSystem.Enabled = false; - shell.SendText(player, Loc.GetString("Station events paused")); + shell.WriteLine(Loc.GetString("Station events paused")); } } @@ -119,19 +120,19 @@ namespace Content.Server.Commands.StationEvents if (stationEventSystem.Enabled) { - shell.SendText(player, Loc.GetString("Station events are already running")); + shell.WriteLine(Loc.GetString("Station events are already running")); } else { stationEventSystem.Enabled = true; - shell.SendText(player, Loc.GetString("Station events resumed")); + shell.WriteLine(Loc.GetString("Station events resumed")); } } private void Stop(IConsoleShell shell, IPlayerSession? player) { var resultText = EntitySystem.Get().StopEvent(); - shell.SendText(player, resultText); + shell.WriteLine(resultText); } } } diff --git a/Content.Server/GameObjects/Components/Body/BodyComponent.cs b/Content.Server/GameObjects/Components/Body/BodyComponent.cs index 000832af1d..8f9eea9aac 100644 --- a/Content.Server/GameObjects/Components/Body/BodyComponent.cs +++ b/Content.Server/GameObjects/Components/Body/BodyComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using Content.Server.Commands.Observer; using Content.Shared.Audio; @@ -8,11 +8,12 @@ using Content.Shared.GameObjects.Components.Damage; using Content.Shared.GameObjects.Components.Mobs.State; using Content.Shared.GameObjects.Components.Movement; using Content.Shared.Utility; +using Robust.Server.Console; using Robust.Server.GameObjects.Components.Container; using Robust.Server.GameObjects.EntitySystems; -using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.Player; using Robust.Shared.Audio; +using Robust.Shared.Console; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.IoC; @@ -89,9 +90,9 @@ namespace Content.Server.GameObjects.Components.Body if (Owner.TryGetComponent(out IMobStateComponent? mobState) && mobState.IsDead()) { - var shell = IoCManager.Resolve(); + var host = IoCManager.Resolve(); - new Ghost().Execute(shell, (IPlayerSession) session, Array.Empty()); + new Ghost().Execute(new ConsoleShell(host, session), string.Empty, Array.Empty()); } } diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index 3527e9fcfb..b402e587ae 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Content.Server.Administration.Commands; @@ -15,9 +15,9 @@ using Content.Shared.GameObjects.Verbs; using Content.Shared.Interfaces; using Robust.Server.Console; using Robust.Server.GameObjects.Components.Container; -using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.GameObjects; using Robust.Server.Player; +using Robust.Shared.Console; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; @@ -686,9 +686,10 @@ namespace Content.Server.GameObjects.Components.GUI var entityId = target.Uid.ToString(); var command = new SetOutfitCommand(); - var shell = IoCManager.Resolve(); + var host = IoCManager.Resolve(); var args = new string[] {entityId}; - command.Execute(shell, user.PlayerSession(), args); + var session = user.PlayerSession(); + command.Execute(new ConsoleShell(host, session), $"{command.Command} {entityId}", args); } private static bool CanCommand(IEntity user) diff --git a/Content.Server/GameObjects/EntitySystems/AI/AiSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/AiSystem.cs index 36b56d93f3..d069a9a0f5 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/AiSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/AiSystem.cs @@ -10,7 +10,6 @@ using Content.Shared.Administration; using Content.Shared.GameObjects.Components.Movement; using JetBrains.Annotations; using Robust.Server.AI; -using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; diff --git a/Content.Server/GameTicking/GamePreset.cs b/Content.Server/GameTicking/GamePreset.cs index ff61818fd9..478a3953b8 100644 --- a/Content.Server/GameTicking/GamePreset.cs +++ b/Content.Server/GameTicking/GamePreset.cs @@ -13,7 +13,6 @@ using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Mobs.State; using Robust.Shared.Network; using Robust.Shared.Interfaces.GameObjects; -using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.Player; using Robust.Shared.IoC; diff --git a/Content.Server/GlobalVerbs/MakeSentientVerb.cs b/Content.Server/GlobalVerbs/MakeSentientVerb.cs index 5206e89264..ff040dbb9b 100644 --- a/Content.Server/GlobalVerbs/MakeSentientVerb.cs +++ b/Content.Server/GlobalVerbs/MakeSentientVerb.cs @@ -2,8 +2,8 @@ using Content.Server.Commands; using Content.Server.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Verbs; using Robust.Server.Console; -using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.GameObjects; +using Robust.Shared.Console; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; @@ -42,8 +42,11 @@ namespace Content.Server.GlobalVerbs if (!groupController.CanCommand(player, "makesentient")) return; - new MakeSentientCommand().Execute(IoCManager.Resolve(), player, - new[] {target.Uid.ToString()}); + var host = IoCManager.Resolve(); + var cmd = new MakeSentientCommand(); + var uidStr = target.Uid.ToString(); + cmd.Execute(new ConsoleShell(host, player), $"{cmd.Command} {uidStr}", + new[] {uidStr}); } } } diff --git a/Content.Server/Interfaces/Chat/IChatCommand.cs b/Content.Server/Interfaces/Chat/IChatCommand.cs deleted file mode 100644 index 09fff49d85..0000000000 --- a/Content.Server/Interfaces/Chat/IChatCommand.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Robust.Shared.Console; -using Robust.Shared.Interfaces.Network; - -namespace Content.Server.Interfaces.Chat -{ - public interface IChatCommand : ICommand - { - void Execute(IChatManager manager, INetChannel client, params string[] args); - } -} diff --git a/Content.Server/Interfaces/GameTicking/IGameTicker.cs b/Content.Server/Interfaces/GameTicking/IGameTicker.cs index 02073511f1..0e84bf73cd 100644 --- a/Content.Server/Interfaces/GameTicking/IGameTicker.cs +++ b/Content.Server/Interfaces/GameTicking/IGameTicker.cs @@ -5,7 +5,6 @@ using Content.Server.Mobs; using Content.Shared.Roles; using Content.Shared.Preferences; using Robust.Server.Interfaces.Player; -using Robust.Server.Interfaces.Console; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Map; using Robust.Shared.Timing; diff --git a/Content.Server/Sandbox/SandboxManager.cs b/Content.Server/Sandbox/SandboxManager.cs index 4516b17a00..4bdc3a366a 100644 --- a/Content.Server/Sandbox/SandboxManager.cs +++ b/Content.Server/Sandbox/SandboxManager.cs @@ -9,7 +9,6 @@ using Content.Shared.Access; using Content.Shared.Sandbox; using Robust.Server.Console; using Robust.Server.GameObjects; -using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.Placement; using Robust.Server.Interfaces.Player; using Robust.Server.Player; @@ -31,7 +30,7 @@ namespace Content.Server.Sandbox [Dependency] private readonly IPlacementManager _placementManager = default!; [Dependency] private readonly IConGroupController _conGroupController = default!; [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly IConsoleShell _shell = default!; + [Dependency] private readonly IServerConsoleHost _host = default!; private bool _isSandboxEnabled; @@ -183,7 +182,7 @@ namespace Content.Server.Sandbox var player = _playerManager.GetSessionByChannel(message.MsgChannel); - _shell.ExecuteCommand(player, _conGroupController.CanCommand(player, "aghost") ? "aghost" : "ghost"); + _host.ExecuteCommand(player, _conGroupController.CanCommand(player, "aghost") ? "aghost" : "ghost"); } private void SandboxSuicideReceived(MsgSandboxSuicide message) @@ -194,7 +193,7 @@ namespace Content.Server.Sandbox } var player = _playerManager.GetSessionByChannel(message.MsgChannel); - _shell.ExecuteCommand(player, "suicide"); + _host.ExecuteCommand(player, "suicide"); } private void UpdateSandboxStatusForAll() diff --git a/Content.Server/ServerNotifyManager.cs b/Content.Server/ServerNotifyManager.cs index 8dd2d978f3..9c00fa92e1 100644 --- a/Content.Server/ServerNotifyManager.cs +++ b/Content.Server/ServerNotifyManager.cs @@ -4,7 +4,6 @@ using Content.Shared; using Content.Shared.Network.NetMessages; using Content.Shared.Administration; using Content.Shared.Interfaces; -using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.GameObjects; using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; diff --git a/RobustToolbox b/RobustToolbox index 3e5efd5ed0..3eb6e067f9 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 3e5efd5ed06d85d4c874d6369c26569a67e3242a +Subproject commit 3eb6e067f9dc0155cf2490fe4adeb6e03e42412c