Don't run aghost if already aghost for mapping (#5452)

This commit is contained in:
metalgearsloth
2021-11-23 06:31:21 +11:00
committed by GitHub
parent 669eb8fadd
commit 2a9b3a013c

View File

@@ -42,7 +42,7 @@ namespace Content.Server.GameTicking.Commands
case 1: case 1:
if (player.AttachedEntity == null) if (player.AttachedEntity == null)
{ {
shell.WriteLine("The map name argument cannot be omitted if you have no entity."); shell.WriteError("The map name argument cannot be omitted if you have no entity.");
return; return;
} }
@@ -52,7 +52,7 @@ namespace Content.Server.GameTicking.Commands
case 2: case 2:
if (!int.TryParse(args[0], out var id)) if (!int.TryParse(args[0], out var id))
{ {
shell.WriteLine($"{args[0]} is not a valid integer."); shell.WriteError($"{args[0]} is not a valid integer.");
return; return;
} }
@@ -66,7 +66,10 @@ namespace Content.Server.GameTicking.Commands
shell.ExecuteCommand($"addmap {mapId} false"); shell.ExecuteCommand($"addmap {mapId} false");
shell.ExecuteCommand($"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true"); shell.ExecuteCommand($"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true");
if (player.AttachedEntity?.Prototype?.ID != "AdminObserver")
shell.ExecuteCommand("aghost"); shell.ExecuteCommand("aghost");
shell.ExecuteCommand($"tp 0 0 {mapId}"); shell.ExecuteCommand($"tp 0 0 {mapId}");
var newGrid = mapManager.GetAllGrids().OrderByDescending(g => (int) g.Index).First(); var newGrid = mapManager.GetAllGrids().OrderByDescending(g => (int) g.Index).First();