* now you see me * unused depen * test fail fix attempt 1 * test fail fix attempt 2 * fix test fail attempt 3 * shot in the dark. * Does this work? * import cleanup * taking a shot at this. * Convert PersistenceSaveCommand to LocalizedEntityCommands. * requested changes * requested changes. also dealt with improperly named private const * Update Content.Server/GameTicking/GameTicker.Spawning.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Server/GameTicking/GameTicker.Spawning.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Convert PlanetCommand to LocalizedEntityCommand * Update BiomeSystem.cs * Update Content.Server/Salvage/SalvageSystem.Runner.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Server/Procedural/DungeonSystem.Rooms.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Server/Salvage/SpawnSalvageMissionJob.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Server/Station/Systems/StationBiomeSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * revert to latest master. * slartis suggestion. * Update SetMapAtmosCommand.cs * cleanup * Update PersistenceSaveCommand.cs * finish localizing persistencesavecommand * this is icky, I change. * :sigh: * revert whatever I did here? * oh I see, some inconsistencies. * revert this * Update PlanetCommand.cs * move this ftl to the commands folder --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using Content.Shared.Administration;
|
|
using Content.Shared.CCVar;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.EntitySerialization.Systems;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Administration.Commands;
|
|
|
|
[AdminCommand(AdminFlags.Server)]
|
|
public sealed class PersistenceSave : LocalizedEntityCommands
|
|
{
|
|
[Dependency] private readonly IConfigurationManager _config = default!;
|
|
[Dependency] private readonly SharedMapSystem _map = default!;
|
|
[Dependency] private readonly MapLoaderSystem _mapLoader = default!;
|
|
|
|
public override string Command => "persistencesave";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length < 1 || args.Length > 2)
|
|
{
|
|
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
|
|
return;
|
|
}
|
|
|
|
if (!int.TryParse(args[0], out var intMapId))
|
|
{
|
|
shell.WriteError(Loc.GetString("cmd-parse-failure-integer", ("arg", args[0])));
|
|
return;
|
|
}
|
|
|
|
var mapId = new MapId(intMapId);
|
|
if (!_map.MapExists(mapId))
|
|
{
|
|
shell.WriteError(Loc.GetString("cmd-savemap-not-exist"));
|
|
return;
|
|
}
|
|
|
|
var saveFilePath = (args.Length > 1 ? args[1] : null) ?? _config.GetCVar(CCVars.GameMap);
|
|
if (string.IsNullOrWhiteSpace(saveFilePath))
|
|
{
|
|
shell.WriteError(Loc.GetString("cmd-persistencesave-no-path", ("cvar", nameof(CCVars.GameMap))));
|
|
return;
|
|
}
|
|
|
|
_mapLoader.TrySaveMap(mapId, new ResPath(saveFilePath));
|
|
shell.WriteLine(Loc.GetString("cmd-savemap-success"));
|
|
}
|
|
}
|