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:
@@ -3,25 +3,26 @@ using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class AGhost : IClientCommand
|
||||
public class AGhost : IConsoleCommand
|
||||
{
|
||||
public string Command => "aghost";
|
||||
public string Description => "Makes you an admin ghost.";
|
||||
public string Help => "aghost";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Nah");
|
||||
shell.WriteLine("Nah");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (mind == null)
|
||||
{
|
||||
shell.SendText(player, "You can't ghost here!");
|
||||
shell.WriteLine("You can't ghost here!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
using Content.Server.Database;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
@@ -11,14 +11,15 @@ using Robust.Shared.Network;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Ban)]
|
||||
public sealed class BanCommand : IClientCommand
|
||||
public sealed class BanCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "ban";
|
||||
public string Description => "Bans somebody";
|
||||
public string Help => "Usage: <name or user ID> <reason> <duration in minutes, or 0 for permanent ban>";
|
||||
|
||||
public async void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var plyMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
var dbMan = IoCManager.Resolve<IServerDbManager>();
|
||||
|
||||
@@ -37,7 +38,7 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "Unable to find user with that name.");
|
||||
shell.WriteLine("Unable to find user with that name.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -12,23 +12,24 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class ControlMob : IClientCommand
|
||||
class ControlMob : IConsoleCommand
|
||||
{
|
||||
public string Command => "controlmob";
|
||||
public string Description => Loc.GetString("Transfers user mind to the specified entity.");
|
||||
public string Help => Loc.GetString("Usage: controlmob <mobUid>.");
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Server cannot do this.");
|
||||
shell.WriteLine("Server cannot do this.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Wrong number of arguments."));
|
||||
shell.WriteLine(Loc.GetString("Wrong number of arguments."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,7 +39,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!int.TryParse(args[0], out var targetId))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Argument must be a number."));
|
||||
shell.WriteLine(Loc.GetString("Argument must be a number."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,14 +47,14 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!eUid.IsValid() || !entityManager.EntityExists(eUid))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid entity ID."));
|
||||
shell.WriteLine(Loc.GetString("Invalid entity ID."));
|
||||
return;
|
||||
}
|
||||
|
||||
var target = entityManager.GetEntity(eUid);
|
||||
if (!target.TryGetComponent(out MindComponent mindComponent))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Target entity is not a mob!"));
|
||||
shell.WriteLine(Loc.GetString("Target entity is not a mob!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class DSay : IClientCommand
|
||||
class DSay : IConsoleCommand
|
||||
{
|
||||
public string Command => "dsay";
|
||||
|
||||
@@ -16,11 +16,12 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public string Help => Loc.GetString($"Usage: {Command} <message>");
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Only players can use this command");
|
||||
shell.WriteLine("Only players can use this command");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
#nullable enable
|
||||
@@ -10,17 +10,18 @@ namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[AdminCommand(AdminFlags.None)]
|
||||
public class DeAdminCommand : IClientCommand
|
||||
public class DeAdminCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "deadmin";
|
||||
public string Description => "Temporarily de-admins you so you can experience the round as a normal player.";
|
||||
public string Help => "Usage: deadmin\nUse readmin to re-admin after using this.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot use this command from the server console.");
|
||||
shell.WriteLine("You cannot use this command from the server console.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class DeleteComponent : IClientCommand
|
||||
public class DeleteComponent : IConsoleCommand
|
||||
{
|
||||
public string Command => "deletecomponent";
|
||||
public string Description => "Deletes all instances of the specified component.";
|
||||
public string Help => $"Usage: {Command} <name>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
switch (args.Length)
|
||||
{
|
||||
case 0:
|
||||
shell.SendText(player, $"Not enough arguments.\n{Help}");
|
||||
shell.WriteLine($"Not enough arguments.\n{Help}");
|
||||
break;
|
||||
default:
|
||||
var name = string.Join(" ", args);
|
||||
@@ -28,7 +28,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!componentFactory.TryGetRegistration(name, out var registration))
|
||||
{
|
||||
shell.SendText(player, $"No component exists with name {name}.");
|
||||
shell.WriteLine($"No component exists with name {name}.");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Administration.Commands
|
||||
i++;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Removed {i} components with name {name}.");
|
||||
shell.WriteLine($"Removed {i} components with name {name}.");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -11,7 +11,7 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class DeleteEntitiesWithComponent : IClientCommand
|
||||
class DeleteEntitiesWithComponent : IConsoleCommand
|
||||
{
|
||||
public string Command => "deleteewc";
|
||||
public string Description
|
||||
@@ -29,11 +29,11 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Server.Administration.Commands
|
||||
count += 1;
|
||||
}
|
||||
|
||||
shell.SendText(player, Loc.GetString("Deleted {0} entities", count));
|
||||
shell.WriteLine(Loc.GetString("Deleted {0} entities", count));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -9,17 +9,17 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class DeleteEntitiesWithId : IClientCommand
|
||||
public class DeleteEntitiesWithId : IConsoleCommand
|
||||
{
|
||||
public string Command => "deleteewi";
|
||||
public string Description => "Deletes entities with the specified prototype ID.";
|
||||
public string Help => $"Usage: {Command} <prototypeID>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Content.Server.Administration.Commands
|
||||
i++;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Deleted all entities with id {id}. Occurrences: {i}");
|
||||
shell.WriteLine($"Deleted all entities with id {id}. Occurrences: {i}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Explosions;
|
||||
using Content.Server.Explosions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
#nullable enable
|
||||
@@ -9,18 +9,19 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public sealed class ExplosionCommand : IClientCommand
|
||||
public sealed class ExplosionCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "explode";
|
||||
public string Description => "Train go boom";
|
||||
public string Help => "Usage: explode <x> <y> <dev> <heavy> <light> <flash>\n" +
|
||||
"The explosion happens on the same map as the user.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player?.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You must have an attached entity.");
|
||||
shell.WriteLine("You must have an attached entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Eui;
|
||||
using Content.Server.Eui;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
#nullable enable
|
||||
@@ -9,17 +9,18 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Permissions)]
|
||||
public sealed class OpenPermissionsCommand : IClientCommand
|
||||
public sealed class OpenPermissionsCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "permissions";
|
||||
public string Description => "Opens the admin permissions panel.";
|
||||
public string Help => "Usage: permissions";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "This does not work from the server console.");
|
||||
shell.WriteLine("This does not work from the server console.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class PromoteHostCommand : IClientCommand
|
||||
public sealed class PromoteHostCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "promotehost";
|
||||
public string Description => "Grants client temporary full host admin privileges. Use this to bootstrap admins.";
|
||||
public string Help => "Usage promotehost <player>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Expected exactly one argument.");
|
||||
shell.WriteLine("Expected exactly one argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
var plyMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
if (!plyMgr.TryGetSessionByUsername(args[0], out var targetPlayer))
|
||||
{
|
||||
shell.SendText(player, "Unable to find a player by that name.");
|
||||
shell.WriteLine("Unable to find a player by that name.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
#nullable enable
|
||||
@@ -7,17 +7,18 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AnyCommand]
|
||||
public class ReAdminCommand : IClientCommand
|
||||
public class ReAdminCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "readmin";
|
||||
public string Description => "Re-admins you if you previously de-adminned.";
|
||||
public string Help => "Usage: readmin";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText(player, "You cannot use this command from the server console.");
|
||||
shell.WriteLine("You cannot use this command from the server console.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (mgr.GetAdminData(player, includeDeAdmin: true) == null)
|
||||
{
|
||||
shell.SendText(player, "You're not an admin.");
|
||||
shell.WriteLine("You're not an admin.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
public class ReadyAll : IClientCommand
|
||||
public class ReadyAll : IConsoleCommand
|
||||
{
|
||||
public string Command => "readyall";
|
||||
public string Description => "Readies up all players in the lobby.";
|
||||
public string Help => $"{Command} | ̣{Command} <ready>";
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var ready = true;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
{
|
||||
shell.SendText(player, "This command can only be ran while in the lobby!");
|
||||
shell.WriteLine("This command can only be ran while in the lobby!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.GlobalVerbs;
|
||||
using Content.Server.GlobalVerbs;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -10,7 +10,7 @@ using Robust.Shared.Localization;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class Rejuvenate : IClientCommand
|
||||
class Rejuvenate : IConsoleCommand
|
||||
{
|
||||
public string Command => "rejuvenate";
|
||||
public string Description
|
||||
@@ -28,14 +28,15 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length < 1 && player != null) //Try to heal the users mob if applicable
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Healing the user's mob since no arguments were provided."));
|
||||
shell.WriteLine(Loc.GetString("Healing the user's mob since no arguments were provided."));
|
||||
if (player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("There's no entity attached to the user."));
|
||||
shell.WriteLine(Loc.GetString("There's no entity attached to the user."));
|
||||
return;
|
||||
}
|
||||
RejuvenateVerb.PerformRejuvenate(player.AttachedEntity);
|
||||
@@ -46,7 +47,7 @@ namespace Content.Server.Administration.Commands
|
||||
{
|
||||
if(!EntityUid.TryParse(arg, out var uid) || !entityManager.TryGetEntity(uid, out var entity))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Could not find entity {0}", arg));
|
||||
shell.WriteLine(Loc.GetString("Could not find entity {0}", arg));
|
||||
continue;
|
||||
}
|
||||
RejuvenateVerb.PerformRejuvenate(entity);
|
||||
|
||||
@@ -3,8 +3,8 @@ using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -14,7 +14,7 @@ using Robust.Shared.Prototypes;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
class SetOutfitCommand : IClientCommand
|
||||
class SetOutfitCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "setoutfit";
|
||||
|
||||
@@ -22,17 +22,17 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public string Help => Loc.GetString("Usage: {0} <entityUid> | {0} <entityUid> <outfitId>", Command);
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Wrong number of arguments."));
|
||||
shell.WriteLine(Loc.GetString("Wrong number of arguments."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var entityUid))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("EntityUid must be a number."));
|
||||
shell.WriteLine(Loc.GetString("EntityUid must be a number."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!eUid.IsValid() || !entityManager.EntityExists(eUid))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid entity ID."));
|
||||
shell.WriteLine(Loc.GetString("Invalid entity ID."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!target.TryGetComponent<InventoryComponent>(out var inventoryComponent))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Target entity does not have an inventory!"));
|
||||
shell.WriteLine(Loc.GetString("Target entity does not have an inventory!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace Content.Server.Administration.Commands
|
||||
{
|
||||
var eui = IoCManager.Resolve<EuiManager>();
|
||||
var ui = new SetOutfitEui(target);
|
||||
var player = shell.Player as IPlayerSession;
|
||||
eui.OpenEui(ui, player);
|
||||
return;
|
||||
}
|
||||
@@ -65,7 +66,7 @@ namespace Content.Server.Administration.Commands
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
if (!prototypeManager.TryIndex<StartingGearPrototype>(args[1], out var startingGear))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Invalid outfit id"));
|
||||
shell.WriteLine(Loc.GetString("Invalid outfit id"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Markers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -14,7 +14,7 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class WarpCommand : IClientCommand
|
||||
public class WarpCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "warp";
|
||||
public string Description => "Teleports you to predefined areas on the map.";
|
||||
@@ -23,17 +23,18 @@ namespace Content.Server.Administration.Commands
|
||||
"warp <location>\nLocations you can teleport to are predefined by the map. " +
|
||||
"You can specify '?' as location to get a list of valid locations.";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession) null, "Only players can use this command");
|
||||
shell.WriteLine("Only players can use this command");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.SendText(player, "Expected a single argument.");
|
||||
shell.WriteLine("Expected a single argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,13 +49,13 @@ namespace Content.Server.Administration.Commands
|
||||
.OrderBy(p => p)
|
||||
.Distinct());
|
||||
|
||||
shell.SendText(player, locations);
|
||||
shell.WriteLine(locations);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
|
||||
{
|
||||
shell.SendText(player, "You are not in-game!");
|
||||
shell.WriteLine("You are not in-game!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,7 +122,7 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.SendText(player, "That location does not exist!");
|
||||
shell.WriteLine("That location does not exist!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user