Files
RobustToolbox/Robust.Shared/Map/Commands/MapPausingCommands.cs
TemporalOroborosandGitHub 5dbf86fb93 IMapManager to hospice care (#6579)
* Move MapManager queries to SharedMapSystem
Moves all variants of FindGridsIntersecting/TryFindGridAt to SharedMapSystem
Hollows out the MapManager methods and converts them into relays to SharedMapSystem

* Move CreateGrid to SharedMapSystem
Moves the functionality for CreateGrid and its variants to SharedMapSystem
Hollows out the MapManager methods and converts them into relays for the SharedMapSystem methods
Obsoletes them too
Also moves over the GetAllMapGrids and GetAllGrids methods

* Move RaiseOnTileChanged to SharedMapSystem
Also moves the SuppressOnTileChanged flag member to SharedMapSystem
Hollows out and obsoletes the MapManager versions

* Move default value constants to SharedMapSystem

* Converts map pausing events into LocalizedEntityCommands

* Move MapManager related delegates/structs to SharedMapSystem
Moves the GridCreationOptions struct to the same namespace as SharedMapSystem and converts it into a record struct
Move the GridCallback delegates to the same namespace as SharedMapSystem

* Move CullDeletionHistory to SharedMapSystem
Well, that was less painful than I thought it would be

* Actually obsolete the NetworkedMapManager method

* Rename file

* Doc comments for new SharedMapSystem methods

* Doc comment

* Doc comments

* Fix access
2026-06-27 18:33:48 +10:00

91 lines
2.4 KiB
C#

using System.Globalization;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Robust.Shared.Map.Commands;
/// <summary>
/// Pauses a given map, halting all entity processing on it.
/// </summary>
public sealed partial class PauseMapCommand : LocalizedEntityCommands
{
[Dependency] SharedMapSystem _mapSystem = default!;
public override string Command => "pausemap";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteError("Need to supply a valid MapId");
return;
}
var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture));
if (!_mapSystem.MapExists(mapId))
{
shell.WriteError("That map does not exist.");
return;
}
_mapSystem.SetPaused(mapId, true);
}
}
/// <summary>
/// Unpauses a given map, resuming all entity processing on it.
/// </summary>
public sealed partial class UnpauseMapCommand : LocalizedEntityCommands
{
[Dependency] SharedMapSystem _mapSystem = default!;
public override string Command => "unpausemap";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteError("Need to supply a valid MapId");
return;
}
var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture));
if (!_mapSystem.MapExists(mapId))
{
shell.WriteError("That map does not exist.");
return;
}
_mapSystem.SetPaused(mapId, false);
}
}
/// <summary>
/// Checks whether a given map is currently paused.
/// </summary>
public sealed partial class QueryMapPausedCommand : LocalizedEntityCommands
{
[Dependency] SharedMapSystem _mapSystem = default!;
public override string Command => "querymappaused";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteError("Need to supply a valid MapId");
return;
}
var mapId = new MapId(int.Parse(args[0], CultureInfo.InvariantCulture));
if (!_mapSystem.MapExists(mapId))
{
shell.WriteError("That map does not exist.");
return;
}
shell.WriteLine(_mapSystem.IsPaused(mapId).ToString());
}
}