Stop mapping command from unsetting it's own settings if used repeatedly (#7875)

This commit is contained in:
20kdc
2022-05-04 04:19:15 +01:00
committed by GitHub
parent eef8d83b02
commit 5299cbbb6e
2 changed files with 35 additions and 4 deletions

View File

@@ -0,0 +1,34 @@
using JetBrains.Annotations;
using System;
using Content.Client.Markers;
using Robust.Client.Graphics;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
namespace Content.Client.Commands;
/// <summary>
/// Sent by mapping command to client.
/// This is because the debug commands for some of these options are on toggles.
/// </summary>
[UsedImplicitly]
internal sealed class MappingClientSideSetupCommand : IConsoleCommand
{
// ReSharper disable once StringLiteralTypo
public string Command => "mappingclientsidesetup";
public string Description => "Sets up the lighting control and such settings client-side. Sent by 'mapping' to client.";
public string Help => "";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var mgr = IoCManager.Resolve<ILightManager>();
if (!mgr.LockConsoleAccess)
{
EntitySystem.Get<MarkerSystem>().MarkersVisible = true;
mgr.Enabled = false;
shell.ExecuteCommand("showsubfloorforever");
shell.ExecuteCommand("loadmapacts");
}
}
}

View File

@@ -85,10 +85,7 @@ namespace Content.Server.GameTicking.Commands
shell.ExecuteCommand("sudo cvar events.enabled false"); shell.ExecuteCommand("sudo cvar events.enabled false");
shell.ExecuteCommand($"tp 0 0 {mapId}"); shell.ExecuteCommand($"tp 0 0 {mapId}");
shell.RemoteExecuteCommand("showmarkers"); shell.RemoteExecuteCommand("mappingclientsidesetup");
shell.RemoteExecuteCommand("togglelight");
shell.RemoteExecuteCommand("showsubfloorforever");
shell.RemoteExecuteCommand("loadmapacts");
mapManager.SetMapPaused(mapId, true); mapManager.SetMapPaused(mapId, true);
if (args.Length == 2) if (args.Length == 2)