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:
@@ -1,6 +1,7 @@
|
|||||||
using Content.Client.GameObjects.EntitySystems;
|
using Content.Client.GameObjects.EntitySystems;
|
||||||
using Content.Client.Interfaces;
|
using Content.Client.Interfaces;
|
||||||
using Content.Shared.GameObjects.Components.Markers;
|
using Content.Shared.GameObjects.Components.Markers;
|
||||||
|
using Robust.Client.Console.Commands;
|
||||||
using Robust.Client.Interfaces.Console;
|
using Robust.Client.Interfaces.Console;
|
||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -59,4 +60,25 @@ namespace Content.Client.Commands
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal sealed class MappingCommand : IConsoleCommand
|
||||||
|
{
|
||||||
|
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 bool Execute(IDebugConsole console, params string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length != 2)
|
||||||
|
{
|
||||||
|
console.AddLine(Help);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.Commands["togglelight"].Execute(console);
|
||||||
|
console.Commands["showwires"].Execute(console);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameTicking;
|
|
||||||
using Content.Server.Interfaces.GameTicking;
|
using Content.Server.Interfaces.GameTicking;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Shared.Jobs;
|
using Content.Shared.Jobs;
|
||||||
@@ -9,7 +8,7 @@ using Robust.Server.Interfaces.Player;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameTicking
|
namespace Content.Server.GameTicking
|
||||||
{
|
{
|
||||||
@@ -293,4 +292,33 @@ namespace Content.Server.GameTicking
|
|||||||
shell.SendText(player, $"Forced the game to start with preset {name}.");
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
- hostlogin
|
- hostlogin
|
||||||
- deleteewc
|
- deleteewc
|
||||||
- asay
|
- asay
|
||||||
|
- mapping
|
||||||
CanViewVar: true
|
CanViewVar: true
|
||||||
CanAdminPlace: true
|
CanAdminPlace: true
|
||||||
|
|
||||||
@@ -157,6 +158,7 @@
|
|||||||
- deleteewc
|
- deleteewc
|
||||||
- sudo
|
- sudo
|
||||||
- asay
|
- asay
|
||||||
|
- mapping
|
||||||
CanViewVar: true
|
CanViewVar: true
|
||||||
CanAdminPlace: true
|
CanAdminPlace: true
|
||||||
CanScript: true
|
CanScript: true
|
||||||
|
|||||||
Reference in New Issue
Block a user