Command resolve and LEC conversion batch 3 (#38378)
* I'm just a silly goober * requested changes * Update Content.Server/Interaction/TilePryCommand.cs --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -10,50 +10,49 @@ using Robust.Shared.Prototypes;
|
|||||||
namespace Content.Server.GameTicking.Commands
|
namespace Content.Server.GameTicking.Commands
|
||||||
{
|
{
|
||||||
[AdminCommand(AdminFlags.Round)]
|
[AdminCommand(AdminFlags.Round)]
|
||||||
sealed class ForceMapCommand : IConsoleCommand
|
public sealed class ForceMapCommand : LocalizedCommands
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
||||||
|
[Dependency] private readonly IGameMapManager _gameMapManager = default!;
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
|
||||||
public string Command => "forcemap";
|
public override string Command => "forcemap";
|
||||||
public string Description => Loc.GetString("forcemap-command-description");
|
|
||||||
public string Help => Loc.GetString("forcemap-command-help");
|
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length != 1)
|
if (args.Length != 1)
|
||||||
{
|
{
|
||||||
shell.WriteLine(Loc.GetString("forcemap-command-need-one-argument"));
|
shell.WriteLine(Loc.GetString(Loc.GetString($"shell-need-exactly-one-argument")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gameMap = IoCManager.Resolve<IGameMapManager>();
|
|
||||||
var name = args[0];
|
var name = args[0];
|
||||||
|
|
||||||
// An empty string clears the forced map
|
// An empty string clears the forced map
|
||||||
if (!string.IsNullOrEmpty(name) && !gameMap.CheckMapExists(name))
|
if (!string.IsNullOrEmpty(name) && !_gameMapManager.CheckMapExists(name))
|
||||||
{
|
{
|
||||||
shell.WriteLine(Loc.GetString("forcemap-command-map-not-found", ("map", name)));
|
shell.WriteLine(Loc.GetString("cmd-forcemap-map-not-found", ("map", name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_configurationManager.SetCVar(CCVars.GameMap, name);
|
_configurationManager.SetCVar(CCVars.GameMap, name);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name))
|
||||||
shell.WriteLine(Loc.GetString("forcemap-command-cleared"));
|
shell.WriteLine(Loc.GetString("cmd-forcemap-cleared"));
|
||||||
else
|
else
|
||||||
shell.WriteLine(Loc.GetString("forcemap-command-success", ("map", name)));
|
shell.WriteLine(Loc.GetString("cmd-forcemap-success", ("map", name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length == 1)
|
if (args.Length == 1)
|
||||||
{
|
{
|
||||||
var options = IoCManager.Resolve<IPrototypeManager>()
|
var options = _prototypeManager
|
||||||
.EnumeratePrototypes<GameMapPrototype>()
|
.EnumeratePrototypes<GameMapPrototype>()
|
||||||
.Select(p => new CompletionOption(p.ID, p.MapName))
|
.Select(p => new CompletionOption(p.ID, p.MapName))
|
||||||
.OrderBy(p => p.Value);
|
.OrderBy(p => p.Value);
|
||||||
|
|
||||||
return CompletionResult.FromHintOptions(options, Loc.GetString("forcemap-command-arg-map"));
|
return CompletionResult.FromHintOptions(options, Loc.GetString($"cmd-forcemap-hint"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompletionResult.Empty;
|
return CompletionResult.Empty;
|
||||||
|
|||||||
@@ -8,51 +8,49 @@ using Robust.Shared.Prototypes;
|
|||||||
namespace Content.Server.GameTicking.Commands
|
namespace Content.Server.GameTicking.Commands
|
||||||
{
|
{
|
||||||
[AdminCommand(AdminFlags.Round)]
|
[AdminCommand(AdminFlags.Round)]
|
||||||
sealed class ForcePresetCommand : IConsoleCommand
|
public sealed class ForcePresetCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _e = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
[Dependency] private readonly GameTicker _ticker = default!;
|
||||||
|
|
||||||
public string Command => "forcepreset";
|
public override 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, string argStr, string[] args)
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var ticker = _e.System<GameTicker>();
|
if (_ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||||
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
|
|
||||||
{
|
{
|
||||||
shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
|
shell.WriteLine(Loc.GetString($"cmd-forcepreset-preround-lobby-only"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Length != 1)
|
if (args.Length != 1)
|
||||||
{
|
{
|
||||||
shell.WriteLine("Need exactly one argument.");
|
shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = args[0];
|
var name = args[0];
|
||||||
if (!ticker.TryFindGamePreset(name, out var type))
|
if (!_ticker.TryFindGamePreset(name, out var type))
|
||||||
{
|
{
|
||||||
shell.WriteLine($"No preset exists with name {name}.");
|
shell.WriteLine(Loc.GetString($"cmd-forcepreset-no-preset-found", ("preset", name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ticker.SetGamePreset(type, true);
|
_ticker.SetGamePreset(type, true);
|
||||||
shell.WriteLine($"Forced the game to start with preset {name}.");
|
shell.WriteLine(Loc.GetString($"cmd-forcepreset-success", ("preset", name)));
|
||||||
ticker.UpdateInfoText();
|
_ticker.UpdateInfoText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length == 1)
|
if (args.Length == 1)
|
||||||
{
|
{
|
||||||
var options = IoCManager.Resolve<IPrototypeManager>()
|
var options = _prototypeManager
|
||||||
.EnumeratePrototypes<GamePresetPrototype>()
|
.EnumeratePrototypes<GamePresetPrototype>()
|
||||||
.OrderBy(p => p.ID)
|
.OrderBy(p => p.ID)
|
||||||
.Select(p => p.ID);
|
.Select(p => p.ID);
|
||||||
|
|
||||||
return CompletionResult.FromHintOptions(options, "<preset>");
|
return CompletionResult.FromHintOptions(options, Loc.GetString($"cmd-forcepreset-hint"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompletionResult.Empty;
|
return CompletionResult.Empty;
|
||||||
|
|||||||
@@ -8,40 +8,35 @@ using Robust.Shared.Console;
|
|||||||
namespace Content.Server.GameTicking.Commands
|
namespace Content.Server.GameTicking.Commands
|
||||||
{
|
{
|
||||||
[AdminCommand(AdminFlags.Round)]
|
[AdminCommand(AdminFlags.Round)]
|
||||||
public sealed class GoLobbyCommand : IConsoleCommand
|
public sealed class GoLobbyCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _e = default!;
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||||
|
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||||
|
|
||||||
public string Command => "golobby";
|
public override string Command => "golobby";
|
||||||
public string Description => "Enables the lobby and restarts the round.";
|
|
||||||
public string Help => $"Usage: {Command} / {Command} <preset>";
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
{
|
||||||
GamePresetPrototype? preset = null;
|
GamePresetPrototype? preset = null;
|
||||||
var presetName = string.Join(" ", args);
|
var presetName = string.Join(" ", args);
|
||||||
|
|
||||||
var ticker = _e.System<GameTicker>();
|
|
||||||
|
|
||||||
if (args.Length > 0)
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
if (!ticker.TryFindGamePreset(presetName, out preset))
|
if (!_gameTicker.TryFindGamePreset(presetName, out preset))
|
||||||
{
|
{
|
||||||
shell.WriteLine($"No preset found with name {presetName}");
|
shell.WriteLine(Loc.GetString($"cmd-forcepreset-no-preset-found", ("preset", presetName)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = IoCManager.Resolve<IConfigurationManager>();
|
_configManager.SetCVar(CCVars.GameLobbyEnabled, true);
|
||||||
config.SetCVar(CCVars.GameLobbyEnabled, true);
|
|
||||||
|
|
||||||
ticker.RestartRound();
|
_gameTicker.RestartRound();
|
||||||
|
|
||||||
if (preset != null)
|
if (preset != null)
|
||||||
{
|
_gameTicker.SetGamePreset(preset);
|
||||||
ticker.SetGamePreset(preset);
|
|
||||||
}
|
|
||||||
|
|
||||||
shell.WriteLine($"Enabling the lobby and restarting the round.{(preset == null ? "" : $"\nPreset set to {presetName}")}");
|
shell.WriteLine(Loc.GetString(preset == null ? "cmd-golobby-success" : "cmd-golobby-success-with-preset", ("preset", presetName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Content.Server.GhostKick;
|
|||||||
|
|
||||||
// Handles logic for "ghost kicking".
|
// Handles logic for "ghost kicking".
|
||||||
// Basically we boot the client off the server without telling them, so the game shits itself.
|
// Basically we boot the client off the server without telling them, so the game shits itself.
|
||||||
// Hilariously isn't it?
|
// Hilarious, isn't it?
|
||||||
|
|
||||||
public sealed class GhostKickManager
|
public sealed class GhostKickManager
|
||||||
{
|
{
|
||||||
@@ -45,32 +45,30 @@ public sealed class GhostKickManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
[AdminCommand(AdminFlags.Moderator)]
|
[AdminCommand(AdminFlags.Moderator)]
|
||||||
public sealed class GhostKickCommand : IConsoleCommand
|
public sealed class GhostKickCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
public string Command => "ghostkick";
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
public string Description => "Kick a client from the server as if their network just dropped.";
|
[Dependency] private readonly GhostKickManager _ghostKick = default!;
|
||||||
public string Help => "Usage: ghostkick <Player> [Reason]";
|
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public override string Command => "ghostkick";
|
||||||
|
|
||||||
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length < 1)
|
if (args.Length < 1)
|
||||||
{
|
{
|
||||||
shell.WriteError("Need at least one argument");
|
shell.WriteError(Loc.GetString($"shell-need-exactly-one-argument"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var playerName = args[0];
|
var playerName = args[0];
|
||||||
var reason = args.Length > 1 ? args[1] : "Ghost kicked by console";
|
var reason = args.Length > 1 ? args[1] : Loc.GetString($"cmd-ghostkick-default-reason");
|
||||||
|
|
||||||
var players = IoCManager.Resolve<IPlayerManager>();
|
if (!_playerManager.TryGetSessionByUsername(playerName, out var player))
|
||||||
var ghostKick = IoCManager.Resolve<GhostKickManager>();
|
|
||||||
|
|
||||||
if (!players.TryGetSessionByUsername(playerName, out var player))
|
|
||||||
{
|
{
|
||||||
shell.WriteError($"Unable to find player: '{playerName}'.");
|
shell.WriteError(Loc.GetString($"shell-target-player-does-not-exist"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ghostKick.DoDisconnect(player.Channel, reason);
|
_ghostKick.DoDisconnect(player.Channel, reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,19 +5,21 @@ using Content.Shared.Maps;
|
|||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Interaction;
|
namespace Content.Server.Interaction;
|
||||||
|
|
||||||
[AdminCommand(AdminFlags.Debug)]
|
[AdminCommand(AdminFlags.Debug)]
|
||||||
public sealed class TilePryCommand : IConsoleCommand
|
public sealed class TilePryCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||||
|
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||||
|
|
||||||
public string Command => "tilepry";
|
private readonly string _platingId = "Plating";
|
||||||
public string Description => "Pries up all tiles in a radius around the user.";
|
|
||||||
public string Help => $"Usage: {Command} <radius>";
|
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public override string Command => "tilepry";
|
||||||
|
|
||||||
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var player = shell.Player;
|
var player = shell.Player;
|
||||||
if (player?.AttachedEntity is not { } attached)
|
if (player?.AttachedEntity is not { } attached)
|
||||||
@@ -33,39 +35,38 @@ public sealed class TilePryCommand : IConsoleCommand
|
|||||||
|
|
||||||
if (!int.TryParse(args[0], out var radius))
|
if (!int.TryParse(args[0], out var radius))
|
||||||
{
|
{
|
||||||
shell.WriteError($"{args[0]} isn't a valid integer.");
|
shell.WriteError(Loc.GetString($"cmd-tilepry-arg-must-be-number", ("arg", args[0])));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radius < 0)
|
if (radius < 0)
|
||||||
{
|
{
|
||||||
shell.WriteError("Radius must be positive.");
|
shell.WriteError(Loc.GetString($"cmd-tilepry-radius-must-be-positive"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapSystem = _entities.System<SharedMapSystem>();
|
var xform = EntityManager.GetComponent<TransformComponent>(attached);
|
||||||
var xform = _entities.GetComponent<TransformComponent>(attached);
|
|
||||||
|
|
||||||
var playerGrid = xform.GridUid;
|
var playerGrid = xform.GridUid;
|
||||||
|
|
||||||
if (!_entities.TryGetComponent<MapGridComponent>(playerGrid, out var mapGrid))
|
if (!EntityManager.TryGetComponent<MapGridComponent>(playerGrid, out var mapGrid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var playerPosition = xform.Coordinates;
|
var playerPosition = xform.Coordinates;
|
||||||
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
|
||||||
|
|
||||||
for (var i = -radius; i <= radius; i++)
|
for (var i = -radius; i <= radius; i++)
|
||||||
{
|
{
|
||||||
for (var j = -radius; j <= radius; j++)
|
for (var j = -radius; j <= radius; j++)
|
||||||
{
|
{
|
||||||
var tile = mapSystem.GetTileRef(playerGrid.Value, mapGrid, playerPosition.Offset(new Vector2(i, j)));
|
var tile = _mapSystem.GetTileRef(playerGrid.Value, mapGrid, playerPosition.Offset(new Vector2(i, j)));
|
||||||
var coordinates = mapSystem.GridTileToLocal(playerGrid.Value, mapGrid, tile.GridIndices);
|
var coordinates = _mapSystem.GridTileToLocal(playerGrid.Value, mapGrid, tile.GridIndices);
|
||||||
var tileDef = (ContentTileDefinition)tileDefinitionManager[tile.Tile.TypeId];
|
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
||||||
|
|
||||||
if (!tileDef.CanCrowbar) continue;
|
if (!tileDef.CanCrowbar)
|
||||||
|
continue;
|
||||||
|
|
||||||
var plating = tileDefinitionManager["Plating"];
|
var plating = _tileDefinitionManager[_platingId];
|
||||||
mapSystem.SetTile(playerGrid.Value, mapGrid, coordinates, new Tile(plating.TileId));
|
_mapSystem.SetTile(playerGrid.Value, mapGrid, coordinates, new Tile(plating.TileId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,24 +13,24 @@ using Robust.Shared.Utility;
|
|||||||
namespace Content.Server.Mapping
|
namespace Content.Server.Mapping
|
||||||
{
|
{
|
||||||
[AdminCommand(AdminFlags.Server | AdminFlags.Mapping)]
|
[AdminCommand(AdminFlags.Server | AdminFlags.Mapping)]
|
||||||
sealed class MappingCommand : IConsoleCommand
|
public sealed class MappingCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IResourceManager _resourceMgr = default!;
|
||||||
|
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||||
|
[Dependency] private readonly MappingSystem _mappingSystem = default!;
|
||||||
|
[Dependency] private readonly MapLoaderSystem _mapLoader = default!;
|
||||||
|
|
||||||
public string Command => "mapping";
|
public override string Command => "mapping";
|
||||||
public string Description => Loc.GetString("cmd-mapping-desc");
|
|
||||||
public string Help => Loc.GetString("cmd-mapping-help");
|
|
||||||
|
|
||||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||||
{
|
{
|
||||||
switch (args.Length)
|
switch (args.Length)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return CompletionResult.FromHint(Loc.GetString("cmd-hint-mapping-id"));
|
return CompletionResult.FromHint(Loc.GetString("cmd-hint-mapping-id"));
|
||||||
case 2:
|
case 2:
|
||||||
var res = IoCManager.Resolve<IResourceManager>();
|
var opts = CompletionHelper.UserFilePath(args[1], _resourceMgr.UserData)
|
||||||
var opts = CompletionHelper.UserFilePath(args[1], res.UserData)
|
.Concat(CompletionHelper.ContentFilePath(args[1], _resourceMgr));
|
||||||
.Concat(CompletionHelper.ContentFilePath(args[1], res));
|
|
||||||
return CompletionResult.FromHintOptions(opts, Loc.GetString("cmd-hint-mapping-path"));
|
return CompletionResult.FromHintOptions(opts, Loc.GetString("cmd-hint-mapping-path"));
|
||||||
case 3:
|
case 3:
|
||||||
return CompletionResult.FromHintOptions(["false", "true"], Loc.GetString("cmd-mapping-hint-grid"));
|
return CompletionResult.FromHintOptions(["false", "true"], Loc.GetString("cmd-mapping-hint-grid"));
|
||||||
@@ -38,7 +38,7 @@ namespace Content.Server.Mapping
|
|||||||
return CompletionResult.Empty;
|
return CompletionResult.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (shell.Player is not { } player)
|
if (shell.Player is not { } player)
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ namespace Content.Server.Mapping
|
|||||||
|
|
||||||
MapId mapId;
|
MapId mapId;
|
||||||
string? toLoad = null;
|
string? toLoad = null;
|
||||||
var mapSys = _entities.System<SharedMapSystem>();
|
|
||||||
Entity<MapGridComponent>? grid = null;
|
Entity<MapGridComponent>? grid = null;
|
||||||
|
|
||||||
// Get the map ID to use
|
// Get the map ID to use
|
||||||
@@ -86,7 +86,7 @@ namespace Content.Server.Mapping
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapSys.MapExists(mapId))
|
if (_mapSystem.MapExists(mapId))
|
||||||
{
|
{
|
||||||
shell.WriteError(Loc.GetString("cmd-mapping-exists", ("mapId", mapId)));
|
shell.WriteError(Loc.GetString("cmd-mapping-exists", ("mapId", mapId)));
|
||||||
return;
|
return;
|
||||||
@@ -95,26 +95,25 @@ namespace Content.Server.Mapping
|
|||||||
// either load a map or create a new one.
|
// either load a map or create a new one.
|
||||||
if (args.Length <= 1)
|
if (args.Length <= 1)
|
||||||
{
|
{
|
||||||
mapSys.CreateMap(mapId, runMapInit: false);
|
_mapSystem.CreateMap(mapId, runMapInit: false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var path = new ResPath(args[1]);
|
var path = new ResPath(args[1]);
|
||||||
toLoad = path.FilenameWithoutExtension;
|
toLoad = path.FilenameWithoutExtension;
|
||||||
var opts = new DeserializationOptions {StoreYamlUids = true};
|
var opts = new DeserializationOptions {StoreYamlUids = true};
|
||||||
var loader = _entities.System<MapLoaderSystem>();
|
|
||||||
|
|
||||||
if (isGrid == true)
|
if (isGrid == true)
|
||||||
{
|
{
|
||||||
mapSys.CreateMap(mapId, runMapInit: false);
|
_mapSystem.CreateMap(mapId, runMapInit: false);
|
||||||
if (!loader.TryLoadGrid(mapId, path, out grid, opts))
|
if (!_mapLoader.TryLoadGrid(mapId, path, out grid, opts))
|
||||||
{
|
{
|
||||||
shell.WriteError(Loc.GetString("cmd-mapping-error"));
|
shell.WriteError(Loc.GetString("cmd-mapping-error"));
|
||||||
mapSys.DeleteMap(mapId);
|
_mapSystem.DeleteMap(mapId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!loader.TryLoadMapWithId(mapId, path, out _, out _, opts))
|
else if (!_mapLoader.TryLoadMapWithId(mapId, path, out _, out _, opts))
|
||||||
{
|
{
|
||||||
if (isGrid == false)
|
if (isGrid == false)
|
||||||
{
|
{
|
||||||
@@ -125,31 +124,29 @@ namespace Content.Server.Mapping
|
|||||||
// isGrid was not specified and loading it as a map failed, so we fall back to trying to load
|
// isGrid was not specified and loading it as a map failed, so we fall back to trying to load
|
||||||
// the file as a grid
|
// the file as a grid
|
||||||
shell.WriteLine(Loc.GetString("cmd-mapping-try-grid"));
|
shell.WriteLine(Loc.GetString("cmd-mapping-try-grid"));
|
||||||
mapSys.CreateMap(mapId, runMapInit: false);
|
_mapSystem.CreateMap(mapId, runMapInit: false);
|
||||||
if (!loader.TryLoadGrid(mapId, path, out grid, opts))
|
if (!_mapLoader.TryLoadGrid(mapId, path, out grid, opts))
|
||||||
{
|
{
|
||||||
shell.WriteError(Loc.GetString("cmd-mapping-error"));
|
shell.WriteError(Loc.GetString("cmd-mapping-error"));
|
||||||
mapSys.DeleteMap(mapId);
|
_mapSystem.DeleteMap(mapId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// was the map actually created or did it fail somehow?
|
// was the map actually created or did it fail somehow?
|
||||||
if (!mapSys.MapExists(mapId))
|
if (!_mapSystem.MapExists(mapId))
|
||||||
{
|
{
|
||||||
shell.WriteError(Loc.GetString("cmd-mapping-error"));
|
shell.WriteError(Loc.GetString("cmd-mapping-error"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
_mapSystem.CreateMap(out mapId, runMapInit: false);
|
||||||
mapSys.CreateMap(out mapId, runMapInit: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// map successfully created. run misc helpful mapping commands
|
// map successfully created. run misc helpful mapping commands
|
||||||
if (player.AttachedEntity is { Valid: true } playerEntity &&
|
if (player.AttachedEntity is { Valid: true } playerEntity &&
|
||||||
_entities.GetComponent<MetaDataComponent>(playerEntity).EntityPrototype?.ID != GameTicker.AdminObserverPrototypeName)
|
EntityManager.GetComponent<MetaDataComponent>(playerEntity).EntityPrototype?.ID != GameTicker.AdminObserverPrototypeName)
|
||||||
{
|
{
|
||||||
shell.ExecuteCommand("aghost");
|
shell.ExecuteCommand("aghost");
|
||||||
}
|
}
|
||||||
@@ -158,15 +155,14 @@ namespace Content.Server.Mapping
|
|||||||
shell.ExecuteCommand("changecvar events.enabled false");
|
shell.ExecuteCommand("changecvar events.enabled false");
|
||||||
shell.ExecuteCommand("changecvar shuttle.auto_call_time 0");
|
shell.ExecuteCommand("changecvar shuttle.auto_call_time 0");
|
||||||
|
|
||||||
var auto = _entities.System<MappingSystem>();
|
|
||||||
if (grid != null)
|
if (grid != null)
|
||||||
auto.ToggleAutosave(grid.Value.Owner, toLoad ?? "NEWGRID");
|
_mappingSystem.ToggleAutosave(grid.Value.Owner, toLoad ?? "NEWGRID");
|
||||||
else
|
else
|
||||||
auto.ToggleAutosave(mapId, toLoad ?? "NEWMAP");
|
_mappingSystem.ToggleAutosave(mapId, toLoad ?? "NEWMAP");
|
||||||
|
|
||||||
shell.ExecuteCommand($"tp 0 0 {mapId}");
|
shell.ExecuteCommand($"tp 0 0 {mapId}");
|
||||||
shell.RemoteExecuteCommand("mappingclientsidesetup");
|
shell.RemoteExecuteCommand("mappingclientsidesetup");
|
||||||
DebugTools.Assert(mapSys.IsPaused(mapId));
|
DebugTools.Assert(_mapSystem.IsPaused(mapId));
|
||||||
|
|
||||||
if (args.Length != 2)
|
if (args.Length != 2)
|
||||||
shell.WriteLine(Loc.GetString("cmd-mapping-success", ("mapId", mapId)));
|
shell.WriteLine(Loc.GetString("cmd-mapping-success", ("mapId", mapId)));
|
||||||
|
|||||||
@@ -9,25 +9,21 @@ namespace Content.Server.Maps;
|
|||||||
/// Toggles GridDragging on the system.
|
/// Toggles GridDragging on the system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AdminCommand(AdminFlags.Fun)]
|
[AdminCommand(AdminFlags.Fun)]
|
||||||
public sealed class GridDraggingCommand : IConsoleCommand
|
public sealed class GridDraggingCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
public string Command => SharedGridDraggingSystem.CommandName;
|
[Dependency] private readonly GridDraggingSystem _grid = default!;
|
||||||
public string Description => $"Allows someone with permissions to drag grids around.";
|
|
||||||
public string Help => $"{Command}";
|
public override string Command => SharedGridDraggingSystem.CommandName;
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (shell.Player == null)
|
if (shell.Player == null)
|
||||||
{
|
{
|
||||||
shell.WriteError("shell-server-cannot");
|
shell.WriteError("shell-only-players-can-run-this-command");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var system = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<GridDraggingSystem>();
|
_grid.Toggle(shell.Player);
|
||||||
system.Toggle(shell.Player);
|
shell.WriteLine(Loc.GetString($"cmd-griddrag-status", ("status", _grid.IsEnabled(shell.Player))));
|
||||||
|
|
||||||
if (system.IsEnabled(shell.Player))
|
|
||||||
shell.WriteLine("Grid dragging toggled on");
|
|
||||||
else
|
|
||||||
shell.WriteLine("Grid dragging toggled off");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,41 +9,38 @@ using Robust.Shared.Console;
|
|||||||
namespace Content.Server.Mind.Commands
|
namespace Content.Server.Mind.Commands
|
||||||
{
|
{
|
||||||
[AdminCommand(AdminFlags.Admin)]
|
[AdminCommand(AdminFlags.Admin)]
|
||||||
public sealed class MindInfoCommand : IConsoleCommand
|
public sealed class MindInfoCommand : LocalizedEntityCommands
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
[Dependency] private readonly SharedRoleSystem _roles = default!;
|
||||||
|
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||||
|
|
||||||
public string Command => "mindinfo";
|
public override string Command => "mindinfo";
|
||||||
public string Description => "Lists info for the mind of a specific player.";
|
|
||||||
public string Help => "mindinfo <session ID>";
|
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length != 1)
|
if (args.Length != 1)
|
||||||
{
|
{
|
||||||
shell.WriteLine("Expected exactly 1 argument.");
|
shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mgr = IoCManager.Resolve<IPlayerManager>();
|
if (!_playerManager.TryGetSessionByUsername(args[0], out var session))
|
||||||
if (!mgr.TryGetSessionByUsername(args[0], out var session))
|
|
||||||
{
|
{
|
||||||
shell.WriteLine("Can't find that mind");
|
shell.WriteLine(Loc.GetString($"cmd-mindinfo-mind-not-found"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var minds = _entities.System<SharedMindSystem>();
|
if (!_minds.TryGetMind(session, out var mindId, out var mind))
|
||||||
if (!minds.TryGetMind(session, out var mindId, out var mind))
|
|
||||||
{
|
{
|
||||||
shell.WriteLine("Can't find that mind");
|
shell.WriteLine(Loc.GetString($"cmd-mindinfo-mind-not-found"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.UserId, mind.OwnedEntity);
|
builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.UserId, mind.OwnedEntity);
|
||||||
|
|
||||||
var roles = _entities.System<SharedRoleSystem>();
|
foreach (var role in _roles.MindGetAllRoleInfo(mindId))
|
||||||
foreach (var role in roles.MindGetAllRoleInfo(mindId))
|
|
||||||
{
|
{
|
||||||
builder.AppendFormat("{0} ", role.Name);
|
builder.AppendFormat("{0} ", role.Name);
|
||||||
}
|
}
|
||||||
|
|||||||
6
Resources/Locale/en-US/commands/force-map-command.ftl
Normal file
6
Resources/Locale/en-US/commands/force-map-command.ftl
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
cmd-forcemap-desc = Forces the game to start with a given map next round.
|
||||||
|
cmd-forcemap-help = Usage: forcemap <map ID>
|
||||||
|
cmd-forcemap-success = Forced the game to start with map { $map } next round.
|
||||||
|
cmd-forcemap-cleared = Cleared the forced map setting.
|
||||||
|
cmd-forcemap-map-not-found = No eligible map exists with name { $map }.
|
||||||
|
cmd-forcemap-hint = <map ID>
|
||||||
6
Resources/Locale/en-US/commands/force-preset-command.ftl
Normal file
6
Resources/Locale/en-US/commands/force-preset-command.ftl
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
cmd-forcepreset-desc = Forces a specific game preset to start for the current lobby.
|
||||||
|
cmd-forcepreset-help = Usage: forcepreset <preset>
|
||||||
|
cmd-forcepreset-preround-lobby-only = This can only be executed while the game is in the pre-round lobby.
|
||||||
|
cmd-forcepreset-no-preset-found = No preset exists with name {$preset}.
|
||||||
|
cmd-forcepreset-success = Forced the game to start with preset {$preset}.
|
||||||
|
cmd-forcepreset-hint = <preset>
|
||||||
3
Resources/Locale/en-US/commands/ghost-kick-command.ftl
Normal file
3
Resources/Locale/en-US/commands/ghost-kick-command.ftl
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
cmd-ghostkick-desc = Kick a client from the server as if their network just dropped.
|
||||||
|
cmd-ghostkick-help = Usage: ghostkick <Player> [Reason]
|
||||||
|
cmd-ghostkick-default-reason = Ghost kicked by console.
|
||||||
4
Resources/Locale/en-US/commands/go-lobby-command.ftl
Normal file
4
Resources/Locale/en-US/commands/go-lobby-command.ftl
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
cmd-golobby-desc = Enables the lobby and restarts the round.
|
||||||
|
cmd-golobby-help = Usage: golobby / golobby <preset>
|
||||||
|
cmd-golobby-success = Enabling the lobby and restarting the round.
|
||||||
|
cmd-golobby-success-with-preset = Enabling the lobby and restarting the round with preset {$preset}.
|
||||||
3
Resources/Locale/en-US/commands/grid-drag-command.ftl
Normal file
3
Resources/Locale/en-US/commands/grid-drag-command.ftl
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
cmd-griddrag-desc = Allows someone with permissions to drag grids around.
|
||||||
|
cmd-griddrag-help = Usage: griddrag
|
||||||
|
cmd-griddrag-status = Grid dragging set to {$status}.
|
||||||
3
Resources/Locale/en-US/commands/mind-info-command.ftl
Normal file
3
Resources/Locale/en-US/commands/mind-info-command.ftl
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
cmd-mindinfo-desc = Lists info for the mind of a specific player.
|
||||||
|
cmd-mindinfo-help = Usage: mindinfo <session ID>
|
||||||
|
cmd-mindinfo-mind-not-found = Can't find that mind.
|
||||||
4
Resources/Locale/en-US/commands/tile-pry-command.ftl
Normal file
4
Resources/Locale/en-US/commands/tile-pry-command.ftl
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
cmd-tilepry-desc = Pries up all tiles in a radius around the user.
|
||||||
|
cmd-tilepry-help = Usage: tilepry <radius>
|
||||||
|
cmd-tilepry-radius-must-be-positive = Radius must be positive.
|
||||||
|
cmd-tilepry-arg-must-be-number = {$arg} isn't a valid integer.
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
## Forcemap command loc.
|
|
||||||
|
|
||||||
forcemap-command-description = Forces the game to start with a given map next round.
|
|
||||||
forcemap-command-help = forcemap <map ID>
|
|
||||||
forcemap-command-need-one-argument = forcemap takes one argument, the path to the map file.
|
|
||||||
forcemap-command-map-not-found = No eligible map exists with name { $map }.
|
|
||||||
forcemap-command-success = Forced the game to start with map { $map } next round.
|
|
||||||
forcemap-command-cleared = Cleared the forced map setting.
|
|
||||||
forcemap-command-arg-map = <map ID>
|
|
||||||
Reference in New Issue
Block a user