Adjust mapping command order (#6929)
This commit is contained in:
@@ -17,14 +17,13 @@ namespace Content.Server.GameTicking.Commands
|
||||
|
||||
public string Command => "mapping";
|
||||
public string Description => "Creates and teleports you to a new uninitialized map for mapping.";
|
||||
public string Help => $"Usage: {Command} [mapname] [id]";
|
||||
public string Help => $"Usage: {Command} <MapID> <Path>";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (player == null)
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
{
|
||||
shell.WriteLine("Only players can use this command");
|
||||
shell.WriteError("Only players can use this command");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,11 +41,11 @@ namespace Content.Server.GameTicking.Commands
|
||||
MapId mapId;
|
||||
|
||||
// Get the map ID to use
|
||||
if (args.Length == 2)
|
||||
if (args.Length is 1 or 2)
|
||||
{
|
||||
if (!int.TryParse(args[1], out var id))
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.WriteError($"{args[1]} is not a valid integer.");
|
||||
shell.WriteError($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,11 +61,13 @@ namespace Content.Server.GameTicking.Commands
|
||||
mapId = mapManager.NextMapId();
|
||||
}
|
||||
|
||||
DebugTools.Assert(args.Length <= 2);
|
||||
|
||||
// either load a map or create a new one.
|
||||
if (args.Length == 0)
|
||||
if (args.Length <= 1)
|
||||
shell.ExecuteCommand($"addmap {mapId} false");
|
||||
else
|
||||
shell.ExecuteCommand($"loadmap {mapId} \"{CommandParsing.Escape(args[0])}\"");
|
||||
shell.ExecuteCommand($"loadmap {mapId} \"{CommandParsing.Escape(args[1])}\"");
|
||||
|
||||
// was the map actually created?
|
||||
if (!mapManager.MapExists(mapId))
|
||||
@@ -89,8 +90,8 @@ namespace Content.Server.GameTicking.Commands
|
||||
shell.RemoteExecuteCommand("showsubfloorforever");
|
||||
mapManager.SetMapPaused(mapId, true);
|
||||
|
||||
if (args.Length != 0)
|
||||
shell.WriteLine($"Created uninitialized map from file {args[0]} with id {mapId}.");
|
||||
if (args.Length == 2)
|
||||
shell.WriteLine($"Created uninitialized map from file {args[1]} with id {mapId}.");
|
||||
else
|
||||
shell.WriteLine($"Created a new uninitialized map with id {mapId}.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user