Un-revert #26994
This commit is contained in:
@@ -24,6 +24,7 @@ using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
@@ -180,7 +181,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
||||
|
||||
var aabbs = EntityQuery<StationDataComponent>().SelectMany(x =>
|
||||
x.Grids.Select(x =>
|
||||
xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).LocalAABB)))
|
||||
xformQuery.GetComponent(x).WorldMatrix.TransformBox(Comp<MapGridComponent>(x).LocalAABB)))
|
||||
.ToArray();
|
||||
|
||||
var aabb = aabbs[0];
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
// ReSharper disable once RedundantUsingDirective
|
||||
// Used to warn the player in big red letters in debug mode
|
||||
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Maps;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Mapping
|
||||
{
|
||||
@@ -19,6 +16,8 @@ namespace Content.Server.Mapping
|
||||
sealed class MappingCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
public string Command => "mapping";
|
||||
public string Description => Loc.GetString("cmd-mapping-desc");
|
||||
@@ -57,13 +56,13 @@ namespace Content.Server.Mapping
|
||||
shell.WriteError(Loc.GetString("cmd-mapping-warning"));
|
||||
#endif
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
MapId mapId;
|
||||
string? toLoad = null;
|
||||
var mapSys = _entities.System<SharedMapSystem>();
|
||||
|
||||
// Get the map ID to use
|
||||
if (args.Length is 1 or 2)
|
||||
{
|
||||
|
||||
if (!int.TryParse(args[0], out var intMapId))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-mapping-failure-integer", ("arg", args[0])));
|
||||
@@ -79,35 +78,33 @@ namespace Content.Server.Mapping
|
||||
return;
|
||||
}
|
||||
|
||||
if (mapManager.MapExists(mapId))
|
||||
if (_map.MapExists(mapId))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-mapping-exists", ("mapId", mapId)));
|
||||
return;
|
||||
}
|
||||
|
||||
// either load a map or create a new one.
|
||||
if (args.Length <= 1)
|
||||
{
|
||||
mapSys.CreateMap(mapId, runMapInit: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
var loadOptions = new MapLoadOptions {StoreMapUids = true};
|
||||
_entities.System<MapLoaderSystem>().TryLoad(mapId, args[1], out _, loadOptions);
|
||||
}
|
||||
|
||||
// was the map actually created or did it fail somehow?
|
||||
if (!_map.MapExists(mapId))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-mapping-error"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mapId = mapManager.NextMapId();
|
||||
}
|
||||
|
||||
string? toLoad = null;
|
||||
// either load a map or create a new one.
|
||||
if (args.Length <= 1)
|
||||
{
|
||||
shell.ExecuteCommand($"addmap {mapId} false");
|
||||
}
|
||||
else
|
||||
{
|
||||
toLoad = CommandParsing.Escape(args[1]);
|
||||
shell.ExecuteCommand($"loadmap {mapId} \"{toLoad}\" 0 0 0 true");
|
||||
}
|
||||
|
||||
// was the map actually created?
|
||||
if (!mapManager.MapExists(mapId))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-mapping-error"));
|
||||
return;
|
||||
mapSys.CreateMap(out mapId, runMapInit: false);
|
||||
}
|
||||
|
||||
// map successfully created. run misc helpful mapping commands
|
||||
@@ -117,17 +114,15 @@ namespace Content.Server.Mapping
|
||||
shell.ExecuteCommand("aghost");
|
||||
}
|
||||
|
||||
var cfg = IoCManager.Resolve<IConfigurationManager>();
|
||||
|
||||
// don't interrupt mapping with events or auto-shuttle
|
||||
shell.ExecuteCommand("sudo cvar events.enabled false");
|
||||
shell.ExecuteCommand("sudo cvar shuttle.auto_call_time 0");
|
||||
|
||||
if (cfg.GetCVar(CCVars.AutosaveEnabled))
|
||||
if (_cfg.GetCVar(CCVars.AutosaveEnabled))
|
||||
shell.ExecuteCommand($"toggleautosave {mapId} {toLoad ?? "NEWMAP"}");
|
||||
shell.ExecuteCommand($"tp 0 0 {mapId}");
|
||||
shell.RemoteExecuteCommand("mappingclientsidesetup");
|
||||
mapManager.SetMapPaused(mapId, true);
|
||||
_map.SetMapPaused(mapId, true);
|
||||
|
||||
if (args.Length == 2)
|
||||
shell.WriteLine(Loc.GetString("cmd-mapping-success-load",("mapId",mapId),("path", args[1])));
|
||||
|
||||
@@ -164,6 +164,7 @@ public sealed partial class SalvageSystem
|
||||
_dungeon,
|
||||
_metaData,
|
||||
_transform,
|
||||
_mapSystem,
|
||||
station,
|
||||
coordinatesDisk,
|
||||
missionParams,
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace Content.Server.Salvage
|
||||
{
|
||||
[Dependency] private readonly IChatManager _chat = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly ILogManager _logManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
@@ -56,6 +55,7 @@ namespace Content.Server.Salvage
|
||||
[Dependency] private readonly RadioSystem _radioSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly ShuttleSystem _shuttle = default!;
|
||||
[Dependency] private readonly ShuttleConsoleSystem _shuttleConsoles = default!;
|
||||
[Dependency] private readonly StationSystem _station = default!;
|
||||
|
||||
@@ -50,6 +50,7 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
|
||||
private readonly DungeonSystem _dungeon;
|
||||
private readonly MetaDataSystem _metaData;
|
||||
private readonly SharedTransformSystem _xforms;
|
||||
private readonly SharedMapSystem _map;
|
||||
|
||||
public readonly EntityUid Station;
|
||||
public readonly EntityUid? CoordinatesDisk;
|
||||
@@ -69,6 +70,7 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
|
||||
DungeonSystem dungeon,
|
||||
MetaDataSystem metaData,
|
||||
SharedTransformSystem xform,
|
||||
SharedMapSystem map,
|
||||
EntityUid station,
|
||||
EntityUid? coordinatesDisk,
|
||||
SalvageMissionParams missionParams,
|
||||
@@ -83,6 +85,7 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
|
||||
_dungeon = dungeon;
|
||||
_metaData = metaData;
|
||||
_xforms = xform;
|
||||
_map = map;
|
||||
Station = station;
|
||||
CoordinatesDisk = coordinatesDisk;
|
||||
_missionParams = missionParams;
|
||||
@@ -95,9 +98,7 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
|
||||
protected override async Task<bool> Process()
|
||||
{
|
||||
_sawmill.Debug("salvage", $"Spawning salvage mission with seed {_missionParams.Seed}");
|
||||
var mapId = _mapManager.CreateMap();
|
||||
var mapUid = _mapManager.GetMapEntityId(mapId);
|
||||
_mapManager.AddUninitializedMap(mapId);
|
||||
var mapUid = _map.CreateMap(out var mapId, runMapInit: false);
|
||||
MetaDataComponent? metadata = null;
|
||||
var grid = _entManager.EnsureComponent<MapGridComponent>(mapUid);
|
||||
var random = new Random(_missionParams.Seed);
|
||||
|
||||
Reference in New Issue
Block a user