Cleanup all instances of IMapManager.GetMapEntityId (#37814)
* Cleanup all instances of IMapManager.GetMapEntityId * Dependencies * LocalizedEntityCommands
This commit is contained in:
@@ -22,6 +22,7 @@ public sealed class ProjectileAnomalySystem : EntitySystem
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly GunSystem _gunSystem = default!;
|
||||
[Dependency] private readonly SharedMapSystem _map = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -85,7 +86,7 @@ public sealed class ProjectileAnomalySystem : EntitySystem
|
||||
|
||||
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var gridUid, out _)
|
||||
? _xform.WithEntityId(coords, gridUid)
|
||||
: new(_mapManager.GetMapEntityId(mapPos.MapId), mapPos.Position);
|
||||
: new(_map.GetMapOrInvalid(mapPos.MapId), mapPos.Position);
|
||||
|
||||
var ent = Spawn(component.ProjectilePrototype, spawnCoords);
|
||||
var direction = _xform.ToMapCoordinates(targetCoords).Position - mapPos.Position;
|
||||
|
||||
@@ -9,10 +9,10 @@ using Robust.Shared.Map;
|
||||
namespace Content.Server.Atmos.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public sealed class AddMapAtmosCommand : LocalizedCommands
|
||||
public sealed class AddMapAtmosCommand : LocalizedEntityCommands
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
[Dependency] private readonly SharedMapSystem _map = default!;
|
||||
|
||||
private const string _cmd = "cmd-set-map-atmos";
|
||||
public override string Command => "setmapatmos";
|
||||
@@ -28,7 +28,7 @@ public sealed class AddMapAtmosCommand : LocalizedCommands
|
||||
}
|
||||
|
||||
int.TryParse(args[0], out var id);
|
||||
var map = _map.GetMapEntityId(new MapId(id));
|
||||
var map = _map.GetMapOrInvalid(new MapId(id));
|
||||
if (!map.IsValid())
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-parse-failure-mapid", ("arg", args[0])));
|
||||
|
||||
@@ -475,17 +475,17 @@ namespace Content.Server.GameTicking
|
||||
return spawn;
|
||||
}
|
||||
|
||||
if (_mapManager.MapExists(DefaultMap))
|
||||
if (_map.MapExists(DefaultMap))
|
||||
{
|
||||
var mapUid = _mapManager.GetMapEntityId(DefaultMap);
|
||||
var mapUid = _map.GetMapOrInvalid(DefaultMap);
|
||||
if (!TerminatingOrDeleted(mapUid))
|
||||
return new EntityCoordinates(mapUid, Vector2.Zero);
|
||||
}
|
||||
|
||||
// Just pick a point at this point I guess.
|
||||
foreach (var map in _mapManager.GetAllMapIds())
|
||||
foreach (var map in _map.GetAllMapIds())
|
||||
{
|
||||
var mapUid = _mapManager.GetMapEntityId(map);
|
||||
var mapUid = _map.GetMapOrInvalid(map);
|
||||
|
||||
if (!metaQuery.TryGetComponent(mapUid, out var meta)
|
||||
|| meta.EntityPaused
|
||||
|
||||
@@ -100,8 +100,7 @@ public sealed class GatewayGeneratorSystem : EntitySystem
|
||||
var tiles = new List<(Vector2i Index, Tile Tile)>();
|
||||
var seed = _random.Next();
|
||||
var random = new Random(seed);
|
||||
var mapId = _mapManager.CreateMap();
|
||||
var mapUid = _mapManager.GetMapEntityId(mapId);
|
||||
var mapUid = _maps.CreateMap();
|
||||
|
||||
var gatewayName = _salvage.GetFTLName(_protoManager.Index<LocalizedDatasetPrototype>(PlanetNames), seed);
|
||||
_metadata.SetEntityName(mapUid, gatewayName);
|
||||
|
||||
@@ -22,16 +22,16 @@ namespace Content.Server.Maps;
|
||||
/// Converts the supplied map into a "planet" with defaults.
|
||||
/// </summary>
|
||||
[AdminCommand(AdminFlags.Mapping)]
|
||||
public sealed class PlanetCommand : IConsoleCommand
|
||||
public sealed class PlanetCommand : LocalizedEntityCommands
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||
[Dependency] private readonly SharedMapSystem _map = default!;
|
||||
|
||||
public string Command => "planet";
|
||||
public string Description => Loc.GetString("cmd-planet-desc");
|
||||
public string Help => Loc.GetString("cmd-planet-help", ("command", Command));
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override string Command => "planet";
|
||||
public override string Description => Loc.GetString("cmd-planet-desc");
|
||||
public override string Help => Loc.GetString("cmd-planet-help", ("command", Command));
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
@@ -46,8 +46,7 @@ public sealed class PlanetCommand : IConsoleCommand
|
||||
}
|
||||
|
||||
var mapId = new MapId(mapInt);
|
||||
|
||||
if (!_mapManager.MapExists(mapId))
|
||||
if (!_map.MapExists(mapId))
|
||||
{
|
||||
shell.WriteError(Loc.GetString($"cmd-planet-map", ("map", mapId)));
|
||||
return;
|
||||
@@ -60,13 +59,13 @@ public sealed class PlanetCommand : IConsoleCommand
|
||||
}
|
||||
|
||||
var biomeSystem = _entManager.System<BiomeSystem>();
|
||||
var mapUid = _mapManager.GetMapEntityId(mapId);
|
||||
var mapUid = _map.GetMapOrInvalid(mapId);
|
||||
biomeSystem.EnsurePlanet(mapUid, biomeTemplate);
|
||||
|
||||
shell.WriteLine(Loc.GetString("cmd-planet-success", ("mapId", mapId)));
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
{
|
||||
if (args.Length == 1)
|
||||
return CompletionResult.FromHintOptions(CompletionHelper.MapIds(_entManager), "Map Id");
|
||||
|
||||
@@ -123,7 +123,7 @@ public sealed partial class DungeonSystem
|
||||
{
|
||||
// Ensure the underlying template exists.
|
||||
var roomMap = GetOrCreateTemplate(room);
|
||||
var templateMapUid = _mapManager.GetMapEntityId(roomMap);
|
||||
var templateMapUid = _maps.GetMapOrInvalid(roomMap);
|
||||
var templateGrid = Comp<MapGridComponent>(templateMapUid);
|
||||
var roomDimensions = room.Size;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public sealed partial class SalvageSystem
|
||||
ChatChannel.Radio,
|
||||
text,
|
||||
text,
|
||||
_mapManager.GetMapEntityId(mapId),
|
||||
_mapSystem.GetMapOrInvalid(mapId),
|
||||
false,
|
||||
true,
|
||||
null);
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
using Content.Server.Parallax;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Server.Station.Events;
|
||||
using Content.Server.Station.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Station.Systems;
|
||||
|
||||
public sealed partial class StationBiomeSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly BiomeSystem _biome = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly StationSystem _station = default!;
|
||||
[Dependency] private readonly SharedMapSystem _map = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -28,7 +27,7 @@ public sealed partial class StationBiomeSystem : EntitySystem
|
||||
if (station == null) return;
|
||||
|
||||
var mapId = Transform(station.Value).MapID;
|
||||
var mapUid = _mapManager.GetMapEntityId(mapId);
|
||||
var mapUid = _map.GetMapOrInvalid(mapId);
|
||||
|
||||
_biome.EnsurePlanet(mapUid, _proto.Index(map.Comp.Biome), map.Comp.Seed, mapLight: map.Comp.MapLightColor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user