Add mapping command (#1411)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
DrSmugleaf
2020-07-19 18:43:16 +02:00
committed by GitHub
parent 86c318cc74
commit 20b175d997
3 changed files with 54 additions and 2 deletions

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Content.Server.GameTicking;
using Content.Server.Interfaces.GameTicking;
using Content.Server.Players;
using Content.Shared.Jobs;
@@ -9,7 +8,7 @@ using Robust.Server.Interfaces.Player;
using Robust.Shared.IoC;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Log;
using Robust.Shared.Utility;
namespace Content.Server.GameTicking
{
@@ -293,4 +292,33 @@ namespace Content.Server.GameTicking
shell.SendText(player, $"Forced the game to start with preset {name}.");
}
}
class MappingCommand : IClientCommand
{
public string Command => "mapping";
public string Description => "Creates and teleports you to a new uninitialized map for mapping.";
public string Help => $"Usage: {Command} <id> <mapname>";
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
{
if (player == null)
{
shell.SendText(player, "Only players can use this command");
return;
}
if (args.Length != 2)
{
shell.SendText(player, Help);
return;
}
shell.ExecuteCommand(player, $"addmap {args[0]} false");
shell.ExecuteCommand(player, $"loadbp {args[0]} \"{CommandParsing.Escape(args[1])}\"");
shell.ExecuteCommand(player, $"aghost");
shell.ExecuteCommand(player, $"tp 0 0 {args[0]}");
shell.SendText(player, $"Created unloaded map from file {args[1]} with id {args[0]}. Use \"savebp 4 foo.yml\" to save it.");
}
}
}