Console Unify API Changes (#3059)
* Remove unused IChatCommand. * Lots of refactoring into a shared context. * Removed ICommonSession from server concmd Execute. * Added argStr parameter to concmd execute. * The execute function of client concmds now returns void, use the new shell.RemoteExecuteCommand function to forward commands. * Finally move shells and commands into shared. * Console commands can now be registered directly without a class in a shared context. * Engine API Changes. * Repair rebase damage. * Update Submodule.
This commit is contained in:
@@ -4,8 +4,8 @@ using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Server.GameObjects.EntitySystems.AI;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -14,7 +14,7 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands.AI
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class AddAiCommand : IClientCommand
|
||||
public class AddAiCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addai";
|
||||
public string Description => "Add an ai component with a given processor to an entity.";
|
||||
@@ -22,11 +22,11 @@ namespace Content.Server.Commands.AI
|
||||
+ "\n processorId: Class that inherits AiLogicProcessor and has an AiLogicProcessor attribute."
|
||||
+ "\n entityID: Uid of entity to add the AiControllerComponent to. Open its VV menu to find this.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if(args.Length != 2)
|
||||
{
|
||||
shell.SendText(player, "Wrong number of args.");
|
||||
shell.WriteLine("Wrong number of args.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace Content.Server.Commands.AI
|
||||
|
||||
if (!aiSystem.ProcessorTypeExists(processorId))
|
||||
{
|
||||
shell.SendText(player, "Invalid processor type. Processor must inherit AiLogicProcessor and have an AiLogicProcessor attribute.");
|
||||
shell.WriteLine("Invalid processor type. Processor must inherit AiLogicProcessor and have an AiLogicProcessor attribute.");
|
||||
return;
|
||||
}
|
||||
if (ent.HasComponent<AiControllerComponent>())
|
||||
{
|
||||
shell.SendText(player, "Entity already has an AI component.");
|
||||
shell.WriteLine("Entity already has an AI component.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.Commands.AI
|
||||
|
||||
var comp = ent.AddComponent<AiControllerComponent>();
|
||||
comp.LogicName = processorId;
|
||||
shell.SendText(player, "AI component added.");
|
||||
shell.WriteLine("AI component added.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,22 +4,22 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.AI;
|
||||
using Content.Server.GameObjects.EntitySystems.AI;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Commands.AI
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public sealed class FactionCommand : IClientCommand
|
||||
public sealed class FactionCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "factions";
|
||||
public string Description => "Update / list factional relationships for NPCs.";
|
||||
public string Help => "faction <source> <friendly/hostile> target\n" +
|
||||
"faction <source> list: hostile factions";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
@@ -31,19 +31,19 @@ namespace Content.Server.Commands.AI
|
||||
result.Append(value + "\n");
|
||||
}
|
||||
|
||||
shell.SendText(player, result.ToString());
|
||||
shell.WriteLine(result.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length < 2)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Need more args"));
|
||||
shell.WriteLine(Loc.GetString("Need more args"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[0], true, out Faction faction))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid faction"));
|
||||
shell.WriteLine(Loc.GetString("Invalid faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,40 +54,40 @@ namespace Content.Server.Commands.AI
|
||||
case "friendly":
|
||||
if (args.Length < 3)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Need to supply a target faction"));
|
||||
shell.WriteLine(Loc.GetString("Need to supply a target faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[2], true, out targetFaction))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid target faction"));
|
||||
shell.WriteLine(Loc.GetString("Invalid target faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySystem.Get<AiFactionTagSystem>().MakeFriendly(faction, targetFaction);
|
||||
shell.SendText(player, Loc.GetString("Command successful"));
|
||||
shell.WriteLine(Loc.GetString("Command successful"));
|
||||
break;
|
||||
case "hostile":
|
||||
if (args.Length < 3)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Need to supply a target faction"));
|
||||
shell.WriteLine(Loc.GetString("Need to supply a target faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[2], true, out targetFaction))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid target faction"));
|
||||
shell.WriteLine(Loc.GetString("Invalid target faction"));
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySystem.Get<AiFactionTagSystem>().MakeHostile(faction, targetFaction);
|
||||
shell.SendText(player, Loc.GetString("Command successful"));
|
||||
shell.WriteLine(Loc.GetString("Command successful"));
|
||||
break;
|
||||
case "list":
|
||||
shell.SendText(player, EntitySystem.Get<AiFactionTagSystem>().GetHostileFactions(faction).ToString());
|
||||
shell.WriteLine(EntitySystem.Get<AiFactionTagSystem>().GetHostileFactions(faction).ToString());
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Loc.GetString("Unknown faction arg"));
|
||||
shell.WriteLine(Loc.GetString("Unknown faction arg"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Actions
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class CooldownAction : IClientCommand
|
||||
public sealed class CooldownAction : IConsoleCommand
|
||||
{
|
||||
public string Command => "coolaction";
|
||||
public string Description => "Sets a cooldown on an action for a player, defaulting to current player";
|
||||
public string Help => "coolaction <actionType> <seconds> <name or userID, omit for current player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null) return;
|
||||
var attachedEntity = player.AttachedEntity;
|
||||
if (args.Length > 2)
|
||||
@@ -31,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<ActionType>(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<ActionManager>();
|
||||
|
||||
if (!actionMgr.TryGet(actionType, out var action))
|
||||
{
|
||||
shell.SendText(player, "unrecognized actionType " + actionType);
|
||||
shell.WriteLine("unrecognized actionType " + actionType);
|
||||
return;
|
||||
}
|
||||
|
||||
var cooldownStart = IoCManager.Resolve<IGameTiming>().CurTime;
|
||||
if (!uint.TryParse(args[1], out var seconds))
|
||||
{
|
||||
shell.SendText(player, "cannot parse seconds: " + args[1]);
|
||||
shell.WriteLine("cannot parse seconds: " + args[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Actions
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class GrantAction : IClientCommand
|
||||
public sealed class GrantAction : IConsoleCommand
|
||||
{
|
||||
public string Command => "grantaction";
|
||||
public string Description => "Grants an action to a player, defaulting to current player";
|
||||
public string Help => "grantaction <actionType> <name or userID, omit for current player>";
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null) return;
|
||||
var attachedEntity = player.AttachedEntity;
|
||||
if (args.Length > 1)
|
||||
@@ -29,21 +30,21 @@ namespace Content.Server.Commands.Actions
|
||||
if (attachedEntity == null) return;
|
||||
if (!attachedEntity.TryGetComponent(out ServerActionsComponent? actionsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no actions component");
|
||||
shell.WriteLine("user has no actions component");
|
||||
return;
|
||||
}
|
||||
|
||||
var actionTypeRaw = args[0];
|
||||
if (!Enum.TryParse<ActionType>(actionTypeRaw, out var actionType))
|
||||
{
|
||||
shell.SendText(player, "unrecognized ActionType enum value, please" +
|
||||
" ensure you used correct casing: " + actionTypeRaw);
|
||||
shell.WriteLine("unrecognized ActionType enum value, please" +
|
||||
" ensure you used correct casing: " + actionTypeRaw);
|
||||
return;
|
||||
}
|
||||
var actionMgr = IoCManager.Resolve<ActionManager>();
|
||||
if (!actionMgr.TryGet(actionType, out var action))
|
||||
{
|
||||
shell.SendText(player, "unrecognized actionType " + actionType);
|
||||
shell.WriteLine("unrecognized actionType " + actionType);
|
||||
return;
|
||||
}
|
||||
actionsComponent.Grant(action.ActionType);
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Actions
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class RevokeAction : IClientCommand
|
||||
public sealed class RevokeAction : IConsoleCommand
|
||||
{
|
||||
public string Command => "revokeaction";
|
||||
public string Description => "Revokes an action from a player, defaulting to current player";
|
||||
public string Help => "revokeaction <actionType> <name or userID, omit for current player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null) return;
|
||||
var attachedEntity = player.AttachedEntity;
|
||||
if (args.Length > 1)
|
||||
@@ -29,21 +30,21 @@ namespace Content.Server.Commands.Actions
|
||||
if (attachedEntity == null) return;
|
||||
if (!attachedEntity.TryGetComponent(out ServerActionsComponent? actionsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no actions component");
|
||||
shell.WriteLine("user has no actions component");
|
||||
return;
|
||||
}
|
||||
|
||||
var actionTypeRaw = args[0];
|
||||
if (!Enum.TryParse<ActionType>(actionTypeRaw, out var actionType))
|
||||
{
|
||||
shell.SendText(player, "unrecognized ActionType enum value, please" +
|
||||
" ensure you used correct casing: " + actionTypeRaw);
|
||||
shell.WriteLine("unrecognized ActionType enum value, please" +
|
||||
" ensure you used correct casing: " + actionTypeRaw);
|
||||
return;
|
||||
}
|
||||
var actionMgr = IoCManager.Resolve<ActionManager>();
|
||||
if (!actionMgr.TryGet(actionType, out var action))
|
||||
{
|
||||
shell.SendText(player, "unrecognized actionType " + actionType);
|
||||
shell.WriteLine("unrecognized actionType " + actionType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Alert;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Alerts
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class ClearAlert : IClientCommand
|
||||
public sealed class ClearAlert : IConsoleCommand
|
||||
{
|
||||
public string Command => "clearalert";
|
||||
public string Description => "Clears an alert for a player, defaulting to current player";
|
||||
public string Help => "clearalert <alertType> <name or userID, omit for current player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity.");
|
||||
shell.WriteLine("You don't have an entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ namespace Content.Server.Commands.Alerts
|
||||
|
||||
if (!attachedEntity.TryGetComponent(out ServerAlertsComponent? alertsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no alerts component");
|
||||
shell.WriteLine("user has no alerts component");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@ namespace Content.Server.Commands.Alerts
|
||||
var alertMgr = IoCManager.Resolve<AlertManager>();
|
||||
if (!alertMgr.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
|
||||
{
|
||||
shell.SendText(player, "unrecognized alertType " + alertType);
|
||||
shell.WriteLine("unrecognized alertType " + alertType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Alert;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Alerts
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class ShowAlert : IClientCommand
|
||||
public sealed class ShowAlert : IConsoleCommand
|
||||
{
|
||||
public string Command => "showalert";
|
||||
public string Description => "Shows an alert for a player, defaulting to current player";
|
||||
public string Help => "showalert <alertType> <severity, -1 if no severity> <name or userID, omit for current player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot run this command from the server.");
|
||||
shell.WriteLine("You cannot run this command from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace Content.Server.Commands.Alerts
|
||||
|
||||
if (attachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity.");
|
||||
shell.WriteLine("You don't have an entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace Content.Server.Commands.Alerts
|
||||
|
||||
if (!attachedEntity.TryGetComponent(out ServerAlertsComponent? alertsComponent))
|
||||
{
|
||||
shell.SendText(player, "user has no alerts component");
|
||||
shell.WriteLine("user has no alerts component");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,12 +51,12 @@ namespace Content.Server.Commands.Alerts
|
||||
var alertMgr = IoCManager.Resolve<AlertManager>();
|
||||
if (!alertMgr.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
|
||||
{
|
||||
shell.SendText(player, "unrecognized alertType " + alertType);
|
||||
shell.WriteLine("unrecognized alertType " + alertType);
|
||||
return;
|
||||
}
|
||||
if (!short.TryParse(severity, out var sevint))
|
||||
{
|
||||
shell.SendText(player, "invalid severity " + sevint);
|
||||
shell.WriteLine("invalid severity " + sevint);
|
||||
return;
|
||||
}
|
||||
alertsComponent.ShowAlert(alert.AlertType, sevint == -1 ? (short?) null : sevint);
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,23 +13,23 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddAtmosCommand : IClientCommand
|
||||
public class AddAtmosCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addatmos";
|
||||
public string Description => "Adds atmos support to a grid.";
|
||||
public string Help => $"{Command} <GridId>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,19 +47,19 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (grid.HasComponent<IGridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid already has an atmosphere.");
|
||||
shell.WriteLine("Grid already has an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
grid.AddComponent<GridAtmosphereComponent>();
|
||||
|
||||
shell.SendText(player, $"Added atmosphere to grid {id}.");
|
||||
shell.WriteLine($"Added atmosphere to grid {id}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,13 +14,13 @@ using Robust.Shared.Maths;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddGasCommand : IClientCommand
|
||||
public class AddGasCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addgas";
|
||||
public string Description => "Adds gas at a certain position.";
|
||||
public string Help => "addgas <X> <Y> <GridId> <Gas> <moles>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 5) return;
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
@@ -35,7 +35,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,13 +59,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
shell.SendText(player, "Invalid coordinates.");
|
||||
shell.WriteLine("Invalid coordinates.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tile.Air == null)
|
||||
{
|
||||
shell.SendText(player, "Can't add gas to that tile.");
|
||||
shell.WriteLine("Can't add gas to that tile.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,23 +13,23 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddUnsimulatedAtmosCommand : IClientCommand
|
||||
public class AddUnsimulatedAtmosCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addunsimulatedatmos";
|
||||
public string Description => "Adds unimulated atmos support to a grid.";
|
||||
public string Help => $"{Command} <GridId>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,19 +47,19 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (grid.HasComponent<IGridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid already has an atmosphere.");
|
||||
shell.WriteLine("Grid already has an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
grid.AddComponent<UnsimulatedGridAtmosphereComponent>();
|
||||
|
||||
shell.SendText(player, $"Added unsimulated atmosphere to grid {id}.");
|
||||
shell.WriteLine($"Added unsimulated atmosphere to grid {id}.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,14 +14,15 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class DeleteGasCommand : IClientCommand
|
||||
public class DeleteGasCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "deletegas";
|
||||
public string Description => "Removes all gases from a grid, or just of one type if specified.";
|
||||
public string Help => $"Usage: {Command} <GridId> <Gas> / {Command} <GridId> / {Command} <Gas> / {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
GridId gridId;
|
||||
Gas? gas = null;
|
||||
|
||||
@@ -30,13 +31,13 @@ namespace Content.Server.Commands.Atmos
|
||||
case 0:
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "A grid must be specified when the command isn't used by a player.");
|
||||
shell.WriteLine("A grid must be specified when the command isn't used by a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You have no entity to get a grid from.");
|
||||
shell.WriteLine("You have no entity to get a grid from.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,7 +45,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.SendText(player, "You aren't on a grid to delete gas from.");
|
||||
shell.WriteLine("You aren't on a grid to delete gas from.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,13 +57,13 @@ namespace Content.Server.Commands.Atmos
|
||||
// Argument is a gas
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "A grid id must be specified if not using this command as a player.");
|
||||
shell.WriteLine("A grid id must be specified if not using this command as a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You have no entity from which to get a grid id.");
|
||||
shell.WriteLine("You have no entity from which to get a grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,13 +71,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.SendText(player, "You aren't on a grid to delete gas from.");
|
||||
shell.WriteLine("You aren't on a grid to delete gas from.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse<Gas>(args[0], true, out var parsedGas))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid gas name.");
|
||||
shell.WriteLine($"{args[0]} is not a valid gas name.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,7 +100,7 @@ namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
if (!int.TryParse(args[0], out var first))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer for a grid id.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer for a grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,13 +108,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse<Gas>(args[1], true, out var parsedGas))
|
||||
{
|
||||
shell.SendText(player, $"{args[1]} is not a valid gas.");
|
||||
shell.WriteLine($"{args[1]} is not a valid gas.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ namespace Content.Server.Commands.Atmos
|
||||
break;
|
||||
}
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,7 +131,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
{
|
||||
shell.SendText(player, $"No grid exists with id {gridId}");
|
||||
shell.WriteLine($"No grid exists with id {gridId}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -138,13 +139,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||
{
|
||||
shell.SendText(player, $"Grid {gridId} has no entity.");
|
||||
shell.WriteLine($"Grid {gridId} has no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gridEntity.TryGetComponent(out GridAtmosphereComponent? atmosphere))
|
||||
{
|
||||
shell.SendText(player, $"Grid {gridId} has no {nameof(GridAtmosphereComponent)}");
|
||||
shell.WriteLine($"Grid {gridId} has no {nameof(GridAtmosphereComponent)}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -182,11 +183,11 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (gas == null)
|
||||
{
|
||||
shell.SendText(player, $"Removed {moles} moles from {tiles} tiles.");
|
||||
shell.WriteLine($"Removed {moles} moles from {tiles} tiles.");
|
||||
return;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Removed {moles} moles of gas {gas} from {tiles} tiles.");
|
||||
shell.WriteLine($"Removed {moles} moles of gas {gas} from {tiles} tiles.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,13 +13,13 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class FillGas : IClientCommand
|
||||
public class FillGas : IConsoleCommand
|
||||
{
|
||||
public string Command => "fillgas";
|
||||
public string Description => "Adds gas to all tiles in a grid.";
|
||||
public string Help => "fillgas <GridId> <Gas> <moles>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 3) return;
|
||||
if(!int.TryParse(args[0], out var id)
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,13 +40,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,26 +2,26 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class ListGasesCommand : IClientCommand
|
||||
public class ListGasesCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "listgases";
|
||||
public string Description => "Prints a list of gases and their indices.";
|
||||
public string Help => "listgases";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
foreach (var gasPrototype in atmosSystem.Gases)
|
||||
{
|
||||
shell.SendText(player, $"{gasPrototype.Name} ID: {gasPrototype.ID}");
|
||||
shell.WriteLine($"{gasPrototype.Name} ID: {gasPrototype.ID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,13 +13,13 @@ using Robust.Shared.Maths;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class RemoveGasCommand : IClientCommand
|
||||
public class RemoveGasCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "removegas";
|
||||
public string Description => "Removes an amount of gases.";
|
||||
public string Help => "removegas <X> <Y> <GridId> <amount> <ratio>\nIf <ratio> is true, amount will be treated as the ratio of gas to be removed.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 5) return;
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
@@ -34,7 +34,7 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,13 +42,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,13 +58,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
shell.SendText(player, "Invalid coordinates.");
|
||||
shell.WriteLine("Invalid coordinates.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tile.Air == null)
|
||||
{
|
||||
shell.SendText(player, "Can't remove gas from that tile.");
|
||||
shell.WriteLine("Can't remove gas from that tile.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,13 +13,13 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SetAtmosTemperatureCommand : IClientCommand
|
||||
public class SetAtmosTemperatureCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "setatmostemp";
|
||||
public string Description => "Sets a grid's temperature (in kelvin).";
|
||||
public string Help => "Usage: setatmostemp <GridId> <Temperature>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 2) return;
|
||||
if(!int.TryParse(args[0], out var id)
|
||||
@@ -31,13 +31,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (temperature < Atmospherics.TCMB)
|
||||
{
|
||||
shell.SendText(player, "Invalid temperature.");
|
||||
shell.WriteLine("Invalid temperature.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Content.Server.Commands.Atmos
|
||||
tile.Invalidate();
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Changed the temperature of {tiles} tiles.");
|
||||
shell.WriteLine($"Changed the temperature of {tiles} tiles.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,13 +14,13 @@ using Robust.Shared.Maths;
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SetTemperatureCommand : IClientCommand
|
||||
public class SetTemperatureCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "settemp";
|
||||
public string Description => "Sets a tile's temperature (in kelvin).";
|
||||
public string Help => "Usage: settemp <X> <Y> <GridId> <Temperature>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 4) return;
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
@@ -34,13 +34,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (temperature < Atmospherics.TCMB)
|
||||
{
|
||||
shell.SendText(player, "Invalid temperature.");
|
||||
shell.WriteLine("Invalid temperature.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.WriteLine("Invalid grid ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grid.HasComponent<GridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid doesn't have an atmosphere.");
|
||||
shell.WriteLine("Grid doesn't have an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,13 +64,13 @@ namespace Content.Server.Commands.Atmos
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
shell.SendText(player, "Invalid coordinates.");
|
||||
shell.WriteLine("Invalid coordinates.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tile.Air == null)
|
||||
{
|
||||
shell.SendText(player, "Can't change that tile's temperature.");
|
||||
shell.WriteLine("Can't change that tile's temperature.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems.Atmos;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class ShowAtmos : IClientCommand
|
||||
public class ShowAtmos : IConsoleCommand
|
||||
{
|
||||
public string Command => "showatmos";
|
||||
public string Description => "Toggles seeing atmos debug overlay.";
|
||||
public string Help => $"Usage: {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You must be a player to use this command.");
|
||||
shell.WriteLine("You must be a player to use this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
var atmosDebug = EntitySystem.Get<AtmosDebugOverlaySystem>();
|
||||
var enabled = atmosDebug.ToggleObserver(player);
|
||||
|
||||
shell.SendText(player, enabled
|
||||
shell.WriteLine(enabled
|
||||
? "Enabled the atmospherics debug overlay."
|
||||
: "Disabled the atmospherics debug overlay.");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Body.Part;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,14 +13,15 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class AttachBodyPartCommand : IClientCommand
|
||||
public class AttachBodyPartCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "attachbodypart";
|
||||
public string Description => "Attaches a body part to you or someone else.";
|
||||
public string Help => $"{Command} <partEntityUid> / {Command} <entityUid> <partEntityUid>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
IEntity entity;
|
||||
@@ -31,19 +32,19 @@ namespace Content.Server.Commands
|
||||
case 1:
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, $"You need to specify an entity to attach the part to if you aren't a player.\n{Help}");
|
||||
shell.WriteLine($"You need to specify an entity to attach the part to if you aren't a player.\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, $"You need to specify an entity to attach the part to if you aren't attached to an entity.\n{Help}");
|
||||
shell.WriteLine($"You need to specify an entity to attach the part to if you aren't attached to an entity.\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityUid.TryParse(args[0], out partUid))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid entity uid.");
|
||||
shell.WriteLine($"{args[0]} is not a valid entity uid.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,50 +54,50 @@ namespace Content.Server.Commands
|
||||
case 2:
|
||||
if (!EntityUid.TryParse(args[0], out var entityUid))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid entity uid.");
|
||||
shell.WriteLine($"{args[0]} is not a valid entity uid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityUid.TryParse(args[1], out partUid))
|
||||
{
|
||||
shell.SendText(player, $"{args[1]} is not a valid entity uid.");
|
||||
shell.WriteLine($"{args[1]} is not a valid entity uid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.TryGetEntity(entityUid, out var tempEntity))
|
||||
{
|
||||
shell.SendText(player, $"{entityUid} is not a valid entity.");
|
||||
shell.WriteLine($"{entityUid} is not a valid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
entity = tempEntity;
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.TryGetComponent(out IBody? body))
|
||||
{
|
||||
shell.SendText(player, $"Entity {entity.Name} with uid {entity.Uid} does not have a {nameof(IBody)} component.");
|
||||
shell.WriteLine($"Entity {entity.Name} with uid {entity.Uid} does not have a {nameof(IBody)} component.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.TryGetEntity(partUid, out var partEntity))
|
||||
{
|
||||
shell.SendText(player, $"{partUid} is not a valid entity.");
|
||||
shell.WriteLine($"{partUid} is not a valid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!partEntity.TryGetComponent(out IBodyPart? part))
|
||||
{
|
||||
shell.SendText(player, $"Entity {partEntity.Name} with uid {args[0]} does not have a {nameof(IBodyPart)} component.");
|
||||
shell.WriteLine($"Entity {partEntity.Name} with uid {args[0]} does not have a {nameof(IBodyPart)} component.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (body.HasPart(part))
|
||||
{
|
||||
shell.SendText(player, $"Body part {partEntity.Name} with uid {partEntity.Uid} is already attached to entity {entity.Name} with uid {entity.Uid}");
|
||||
shell.WriteLine($"Body part {partEntity.Name} with uid {partEntity.Uid} is already attached to entity {entity.Name} with uid {entity.Uid}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
@@ -15,7 +15,7 @@ using Robust.Shared.Random;
|
||||
namespace Content.Server.Commands.Body
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
class AddHandCommand : IClientCommand
|
||||
class AddHandCommand : IConsoleCommand
|
||||
{
|
||||
public const string DefaultHandPrototype = "LeftHandHuman";
|
||||
|
||||
@@ -23,11 +23,12 @@ namespace Content.Server.Commands.Body
|
||||
public string Description => "Adds a hand to your entity.";
|
||||
public string Help => $"Usage: {Command} <entityUid> <handPrototypeId> / {Command} <entityUid> / {Command} <handPrototypeId> / {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length > 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,13 +44,13 @@ namespace Content.Server.Commands.Body
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "Only a player can run this command without arguments.");
|
||||
shell.WriteLine("Only a player can run this command without arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity to add a hand to.");
|
||||
shell.WriteLine("You don't have an entity to add a hand to.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ namespace Content.Server.Commands.Body
|
||||
{
|
||||
if (!entityManager.TryGetEntity(uid, out var parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity found with uid {uid}");
|
||||
shell.WriteLine($"No entity found with uid {uid}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,14 +75,13 @@ namespace Content.Server.Commands.Body
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player,
|
||||
"You must specify an entity to add a hand to when using this command from the server terminal.");
|
||||
shell.WriteLine("You must specify an entity to add a hand to when using this command from the server terminal.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity to add a hand to.");
|
||||
shell.WriteLine("You don't have an entity to add a hand to.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,13 +95,13 @@ namespace Content.Server.Commands.Body
|
||||
{
|
||||
if (!EntityUid.TryParse(args[0], out var uid))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid entity uid.");
|
||||
shell.WriteLine($"{args[0]} is not a valid entity uid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.TryGetEntity(uid, out var parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity exists with uid {uid}.");
|
||||
shell.WriteLine($"No entity exists with uid {uid}.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Content.Server.Commands.Body
|
||||
|
||||
if (!prototypeManager.HasIndex<EntityPrototype>(args[1]))
|
||||
{
|
||||
shell.SendText(player, $"No hand entity exists with id {args[1]}.");
|
||||
shell.WriteLine($"No hand entity exists with id {args[1]}.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Content.Server.Commands.Body
|
||||
}
|
||||
default:
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -129,13 +129,13 @@ namespace Content.Server.Commands.Body
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
|
||||
|
||||
shell.SendText(player, text);
|
||||
shell.WriteLine(text);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hand.TryGetComponent(out IBodyPart? part))
|
||||
{
|
||||
shell.SendText(player, $"Hand entity {hand} does not have a {nameof(IBodyPart)} component.");
|
||||
shell.WriteLine($"Hand entity {hand} does not have a {nameof(IBodyPart)} component.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Content.Server.Commands.Body
|
||||
? $"Added hand to entity {entity.Name}"
|
||||
: $"Error occurred trying to add a hand to entity {entity.Name}";
|
||||
|
||||
shell.SendText(player, response);
|
||||
shell.WriteLine(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
@@ -11,29 +11,30 @@ using Robust.Shared.Random;
|
||||
namespace Content.Server.Commands.Body
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
class DestroyMechanismCommand : IClientCommand
|
||||
class DestroyMechanismCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "destroymechanism";
|
||||
public string Description => "Destroys a mechanism from your entity";
|
||||
public string Help => $"Usage: {Command} <mechanism>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "Only a player can run this command.");
|
||||
shell.WriteLine("Only a player can run this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You have no entity.");
|
||||
shell.WriteLine("You have no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ namespace Content.Server.Commands.Body
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
|
||||
|
||||
shell.SendText(player, text);
|
||||
shell.WriteLine(text);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,12 +55,12 @@ namespace Content.Server.Commands.Body
|
||||
if (mechanism.Name.ToLowerInvariant() == mechanismName)
|
||||
{
|
||||
part.DeleteMechanism(mechanism);
|
||||
shell.SendText(player, $"Mechanism with name {mechanismName} has been destroyed.");
|
||||
shell.WriteLine($"Mechanism with name {mechanismName} has been destroyed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
shell.SendText(player, $"No mechanism was found with name {mechanismName}.");
|
||||
shell.WriteLine($"No mechanism was found with name {mechanismName}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
@@ -13,23 +13,24 @@ using Robust.Shared.Random;
|
||||
namespace Content.Server.Commands.Body
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
class RemoveHandCommand : IClientCommand
|
||||
class RemoveHandCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "removehand";
|
||||
public string Description => "Removes a hand from your entity.";
|
||||
public string Help => $"Usage: {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "Only a player can run this command.");
|
||||
shell.WriteLine("Only a player can run this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You have no entity.");
|
||||
shell.WriteLine("You have no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,14 +39,14 @@ namespace Content.Server.Commands.Body
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
|
||||
|
||||
shell.SendText(player, text);
|
||||
shell.WriteLine(text);
|
||||
return;
|
||||
}
|
||||
|
||||
var (_, hand) = body.Parts.FirstOrDefault(x => x.Value.PartType == BodyPartType.Hand);
|
||||
if (hand == null)
|
||||
{
|
||||
shell.SendText(player, "You have no hands.");
|
||||
shell.WriteLine("You have no hands.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
internal class AdminChatCommand : IClientCommand
|
||||
internal class AdminChatCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "asay";
|
||||
public string Description => "Send chat messages to the private admin chat channel.";
|
||||
public string Help => "asay <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length < 1)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AnyCommand]
|
||||
internal class MeCommand : IClientCommand
|
||||
internal class MeCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "me";
|
||||
public string Description => "Perform an action.";
|
||||
public string Help => "me <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "This command cannot be run from the server.");
|
||||
shell.WriteLine("This command cannot be run from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
if (mindComponent == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have a mind!");
|
||||
shell.WriteLine("You don't have a mind!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AnyCommand]
|
||||
internal class OOCCommand : IClientCommand
|
||||
internal class OOCCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "ooc";
|
||||
public string Description => "Send Out Of Character chat messages.";
|
||||
public string Help => "ooc <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length < 1)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AnyCommand]
|
||||
internal class SayCommand : IClientCommand
|
||||
internal class SayCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "say";
|
||||
public string Description => "Send chat messages to the local channel or a specified radio channel.";
|
||||
public string Help => "say <text>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "This command cannot be run from the server.");
|
||||
shell.WriteLine("This command cannot be run from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,7 +41,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
if (playerEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have an entity!");
|
||||
shell.WriteLine("You don't have an entity!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
if (mindComponent == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have a mind!");
|
||||
shell.WriteLine("You don't have a mind!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
@@ -12,8 +12,8 @@ using Content.Server.Utility;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -22,7 +22,7 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Commands.Chat
|
||||
{
|
||||
[AnyCommand]
|
||||
internal class SuicideCommand : IClientCommand
|
||||
internal class SuicideCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "suicide";
|
||||
|
||||
@@ -56,11 +56,12 @@ namespace Content.Server.Commands.Chat
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot run this command from the server.");
|
||||
shell.WriteLine("You cannot run this command from the server.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +73,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
if (owner == null)
|
||||
{
|
||||
shell.SendText(player, "You don't have a mind!");
|
||||
shell.WriteLine("You don't have a mind!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ namespace Content.Server.Commands.Chat
|
||||
|
||||
// Prevent the player from returning to the body. Yes, this is an ugly hack.
|
||||
var ghost = new Ghost(){CanReturn = false};
|
||||
ghost.Execute(shell, player, Array.Empty<string>());
|
||||
ghost.Execute(shell, argStr, Array.Empty<string>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
@@ -26,11 +27,11 @@ namespace Content.Server.Commands
|
||||
if (Guid.TryParse(usernameOrId, out var targetGuid))
|
||||
{
|
||||
if (plyMgr.TryGetSessionById(new NetUserId(targetGuid), out session)) return true;
|
||||
shell.SendText(performer, "Unable to find user with that name/id.");
|
||||
shell.WriteLine("Unable to find user with that name/id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
shell.SendText(performer, "Unable to find user with that name/id.");
|
||||
shell.WriteLine("Unable to find user with that name/id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,7 +46,7 @@ namespace Content.Server.Commands
|
||||
if (!TryGetSessionByUsernameOrId(shell, usernameOrId, performer, out var session)) return false;
|
||||
if (session.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(performer, "User has no attached entity.");
|
||||
shell.WriteLine("User has no attached entity.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Commands.Damage
|
||||
{
|
||||
@@ -13,15 +14,16 @@ namespace Content.Server.Commands.Damage
|
||||
public override string Description => "Adds a damage flag to your entity or another.";
|
||||
public override string Help => $"Usage: {Command} <flag> / {Command} <entityUid> <flag>";
|
||||
|
||||
public override void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (!TryGetEntity(shell, player, args, true, out var entity, out var flag, out var damageable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
damageable.AddFlag(flag);
|
||||
shell.SendText(player, $"Added damage flag {flag} to entity {entity.Name}");
|
||||
shell.WriteLine($"Added damage flag {flag} to entity {entity.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Damage
|
||||
{
|
||||
public abstract class DamageFlagCommand : IClientCommand
|
||||
public abstract class DamageFlagCommand : IConsoleCommand
|
||||
{
|
||||
public abstract string Command { get; }
|
||||
public abstract string Description { get; }
|
||||
public abstract string Help { get; }
|
||||
|
||||
public abstract void Execute(IConsoleShell shell, IPlayerSession? player, string[] args);
|
||||
public abstract void Execute(IConsoleShell shell, string argStr, string[] args);
|
||||
|
||||
public bool TryGetEntity(
|
||||
IConsoleShell shell,
|
||||
@@ -41,19 +41,19 @@ namespace Content.Server.Commands.Damage
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "An entity needs to be specified when the command isn't used by a player.");
|
||||
shell.WriteLine("An entity needs to be specified when the command isn't used by a player.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "An entity needs to be specified when you aren't attached to an entity.");
|
||||
shell.WriteLine("An entity needs to be specified when you aren't attached to an entity.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[0], true, out parsedFlag))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid damage flag.");
|
||||
shell.WriteLine($"{args[0]} is not a valid damage flag.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,44 +65,44 @@ namespace Content.Server.Commands.Damage
|
||||
{
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid entity id.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid entity id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(id, out parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity found with id {id}.");
|
||||
shell.WriteLine($"No entity found with id {id}.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(args[1], true, out parsedFlag))
|
||||
{
|
||||
shell.SendText(player, $"{args[1]} is not a valid damage flag.");
|
||||
shell.WriteLine($"{args[1]} is not a valid damage flag.");
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parsedEntity.TryGetComponent(out parsedDamageable))
|
||||
{
|
||||
shell.SendText(player, $"Entity {parsedEntity.Name} doesn't have a {nameof(IDamageableComponent)}");
|
||||
shell.WriteLine($"Entity {parsedEntity.Name} doesn't have a {nameof(IDamageableComponent)}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parsedDamageable.HasFlag(parsedFlag) && adding)
|
||||
{
|
||||
shell.SendText(player, $"Entity {parsedEntity.Name} already has damage flag {parsedFlag}.");
|
||||
shell.WriteLine($"Entity {parsedEntity.Name} already has damage flag {parsedFlag}.");
|
||||
return false;
|
||||
}
|
||||
else if (!parsedDamageable.HasFlag(parsedFlag) && !adding)
|
||||
{
|
||||
shell.SendText(player, $"Entity {parsedEntity.Name} doesn't have damage flag {parsedFlag}.");
|
||||
shell.WriteLine($"Entity {parsedEntity.Name} doesn't have damage flag {parsedFlag}.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -12,14 +12,15 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands.Damage
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class GodModeCommand : IClientCommand
|
||||
public class GodModeCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "godmode";
|
||||
public string Description => "Makes your entity or another invulnerable to almost anything. May have irreversible changes.";
|
||||
public string Help => $"Usage: {Command} / {Command} <entityUid>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
IEntity entity;
|
||||
|
||||
switch (args.Length)
|
||||
@@ -27,13 +28,13 @@ namespace Content.Server.Commands.Damage
|
||||
case 0:
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "An entity needs to be specified when the command isn't used by a player.");
|
||||
shell.WriteLine("An entity needs to be specified when the command isn't used by a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "An entity needs to be specified when you aren't attached to an entity.");
|
||||
shell.WriteLine("An entity needs to be specified when you aren't attached to an entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,28 +43,28 @@ namespace Content.Server.Commands.Damage
|
||||
case 1:
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid entity id.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid entity id.");
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(id, out var parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity found with id {id}.");
|
||||
shell.WriteLine($"No entity found with id {id}.");
|
||||
return;
|
||||
}
|
||||
|
||||
entity = parsedEntity;
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
var godmodeSystem = EntitySystem.Get<GodmodeSystem>();
|
||||
var enabled = godmodeSystem.ToggleGodmode(entity);
|
||||
|
||||
shell.SendText(player, enabled
|
||||
shell.WriteLine(enabled
|
||||
? $"Enabled godmode for entity {entity.Name} with id {entity.Uid}"
|
||||
: $"Disabled godmode for entity {entity.Name} with id {entity.Uid}");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Commands.Damage
|
||||
{
|
||||
@@ -13,15 +14,16 @@ namespace Content.Server.Commands.Damage
|
||||
public override string Description => "Removes a damage flag from your entity or another.";
|
||||
public override string Help => $"Usage: {Command} <flag> / {Command} <entityUid> <flag>";
|
||||
|
||||
public override void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (!TryGetEntity(shell, player, args, false, out var entity, out var flag, out var damageable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
damageable.RemoveFlag(flag);
|
||||
shell.SendText(player, $"Removed damage flag {flag} from entity {entity.Name}");
|
||||
shell.WriteLine($"Removed damage flag {flag} from entity {entity.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Disposal;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,42 +12,43 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Commands.Disposal
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class TubeConnectionsCommand : IClientCommand
|
||||
public class TubeConnectionsCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "tubeconnections";
|
||||
public string Description => Loc.GetString("Shows all the directions that a tube can connect in.");
|
||||
public string Help => $"Usage: {Command} <entityUid>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Only players can use this command"));
|
||||
shell.WriteLine(Loc.GetString("Only players can use this command"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("{0} isn't a valid entity uid", args[0]));
|
||||
shell.WriteLine(Loc.GetString("{0} isn't a valid entity uid", args[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(id, out var entity))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("No entity exists with uid {0}", id));
|
||||
shell.WriteLine(Loc.GetString("No entity exists with uid {0}", id));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.TryGetComponent(out IDisposalTubeComponent? tube))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Entity with uid {0} doesn't have a {1} component", id, nameof(IDisposalTubeComponent)));
|
||||
shell.WriteLine(Loc.GetString("Entity with uid {0} doesn't have a {1} component", id, nameof(IDisposalTubeComponent)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,17 +12,17 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Mapping)]
|
||||
public class FindEntitiesWithComponents : IClientCommand
|
||||
public class FindEntitiesWithComponents : IConsoleCommand
|
||||
{
|
||||
public string Command => "findentitieswithcomponents";
|
||||
public string Description => "Finds entities with all of the specified components.";
|
||||
public string Help => $"{Command} <componentName1> <componentName2>...";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
shell.SendText(player, $"Invalid amount of arguments: {args.Length}.\n{Help}");
|
||||
shell.WriteLine($"Invalid amount of arguments: {args.Length}.\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (invalidArgs.Count > 0)
|
||||
{
|
||||
shell.SendText(player, $"No component found for component names: {string.Join(", ", invalidArgs)}");
|
||||
shell.WriteLine($"No component found for component names: {string.Join(", ", invalidArgs)}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ namespace Content.Server.Commands
|
||||
|
||||
if (entityIds.Count == 0)
|
||||
{
|
||||
shell.SendText(player, $"No entities found with components {string.Join(", ", args)}.");
|
||||
shell.WriteLine($"No entities found with components {string.Join(", ", args)}.");
|
||||
return;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"{entityIds.Count} entities found:\n{string.Join("\n", entityIds)}");
|
||||
shell.WriteLine($"{entityIds.Count} entities found:\n{string.Join("\n", entityIds)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,51 +3,51 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class DelayStartCommand : IClientCommand
|
||||
class DelayStartCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "delaystart";
|
||||
public string Description => "Delays the round start.";
|
||||
public string Help => $"Usage: {Command} <seconds>\nPauses/Resumes the countdown if no argument is provided.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "This can only be executed while the game is in the pre-round lobby.");
|
||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
var paused = ticker.TogglePause();
|
||||
shell.SendText(player, paused ? "Paused the countdown." : "Resumed the countdown.");
|
||||
shell.WriteLine(paused ? "Paused the countdown." : "Resumed the countdown.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Need zero or one arguments.");
|
||||
shell.WriteLine("Need zero or one arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!uint.TryParse(args[0], out var seconds) || seconds == 0)
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid amount of seconds.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid amount of seconds.");
|
||||
return;
|
||||
}
|
||||
|
||||
var time = TimeSpan.FromSeconds(seconds);
|
||||
if (!ticker.DelayStart(time))
|
||||
{
|
||||
shell.SendText(player, "An unknown error has occurred.");
|
||||
shell.WriteLine("An unknown error has occurred.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,26 +3,26 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class EndRoundCommand : IClientCommand
|
||||
class EndRoundCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "endround";
|
||||
public string Description => "Ends the round and moves the server to PostRound.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
|
||||
if (ticker.RunLevel != GameRunLevel.InRound)
|
||||
{
|
||||
shell.SendText(player, "This can only be executed while the game is in a round.");
|
||||
shell.WriteLine("This can only be executed while the game is in a round.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,43 +2,43 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class ForcePresetCommand : IClientCommand
|
||||
class ForcePresetCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "forcepreset";
|
||||
public string Description => "Forces a specific game preset to start for the current lobby.";
|
||||
public string Help => $"Usage: {Command} <preset>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "This can only be executed while the game is in the pre-round lobby.");
|
||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Need exactly one argument.");
|
||||
shell.WriteLine("Need exactly one argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
var name = args[0];
|
||||
if (!ticker.TryGetPreset(name, out var type))
|
||||
{
|
||||
shell.SendText(player, $"No preset exists with name {name}.");
|
||||
shell.WriteLine($"No preset exists with name {name}.");
|
||||
return;
|
||||
}
|
||||
|
||||
ticker.SetStartPreset(type, true);
|
||||
shell.SendText(player, $"Forced the game to start with preset {name}.");
|
||||
shell.WriteLine($"Forced the game to start with preset {name}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -13,12 +13,12 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
public class GoLobbyCommand : IClientCommand
|
||||
public class GoLobbyCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "golobby";
|
||||
public string Description => "Enables the lobby and restarts the round.";
|
||||
public string Help => $"Usage: {Command} / {Command} <preset>";
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
Type? preset = null;
|
||||
var presetName = string.Join(" ", args);
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
if (!ticker.TryGetPreset(presetName, out preset))
|
||||
{
|
||||
shell.SendText(player, $"No preset found with name {presetName}");
|
||||
shell.WriteLine($"No preset found with name {presetName}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
ticker.SetStartPreset(preset);
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Enabling the lobby and restarting the round.{(preset == null ? "" : $"\nPreset set to {presetName}")}");
|
||||
shell.WriteLine($"Enabling the lobby and restarting the round.{(preset == null ? "" : $"\nPreset set to {presetName}")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AnyCommand]
|
||||
class JoinGameCommand : IClientCommand
|
||||
class JoinGameCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -23,8 +23,9 @@ namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var output = string.Join(".", args);
|
||||
if (player == null)
|
||||
{
|
||||
@@ -34,7 +35,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
if (ticker.RunLevel == GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "Round has not started.");
|
||||
shell.WriteLine("Round has not started.");
|
||||
return;
|
||||
}
|
||||
else if(ticker.RunLevel == GameRunLevel.InRound)
|
||||
@@ -45,7 +46,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
if(positions.GetValueOrDefault(ID, 0) == 0) //n < 0 is treated as infinite
|
||||
{
|
||||
var jobPrototype = _prototypeManager.Index<JobPrototype>(ID);
|
||||
shell.SendText(player, $"{jobPrototype.Name} has no available slots.");
|
||||
shell.WriteLine($"{jobPrototype.Name} has no available slots.");
|
||||
return;
|
||||
}
|
||||
ticker.MakeJoinGame(player, args[0].ToString());
|
||||
@@ -55,4 +56,4 @@ namespace Content.Server.Commands.GameTicking
|
||||
ticker.MakeJoinGame(player, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Server.Interfaces.Timing;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -11,17 +11,18 @@ using Robust.Shared.Utility;
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server | AdminFlags.Mapping)]
|
||||
class MappingCommand : IClientCommand
|
||||
class MappingCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "mapping";
|
||||
public string Description => "Creates and teleports you to a new uninitialized map for mapping.";
|
||||
public string Help => $"Usage: {Command} <mapname> / {Command} <id> <mapname>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "Only players can use this command");
|
||||
shell.WriteLine("Only players can use this command");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,7 +35,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
case 1:
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "The map name argument cannot be omitted if you have no entity.");
|
||||
shell.WriteLine("The map name argument cannot be omitted if you have no entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,7 +45,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
case 2:
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,21 +53,21 @@ namespace Content.Server.Commands.GameTicking
|
||||
mapName = args[1];
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
shell.ExecuteCommand(player, $"addmap {mapId} false");
|
||||
shell.ExecuteCommand(player, $"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true");
|
||||
shell.ExecuteCommand(player, "aghost");
|
||||
shell.ExecuteCommand(player, $"tp 0 0 {mapId}");
|
||||
shell.ExecuteCommand($"addmap {mapId} false");
|
||||
shell.ExecuteCommand($"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true");
|
||||
shell.ExecuteCommand("aghost");
|
||||
shell.ExecuteCommand($"tp 0 0 {mapId}");
|
||||
|
||||
var newGrid = mapManager.GetAllGrids().OrderByDescending(g => (int) g.Index).First();
|
||||
var pauseManager = IoCManager.Resolve<IPauseManager>();
|
||||
|
||||
pauseManager.SetMapPaused(newGrid.ParentMapId, true);
|
||||
|
||||
shell.SendText(player, $"Created unloaded map from file {mapName} with id {mapId}. Use \"savebp {newGrid.Index} foo.yml\" to save the new grid as a map.");
|
||||
shell.WriteLine($"Created unloaded map from file {mapName} with id {mapId}. Use \"savebp {newGrid.Index} foo.yml\" to save the new grid as a map.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
public class NewRoundCommand : IClientCommand
|
||||
public class NewRoundCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "restartround";
|
||||
public string Description => "Moves the server from PostRound to a new PreRoundLobby.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
ticker.RestartRound();
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AnyCommand]
|
||||
class ObserveCommand : IClientCommand
|
||||
class ObserveCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "observe";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
@@ -24,4 +25,4 @@ namespace Content.Server.Commands.GameTicking
|
||||
ticker.MakeObserve(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class SetGamePresetCommand : IClientCommand
|
||||
class SetGamePresetCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "setgamepreset";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Need exactly one argument.");
|
||||
shell.WriteLine("Need exactly one argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,26 +3,26 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class StartRoundCommand : IClientCommand
|
||||
class StartRoundCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "startround";
|
||||
public string Description => "Ends PreRoundLobby state and starts the round.";
|
||||
public string Help => String.Empty;
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ticker = IoCManager.Resolve<IGameTicker>();
|
||||
|
||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "This can only be executed while the game is in the pre-round lobby.");
|
||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Components.Transform;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
@@ -12,15 +12,16 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Mapping)]
|
||||
class TileWallsCommand : IClientCommand
|
||||
class TileWallsCommand : IConsoleCommand
|
||||
{
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
public string Command => "tilewalls";
|
||||
public string Description => "Puts an underplating tile below every wall on a grid.";
|
||||
public string Help => $"Usage: {Command} <gridId> | {Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
GridId gridId;
|
||||
|
||||
switch (args.Length)
|
||||
@@ -28,7 +29,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
case 0:
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Only a player can run this command.");
|
||||
shell.WriteLine("Only a player can run this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,28 +38,28 @@ namespace Content.Server.Commands.GameTicking
|
||||
case 1:
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = new GridId(id);
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
{
|
||||
shell.SendText(player, $"No grid exists with id {gridId}");
|
||||
shell.WriteLine($"No grid exists with id {gridId}");
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||
{
|
||||
shell.SendText(player, $"Grid {gridId} doesn't have an associated grid entity.");
|
||||
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
changed++;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Changed {changed} tiles.");
|
||||
shell.WriteLine($"Changed {changed} tiles.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
class ToggleDisallowLateJoinCommand : IClientCommand
|
||||
class ToggleDisallowLateJoinCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "toggledisallowlatejoin";
|
||||
public string Description => "Allows or disallows latejoining during mid-game.";
|
||||
public string Help => $"Usage: {Command} <disallow>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Need exactly one argument.");
|
||||
shell.WriteLine("Need exactly one argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace Content.Server.Commands.GameTicking
|
||||
if (bool.TryParse(args[0], out var result))
|
||||
{
|
||||
ticker.ToggleDisallowLateJoin(bool.Parse(args[0]));
|
||||
shell.SendText(player, result ? "Late joining has been disabled." : "Late joining has been enabled.");
|
||||
shell.WriteLine(result ? "Late joining has been disabled." : "Late joining has been enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Invalid argument.");
|
||||
shell.WriteLine("Invalid argument.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
[AnyCommand]
|
||||
class ToggleReadyCommand : IClientCommand
|
||||
class ToggleReadyCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "toggleready";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
@@ -24,4 +25,4 @@ namespace Content.Server.Commands.GameTicking
|
||||
ticker.ToggleReady(player, bool.Parse(args[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class HideContainedContextCommand : IClientCommand
|
||||
public class HideContainedContextCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "hidecontainedcontext";
|
||||
public string Description => $"Reverts the effects of {ShowContainedContextCommand.CommandName}";
|
||||
public string Help => $"{Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You need to be a player to use this command.");
|
||||
shell.WriteLine("You need to be a player to use this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.GameObjects.Components.Nutrition;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class Hungry : IClientCommand
|
||||
public class Hungry : IConsoleCommand
|
||||
{
|
||||
public string Command => "hungry";
|
||||
public string Description => "Makes you hungry.";
|
||||
public string Help => $"{Command}";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot use this command unless you are a player.");
|
||||
shell.WriteLine("You cannot use this command unless you are a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot use this command without an entity.");
|
||||
shell.WriteLine("You cannot use this command without an entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.AttachedEntity.TryGetComponent(out HungerComponent? hunger))
|
||||
{
|
||||
shell.SendText(player, $"Your entity does not have a {nameof(HungerComponent)} component.");
|
||||
shell.WriteLine($"Your entity does not have a {nameof(HungerComponent)} component.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
@@ -6,8 +6,8 @@ using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -15,7 +15,7 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
class HurtCommand : IClientCommand
|
||||
class HurtCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "hurt";
|
||||
public string Description => "Ouch";
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (playerEntity == null)
|
||||
{
|
||||
shell.SendText(player, $"You must have a player entity to use this command without specifying an entity.\n{Help}");
|
||||
shell.WriteLine($"You must have a player entity to use this command without specifying an entity.\n{Help}");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (!EntityUid.TryParse(arg, out var entityUid))
|
||||
{
|
||||
shell.SendText(player, $"{arg} is not a valid entity uid.\n{Help}");
|
||||
shell.WriteLine($"{arg} is not a valid entity uid.\n{Help}");
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (!entityManager.TryGetEntity(entityUid, out var parsedEntity))
|
||||
{
|
||||
shell.SendText(player, $"No entity found with uid {entityUid}");
|
||||
shell.WriteLine($"No entity found with uid {entityUid}");
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace Content.Server.Commands
|
||||
{
|
||||
if (!int.TryParse(args[1], out var amount))
|
||||
{
|
||||
shell.SendText(player, $"{args[1]} is not a valid damage integer.");
|
||||
shell.WriteLine($"{args[1]} is not a valid damage integer.");
|
||||
|
||||
func = null;
|
||||
return false;
|
||||
@@ -101,20 +101,19 @@ namespace Content.Server.Commands
|
||||
{
|
||||
if (!damageable.DamageClasses.ContainsKey(damageClass))
|
||||
{
|
||||
shell.SendText(player, $"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} can not be damaged with damage class {damageClass}");
|
||||
shell.WriteLine($"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} can not be damaged with damage class {damageClass}");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!damageable.ChangeDamage(damageClass, amount, ignoreResistances))
|
||||
{
|
||||
shell.SendText(player, $"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} received no damage.");
|
||||
shell.WriteLine($"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} received no damage.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
shell.SendText(player,
|
||||
$"Damaged entity {damageable.Owner.Name} with id {damageable.Owner.Uid} for {amount} {damageClass} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
shell.WriteLine($"Damaged entity {damageable.Owner.Name} with id {damageable.Owner.Uid} for {amount} {damageClass} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
};
|
||||
|
||||
return true;
|
||||
@@ -126,37 +125,38 @@ namespace Content.Server.Commands
|
||||
{
|
||||
if (!damageable.DamageTypes.ContainsKey(damageType))
|
||||
{
|
||||
shell.SendText(player, $"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} can not be damaged with damage class {damageType}");
|
||||
shell.WriteLine($"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} can not be damaged with damage class {damageType}");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!damageable.ChangeDamage(damageType, amount, ignoreResistances))
|
||||
{
|
||||
shell.SendText(player, $"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} received no damage.");
|
||||
shell.WriteLine($"Entity {damageable.Owner.Name} with id {damageable.Owner.Uid} received no damage.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Damaged entity {damageable.Owner.Name} with id {damageable.Owner.Uid} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
shell.WriteLine($"Damaged entity {damageable.Owner.Name} with id {damageable.Owner.Uid} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid damage class or type.");
|
||||
shell.WriteLine($"{args[0]} is not a valid damage class or type.");
|
||||
|
||||
var types = DamageTypes();
|
||||
shell.SendText(player, types);
|
||||
shell.WriteLine(types);
|
||||
|
||||
func = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
bool ignoreResistances;
|
||||
IEntity entity;
|
||||
Damage? damageFunc;
|
||||
@@ -172,12 +172,12 @@ namespace Content.Server.Commands
|
||||
types = types.Replace('e', 'é');
|
||||
}
|
||||
|
||||
shell.SendText(player, types);
|
||||
shell.WriteLine(types);
|
||||
|
||||
return;
|
||||
// Not enough args
|
||||
case var n when n < 2:
|
||||
shell.SendText(player, $"Invalid number of arguments ({args.Length}).\n{Help}");
|
||||
shell.WriteLine($"Invalid number of arguments ({args.Length}).\n{Help}");
|
||||
return;
|
||||
case var n when n >= 2 && n <= 4:
|
||||
if (!TryParseDamageArgs(shell, player, args, out damageFunc))
|
||||
@@ -198,7 +198,7 @@ namespace Content.Server.Commands
|
||||
{
|
||||
if (!bool.TryParse(args[3], out ignoreResistances))
|
||||
{
|
||||
shell.SendText(player, $"{args[3]} is not a valid boolean value for ignoreResistances.\n{Help}");
|
||||
shell.WriteLine($"{args[3]} is not a valid boolean value for ignoreResistances.\n{Help}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -209,13 +209,13 @@ namespace Content.Server.Commands
|
||||
|
||||
break;
|
||||
default:
|
||||
shell.SendText(player, $"Invalid amount of arguments ({args.Length}).\n{Help}");
|
||||
shell.WriteLine($"Invalid amount of arguments ({args.Length}).\n{Help}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.TryGetComponent(out IDamageableComponent? damageable))
|
||||
{
|
||||
shell.SendText(player, $"Entity {entity.Name} with id {entity.Uid} does not have a {nameof(IDamageableComponent)}.");
|
||||
shell.WriteLine($"Entity {entity.Name} with id {entity.Uid} does not have a {nameof(IDamageableComponent)}.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Interactable
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
class AnchorCommand : IClientCommand
|
||||
class AnchorCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "anchor";
|
||||
public string Description => "Anchors all entities in a radius around the user";
|
||||
public string Help => $"Usage: {Command} <radius>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
return;
|
||||
@@ -26,19 +27,19 @@ namespace Content.Server.Commands.Interactable
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var radius))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid integer.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
shell.SendText(player, "Radius must be positive.");
|
||||
shell.WriteLine("Radius must be positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -15,14 +15,15 @@ namespace Content.Server.Commands.Interactable
|
||||
/// <see cref="TilePryingComponent.TryPryTile"/>
|
||||
/// </summary>
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
class TilePryCommand : IClientCommand
|
||||
class TilePryCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "tilepry";
|
||||
public string Description => "Pries up all tiles in a radius around the user.";
|
||||
public string Help => $"Usage: {Command} <radius>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
return;
|
||||
@@ -30,19 +31,19 @@ namespace Content.Server.Commands.Interactable
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var radius))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid integer.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
shell.SendText(player, "Radius must be positive.");
|
||||
shell.WriteLine("Radius must be positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Interactable
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
class UnAnchorCommand : IClientCommand
|
||||
class UnAnchorCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "unanchor";
|
||||
public string Description => "Unanchors all anchorable entities in a radius around the user";
|
||||
public string Help => $"Usage: {Command} <radius>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
return;
|
||||
@@ -26,19 +27,19 @@ namespace Content.Server.Commands.Interactable
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var radius))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} isn't a valid integer.");
|
||||
shell.WriteLine($"{args[0]} isn't a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
shell.SendText(player, "Radius must be positive.");
|
||||
shell.WriteLine("Radius must be positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.MachineLinking
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SignalLinkerCommand : IClientCommand
|
||||
public class SignalLinkerCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "signallink";
|
||||
|
||||
@@ -17,8 +17,9 @@ namespace Content.Server.Commands.MachineLinking
|
||||
|
||||
public string Help => "signallink (on/off)";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
bool? enable = null;
|
||||
if (args.Length > 0)
|
||||
{
|
||||
@@ -43,7 +44,7 @@ namespace Content.Server.Commands.MachineLinking
|
||||
}
|
||||
|
||||
var ret = system.SignalLinkerKeybind(player.UserId, enable);
|
||||
shell.SendText(player, ret ? "Enabled" : "Disabled");
|
||||
shell.WriteLine(ret ? "Enabled" : "Disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.Administration;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,23 +12,23 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class MakeSentientCommand : IClientCommand
|
||||
public class MakeSentientCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "makesentient";
|
||||
public string Description => "Makes an entity sentient (able to be controlled by a player)";
|
||||
public string Help => "makesentient <entity id>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Wrong number of arguments.");
|
||||
shell.WriteLine("Wrong number of arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, "Invalid argument.");
|
||||
shell.WriteLine("Invalid argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Commands
|
||||
|
||||
if (!entityManager.TryGetEntity(entId, out var entity) || entity.Deleted)
|
||||
{
|
||||
shell.SendText(player, "Invalid entity specified!");
|
||||
shell.WriteLine("Invalid entity specified!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ using Content.Server.Mobs.Roles;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Commands.Mobs
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class AddRoleCommand : IClientCommand
|
||||
public class AddRoleCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Content.Server.Commands.Mobs
|
||||
|
||||
public string Help => "addrole <session ID> <Role Type>\nThat role type is the actual C# type name.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly 2 arguments.");
|
||||
shell.WriteLine("Expected exactly 2 arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Commands.Mobs
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Can't find that mind");
|
||||
shell.WriteLine("Can't find that mind");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Commands.Mobs
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class MindInfoCommand : IClientCommand
|
||||
public class MindInfoCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "mindinfo";
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace Content.Server.Commands.Mobs
|
||||
|
||||
public string Help => "mindinfo <session ID>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly 1 argument.");
|
||||
shell.WriteLine("Expected exactly 1 argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace Content.Server.Commands.Mobs
|
||||
builder.AppendFormat("{0} ", role.Name);
|
||||
}
|
||||
|
||||
shell.SendText(player, builder.ToString());
|
||||
shell.WriteLine(builder.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Can't find that mind");
|
||||
shell.WriteLine("Can't find that mind");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ using Content.Server.Mobs.Roles;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Commands.Mobs
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public class RemoveRoleCommand : IClientCommand
|
||||
public class RemoveRoleCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Content.Server.Commands.Mobs
|
||||
|
||||
public string Help => "rmrole <session ID> <Role Type>\nThat role type is the actual C# type name.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly 2 arguments.");
|
||||
shell.WriteLine("Expected exactly 2 arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Commands.Mobs
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Can't find that mind");
|
||||
shell.WriteLine("Can't find that mind");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -10,13 +10,13 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Commands.Notify
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class PopupMsgCommand : IClientCommand
|
||||
public class PopupMsgCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "srvpopupmsg";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var entityMgr = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
|
||||
@@ -3,31 +3,31 @@ using Content.Server.Administration;
|
||||
using Content.Server.Objectives;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Commands.Objectives
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class AddObjectiveCommand : IClientCommand
|
||||
public class AddObjectiveCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addobjective";
|
||||
public string Description => "Adds an objective to the player's mind.";
|
||||
public string Help => "addobjective <username> <objectiveID>";
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly 2 arguments.");
|
||||
shell.WriteLine("Expected exactly 2 arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
var mgr = IoCManager.Resolve<IPlayerManager>();
|
||||
if (!mgr.TryGetPlayerDataByUsername(args[0], out var data))
|
||||
{
|
||||
shell.SendText(player, "Can't find the playerdata.");
|
||||
shell.WriteLine("Can't find the playerdata.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,20 +35,20 @@ namespace Content.Server.Commands.Objectives
|
||||
var mind = data.ContentData()?.Mind;
|
||||
if (mind == null)
|
||||
{
|
||||
shell.SendText(player, "Can't find the mind.");
|
||||
shell.WriteLine("Can't find the mind.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IPrototypeManager>()
|
||||
.TryIndex<ObjectivePrototype>(args[1], out var objectivePrototype))
|
||||
{
|
||||
shell.SendText(player, $"Can't find matching ObjectivePrototype {objectivePrototype}");
|
||||
shell.WriteLine($"Can't find matching ObjectivePrototype {objectivePrototype}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mind.TryAddObjective(objectivePrototype))
|
||||
{
|
||||
shell.SendText(player, "Objective requirements dont allow that objective to be added.");
|
||||
shell.WriteLine("Objective requirements dont allow that objective to be added.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 [<username>]";
|
||||
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<IPlayerManager>().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]}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 <username> <index>";
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<IGameTicker>().OnGhostAttempt(mind, CanReturn))
|
||||
{
|
||||
shell?.SendText(player, "You can't ghost right now.");
|
||||
shell?.WriteLine("You can't ghost right now.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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} <entityId> / {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<IEntityManager>();
|
||||
@@ -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}")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <entity id> <value (optional)>";
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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} <component>/?";
|
||||
|
||||
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)
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <eventName/random>: start a particular event now; <eventName> 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<StationEventSystem>().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<StationEventSystem>().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<StationEventSystem>().StopEvent();
|
||||
shell.SendText(player, resultText);
|
||||
shell.WriteLine(resultText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user