Code Cleanup: Purge obsolete MapManager methods (#26279)
* GetGrid * GridExists * TryGetGrid
This commit is contained in:
@@ -47,7 +47,7 @@ namespace Content.Client.IconSmoothing
|
||||
var xform = Transform(uid);
|
||||
if (xform.Anchored)
|
||||
{
|
||||
component.LastPosition = _mapManager.TryGetGrid(xform.GridUid, out var grid)
|
||||
component.LastPosition = TryComp<MapGridComponent>(xform.GridUid, out var grid)
|
||||
? (xform.GridUid.Value, grid.TileIndicesFor(xform.Coordinates))
|
||||
: (null, new Vector2i(0, 0));
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
Vector2i pos;
|
||||
|
||||
if (transform.Anchored && _mapManager.TryGetGrid(transform.GridUid, out var grid))
|
||||
if (transform.Anchored && TryComp<MapGridComponent>(transform.GridUid, out var grid))
|
||||
{
|
||||
pos = grid.CoordinatesToTile(transform.Coordinates);
|
||||
}
|
||||
@@ -144,7 +144,7 @@ namespace Content.Client.IconSmoothing
|
||||
if (comp.LastPosition is not (EntityUid gridId, Vector2i oldPos))
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridId, out grid))
|
||||
if (!TryComp(gridId, out grid))
|
||||
return;
|
||||
|
||||
pos = oldPos;
|
||||
@@ -206,7 +206,7 @@ namespace Content.Client.IconSmoothing
|
||||
{
|
||||
var directions = DirectionFlag.None;
|
||||
|
||||
if (_mapManager.TryGetGrid(xform.GridUid, out grid))
|
||||
if (TryComp(xform.GridUid, out grid))
|
||||
{
|
||||
var pos = grid.TileIndicesFor(xform.Coordinates);
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
if (xform.Anchored)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out grid))
|
||||
if (!TryComp(xform.GridUid, out grid))
|
||||
{
|
||||
Log.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridUid} was missing.");
|
||||
return;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -12,7 +13,6 @@ namespace Content.Client.Movement.Systems;
|
||||
public sealed class JetpackSystem : SharedJetpackSystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ClothingSystem _clothing = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
@@ -75,7 +75,7 @@ public sealed class JetpackSystem : SharedJetpackSystem
|
||||
var coordinates = uidXform.Coordinates;
|
||||
var gridUid = coordinates.GetGridUid(EntityManager);
|
||||
|
||||
if (_mapManager.TryGetGrid(gridUid, out var grid))
|
||||
if (TryComp<MapGridComponent>(gridUid, out var grid))
|
||||
{
|
||||
coordinates = new EntityCoordinates(gridUid.Value, grid.WorldToLocal(coordinates.ToMapPos(EntityManager, _transform)));
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Content.Client.NodeContainer
|
||||
|
||||
|
||||
var xform = _entityManager.GetComponent<TransformComponent>(_entityManager.GetEntity(node.Entity));
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (!_entityManager.TryGetComponent<MapGridComponent>(xform.GridUid, out var grid))
|
||||
return;
|
||||
var gridTile = grid.TileIndicesFor(xform.Coordinates);
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace Content.Client.NodeContainer
|
||||
|
||||
foreach (var (gridId, gridDict) in _gridIndex)
|
||||
{
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
var grid = _entityManager.GetComponent<MapGridComponent>(gridId);
|
||||
var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(gridId).GetWorldPositionRotationMatrixWithInv();
|
||||
|
||||
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
||||
|
||||
@@ -4,13 +4,12 @@ using Content.Client.Radiation.Systems;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Client.Radiation.Overlays;
|
||||
|
||||
public sealed class RadiationDebugOverlay : Overlay
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
private readonly RadiationSystem _radiation;
|
||||
|
||||
@@ -63,7 +62,7 @@ public sealed class RadiationDebugOverlay : Overlay
|
||||
{
|
||||
var gridUid = _entityManager.GetEntity(netGrid);
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridUid, out var grid))
|
||||
if (!_entityManager.TryGetComponent<MapGridComponent>(gridUid, out var grid))
|
||||
continue;
|
||||
|
||||
foreach (var (tile, rads) in blockers)
|
||||
@@ -88,7 +87,7 @@ public sealed class RadiationDebugOverlay : Overlay
|
||||
{
|
||||
var gridUid = _entityManager.GetEntity(netGrid);
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridUid, out var grid))
|
||||
if (!_entityManager.TryGetComponent<MapGridComponent>(gridUid, out var grid))
|
||||
continue;
|
||||
if (query.TryGetComponent(gridUid, out var trs) && trs.MapID != args.MapId)
|
||||
continue;
|
||||
@@ -127,7 +126,7 @@ public sealed class RadiationDebugOverlay : Overlay
|
||||
{
|
||||
var gridUid = _entityManager.GetEntity(netGrid);
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridUid, out var grid))
|
||||
if (!_entityManager.TryGetComponent<MapGridComponent>(gridUid, out var grid))
|
||||
continue;
|
||||
var (destTile, _) = blockers.Last();
|
||||
var destWorld = grid.GridTileToWorldPos(destTile);
|
||||
|
||||
@@ -72,7 +72,7 @@ public sealed class FluidSpill
|
||||
var puddleOrigin = new Vector2i(0, 0);
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
var grid = entityManager.GetComponent<MapGridComponent>(gridId);
|
||||
var solution = new Solution("Blood", FixedPoint2.New(100));
|
||||
var tileRef = grid.GetTileRef(puddleOrigin);
|
||||
#pragma warning disable NUnit2045 // Interdependent tests
|
||||
@@ -86,7 +86,7 @@ public sealed class FluidSpill
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
var grid = entityManager.GetComponent<MapGridComponent>(gridId);
|
||||
var puddle = GetPuddleEntity(entityManager, grid, puddleOrigin);
|
||||
|
||||
#pragma warning disable NUnit2045 // Interdependent tests
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Anomaly;
|
||||
/// </summary>
|
||||
public sealed partial class AnomalySystem
|
||||
{
|
||||
[Dependency] private readonly MapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
private void InitializeGenerator()
|
||||
|
||||
@@ -2,11 +2,10 @@ using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Anomaly.Components;
|
||||
using Content.Shared.Anomaly.Components;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Random;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Anomaly.Effects;
|
||||
|
||||
@@ -16,8 +15,6 @@ namespace Content.Server.Anomaly.Effects;
|
||||
public sealed class GasProducerAnomalySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
|
||||
[Dependency] private readonly TransformSystem _xform = default!;
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -55,7 +52,7 @@ public sealed class GasProducerAnomalySystem : EntitySystem
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
|
||||
if (!_map.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
return;
|
||||
|
||||
var localpos = xform.Coordinates.Position;
|
||||
|
||||
@@ -3,7 +3,7 @@ using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
@@ -11,7 +11,6 @@ namespace Content.Server.Atmos.Commands
|
||||
public sealed class DeleteGasCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
public string Command => "deletegas";
|
||||
public string Description => "Removes all gases from a grid, or just of one type if specified.";
|
||||
@@ -119,7 +118,7 @@ namespace Content.Server.Atmos.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridId, out _))
|
||||
if (!_entManager.TryGetComponent<MapGridComponent>(gridId, out _))
|
||||
{
|
||||
shell.WriteLine($"No grid exists with id {gridId}");
|
||||
return;
|
||||
|
||||
@@ -3,14 +3,12 @@ using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Atmos.Piping.EntitySystems;
|
||||
|
||||
public sealed class AtmosPipeAppearanceSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -31,7 +29,7 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
|
||||
if (!Resolve(uid, ref appearance, ref container, ref xform, false))
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
return;
|
||||
|
||||
// get connected entities
|
||||
|
||||
@@ -7,15 +7,14 @@ using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.Atmos.Piping.Unary.Components;
|
||||
using Content.Shared.Construction.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class GasPortableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
||||
|
||||
@@ -58,7 +57,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
{
|
||||
port = null;
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||
if (!TryComp<MapGridComponent>(gridId, out var grid))
|
||||
return false;
|
||||
|
||||
foreach (var entityUid in grid.GetLocal(coordinates))
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Decals;
|
||||
|
||||
@@ -43,7 +44,7 @@ Possible modes are:\n
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_mapManager.GridExists(gridId))
|
||||
if (!_entManager.HasComponent<MapGridComponent>(gridId))
|
||||
{
|
||||
shell.WriteError($"No grid with gridId {gridId} exists.");
|
||||
return;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using SQLitePCL;
|
||||
|
||||
namespace Content.Server.Decals.Commands
|
||||
@@ -31,7 +32,7 @@ namespace Content.Server.Decals.Commands
|
||||
|
||||
if (!NetEntity.TryParse(args[1], out var rawGridIdNet) ||
|
||||
!_entManager.TryGetEntity(rawGridIdNet, out var rawGridId) ||
|
||||
!_mapManager.GridExists(rawGridId))
|
||||
!_entManager.HasComponent<MapGridComponent>(rawGridId))
|
||||
{
|
||||
shell.WriteError("Failed parsing gridId.");
|
||||
return;
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Content.Server.Decals
|
||||
return;
|
||||
|
||||
// Transfer decals over to the new grid.
|
||||
var enumerator = MapManager.GetGrid(ev.Grid).GetAllTilesEnumerator();
|
||||
var enumerator = Comp<MapGridComponent>(ev.Grid).GetAllTilesEnumerator();
|
||||
|
||||
var oldChunkCollection = oldComp.ChunkCollection.ChunkCollection;
|
||||
var chunkCollection = newComp.ChunkCollection.ChunkCollection;
|
||||
|
||||
@@ -6,20 +6,16 @@ using Content.Server.Disposal.Tube.Components;
|
||||
using Content.Server.Disposal.Unit.Components;
|
||||
using Content.Server.Disposal.Unit.EntitySystems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Destructible;
|
||||
using Content.Shared.Disposal.Components;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using static Content.Shared.Disposal.Components.SharedDisposalRouterComponent;
|
||||
using static Content.Shared.Disposal.Components.SharedDisposalTaggerComponent;
|
||||
|
||||
@@ -27,8 +23,6 @@ namespace Content.Server.Disposal.Tube
|
||||
{
|
||||
public sealed class DisposalTubeSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popups = default!;
|
||||
@@ -349,7 +343,7 @@ namespace Content.Server.Disposal.Tube
|
||||
var oppositeDirection = nextDirection.GetOpposite();
|
||||
|
||||
var xform = Transform(target);
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
return null;
|
||||
|
||||
var position = xform.Coordinates;
|
||||
|
||||
@@ -12,18 +12,15 @@ using Content.Shared.Mobs;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.NPC.Systems;
|
||||
using Content.Shared.Zombies;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Dragon;
|
||||
|
||||
public sealed partial class DragonSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly CarpRiftsConditionSystem _carpRifts = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDef = default!;
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
||||
[Dependency] private readonly NpcFactionSystem _faction = default!;
|
||||
@@ -142,7 +139,7 @@ public sealed partial class DragonSystem : EntitySystem
|
||||
var xform = Transform(uid);
|
||||
|
||||
// Have to be on a grid fam
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("carp-rift-anchor"), uid, uid);
|
||||
return;
|
||||
|
||||
@@ -6,14 +6,13 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Stacks;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Engineering.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class SpawnAfterInteractSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly StackSystem _stackSystem = default!;
|
||||
|
||||
@@ -30,7 +29,7 @@ namespace Content.Server.Engineering.EntitySystems
|
||||
return;
|
||||
if (string.IsNullOrEmpty(component.Prototype))
|
||||
return;
|
||||
if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridUid(EntityManager), out var grid))
|
||||
if (!TryComp<MapGridComponent>(args.ClickLocation.GetGridUid(EntityManager), out var grid))
|
||||
return;
|
||||
if (!grid.TryGetTileRef(args.ClickLocation, out var tileRef))
|
||||
return;
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
@@ -102,7 +101,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform) || !transform.Anchored)
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(transform.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(transform.GridUid, out var grid))
|
||||
return;
|
||||
|
||||
UpdateAirtightMap(transform.GridUid.Value, grid, grid.CoordinatesToTile(transform.Coordinates));
|
||||
|
||||
@@ -23,7 +23,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
/// </summary>
|
||||
private void OnGridStartup(GridStartupEvent ev)
|
||||
{
|
||||
var grid = _mapManager.GetGrid(ev.EntityUid);
|
||||
var grid = Comp<MapGridComponent>(ev.EntityUid);
|
||||
|
||||
Dictionary<Vector2i, NeighborFlag> edges = new();
|
||||
_gridEdges[ev.EntityUid] = edges;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Administration;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Explosion.Components;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -56,7 +57,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
else if (referenceGrid != null)
|
||||
{
|
||||
// reference grid defines coordinate system that the explosion in space will use
|
||||
initialTile = _mapManager.GetGrid(referenceGrid.Value).WorldToTile(epicenter.Position);
|
||||
initialTile = Comp<MapGridComponent>(referenceGrid.Value).WorldToTile(epicenter.Position);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -87,7 +88,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
var spaceAngle = Angle.Zero;
|
||||
if (referenceGrid != null)
|
||||
{
|
||||
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner);
|
||||
var xform = Transform(Comp<MapGridComponent>(referenceGrid.Value).Owner);
|
||||
spaceMatrix = xform.WorldMatrix;
|
||||
spaceAngle = xform.WorldRotation;
|
||||
}
|
||||
@@ -102,7 +103,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
airtightMap = new();
|
||||
|
||||
var initialGridData = new ExplosionGridTileFlood(
|
||||
_mapManager.GetGrid(epicentreGrid.Value),
|
||||
Comp<MapGridComponent>(epicentreGrid.Value),
|
||||
airtightMap,
|
||||
maxIntensity,
|
||||
stepSize,
|
||||
@@ -191,7 +192,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
airtightMap = new();
|
||||
|
||||
data = new ExplosionGridTileFlood(
|
||||
_mapManager.GetGrid(grid),
|
||||
Comp<MapGridComponent>(grid),
|
||||
airtightMap,
|
||||
maxIntensity,
|
||||
stepSize,
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
@@ -16,7 +17,6 @@ namespace Content.Server.ImmovableRod;
|
||||
public sealed class ImmovableRodSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
|
||||
[Dependency] private readonly BodySystem _bodySystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
@@ -33,7 +33,7 @@ public sealed class ImmovableRodSystem : EntitySystem
|
||||
if (!rod.DestroyTiles)
|
||||
continue;
|
||||
|
||||
if (!_map.TryGetGrid(trans.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(trans.GridUid, out var grid))
|
||||
continue;
|
||||
|
||||
grid.SetTile(trans.Coordinates, Tile.Empty);
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Administration;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Interaction
|
||||
{
|
||||
@@ -46,7 +47,7 @@ namespace Content.Server.Interaction
|
||||
var xform = _entities.GetComponent<TransformComponent>(attached);
|
||||
var playerGrid = xform.GridUid;
|
||||
|
||||
if (!mapManager.TryGetGrid(playerGrid, out var mapGrid))
|
||||
if (!_entities.TryGetComponent<MapGridComponent>(playerGrid, out var mapGrid))
|
||||
return;
|
||||
|
||||
var playerPosition = xform.Coordinates;
|
||||
|
||||
@@ -21,6 +21,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
using Robust.Shared.Spawners;
|
||||
@@ -216,7 +217,7 @@ public sealed class MagicSystem : EntitySystem
|
||||
// This is shit but you get the idea.
|
||||
var directionPos = casterXform.Coordinates.Offset(casterXform.LocalRotation.ToWorldVec().Normalized());
|
||||
|
||||
if (!_mapManager.TryGetGrid(casterXform.GridUid, out var mapGrid))
|
||||
if (!TryComp<MapGridComponent>(casterXform.GridUid, out var mapGrid))
|
||||
return new List<EntityCoordinates>();
|
||||
|
||||
if (!directionPos.TryGetTileRef(out var tileReference, EntityManager, _mapManager))
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.NPC.Components;
|
||||
using Content.Server.NPC.Pathfinding;
|
||||
using Content.Server.NPC.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
|
||||
@@ -14,7 +15,6 @@ namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
|
||||
public sealed partial class MoveToOperator : HTNOperator, IHtnConditionalShutdown
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
private NPCSteeringSystem _steering = default!;
|
||||
private PathfindingSystem _pathfind = default!;
|
||||
private SharedTransformSystem _transform = default!;
|
||||
@@ -85,8 +85,8 @@ public sealed partial class MoveToOperator : HTNOperator, IHtnConditionalShutdow
|
||||
!_entManager.TryGetComponent<PhysicsComponent>(owner, out var body))
|
||||
return (false, null);
|
||||
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var ownerGrid) ||
|
||||
!_mapManager.TryGetGrid(targetCoordinates.GetGridUid(_entManager), out var targetGrid))
|
||||
if (!_entManager.TryGetComponent<MapGridComponent>(xform.GridUid, out var ownerGrid) ||
|
||||
!_entManager.TryGetComponent<MapGridComponent>(targetCoordinates.GetGridUid(_entManager), out var targetGrid))
|
||||
{
|
||||
return (false, null);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.CombatMode;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.NPC;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -201,7 +202,7 @@ public sealed partial class NPCSteeringSystem
|
||||
private void GetObstacleEntities(PathPoly poly, int mask, int layer, List<EntityUid> ents)
|
||||
{
|
||||
// TODO: Can probably re-use this from pathfinding or something
|
||||
if (!_mapManager.TryGetGrid(poly.GraphUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(poly.GraphUid, out var grid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
[Dependency] private readonly IAdminManager _admin = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly ClimbSystem _climb = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||
|
||||
@@ -8,7 +8,7 @@ using Content.Shared.NodeContainer;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Content.Server.NodeContainer.EntitySystems
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
[Dependency] private readonly INodeGroupFactory _nodeGroupFactory = default!;
|
||||
[Dependency] private readonly ILogManager _logManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
private readonly List<int> _visDeletes = new();
|
||||
private readonly List<BaseNodeGroup> _visSends = new();
|
||||
@@ -343,7 +342,7 @@ namespace Content.Server.NodeContainer.EntitySystems
|
||||
private IEnumerable<Node> GetCompatibleNodes(Node node, EntityQuery<TransformComponent> xformQuery, EntityQuery<NodeContainerComponent> nodeQuery)
|
||||
{
|
||||
var xform = xformQuery.GetComponent(node.Owner);
|
||||
_mapManager.TryGetGrid(xform.GridUid, out var grid);
|
||||
TryComp<MapGridComponent>(xform.GridUid, out var grid);
|
||||
|
||||
if (!node.Connectable(EntityManager, xform))
|
||||
yield break;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -28,7 +29,6 @@ public sealed class NukeSystem : EntitySystem
|
||||
[Dependency] private readonly AlertLevelSystem _alertLevel = default!;
|
||||
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
||||
[Dependency] private readonly ExplosionSystem _explosions = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
|
||||
@@ -175,7 +175,7 @@ public sealed class NukeSystem : EntitySystem
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
return;
|
||||
|
||||
var worldPos = _transform.GetWorldPosition(xform);
|
||||
|
||||
@@ -6,17 +6,16 @@ using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using Content.Shared.Shuttles.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Player;
|
||||
using DroneConsoleComponent = Content.Server.Shuttles.DroneConsoleComponent;
|
||||
using DependencyAttribute = Robust.Shared.IoC.DependencyAttribute;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Physics.Controllers
|
||||
{
|
||||
public sealed class MoverController : SharedMoverController
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ThrusterSystem _thruster = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
@@ -276,7 +275,7 @@ namespace Content.Server.Physics.Controllers
|
||||
|
||||
var gridId = xform.GridUid;
|
||||
// This tries to see if the grid is a shuttle and if the console should work.
|
||||
if (!_mapManager.TryGetGrid(gridId, out var _) ||
|
||||
if (!TryComp<MapGridComponent>(gridId, out var _) ||
|
||||
!shuttleQuery.TryGetComponent(gridId, out var shuttleComponent) ||
|
||||
!shuttleComponent.Enabled)
|
||||
continue;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Power.EntitySystems;
|
||||
|
||||
@@ -25,7 +26,7 @@ public sealed partial class CableSystem
|
||||
if (component.CablePrototypeId == null)
|
||||
return;
|
||||
|
||||
if(!_mapManager.TryGetGrid(args.ClickLocation.GetGridUid(EntityManager), out var grid))
|
||||
if(!TryComp<MapGridComponent>(args.ClickLocation.GetGridUid(EntityManager), out var grid))
|
||||
return;
|
||||
|
||||
var snapPos = grid.TileIndicesFor(args.ClickLocation);
|
||||
|
||||
@@ -5,10 +5,7 @@ using Content.Server.Stack;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tools;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Robust.Shared.Map;
|
||||
using System.Xml.Schema;
|
||||
using CableCuttingFinishedEvent = Content.Shared.Tools.Systems.CableCuttingFinishedEvent;
|
||||
using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
|
||||
|
||||
@@ -16,13 +13,11 @@ namespace Content.Server.Power.EntitySystems;
|
||||
|
||||
public sealed partial class CableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileManager = default!;
|
||||
[Dependency] private readonly SharedToolSystem _toolSystem = default!;
|
||||
[Dependency] private readonly StackSystem _stack = default!;
|
||||
[Dependency] private readonly ElectrocutionSystem _electrocutionSystem = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogs = default!;
|
||||
[Dependency] private readonly PowerMonitoringConsoleSystem _powerMonitoringSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -4,15 +4,13 @@ using Content.Server.Power.Components;
|
||||
using Content.Server.Power.Nodes;
|
||||
using Content.Shared.Wires;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Power.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class CableVisSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
||||
|
||||
@@ -32,7 +30,7 @@ namespace Content.Server.Power.EntitySystems
|
||||
return;
|
||||
|
||||
var transform = Transform(uid);
|
||||
if (!_mapManager.TryGetGrid(transform.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(transform.GridUid, out var grid))
|
||||
return;
|
||||
|
||||
var mask = WireVisDirFlags.None;
|
||||
|
||||
@@ -9,13 +9,13 @@ using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Respawn;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Respawn;
|
||||
|
||||
public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLog = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
|
||||
@@ -84,7 +84,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
if (!component.Respawn || !HasComp<StationMemberComponent>(entityGridUid) || entityMapUid == null)
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(entityGridUid, out var grid) || MetaData(entityGridUid.Value).EntityLifeStage >= EntityLifeStage.Terminating)
|
||||
if (!TryComp<MapGridComponent>(entityGridUid, out var grid) || MetaData(entityGridUid.Value).EntityLifeStage >= EntityLifeStage.Terminating)
|
||||
return;
|
||||
|
||||
if (TryFindRandomTile(entityGridUid.Value, entityMapUid.Value, 10, out var coords))
|
||||
@@ -146,7 +146,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
{
|
||||
targetCoords = EntityCoordinates.Invalid;
|
||||
|
||||
if (!_mapManager.TryGetGrid(targetGrid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(targetGrid, out var grid))
|
||||
return false;
|
||||
|
||||
var xform = Transform(targetGrid);
|
||||
|
||||
@@ -2,7 +2,6 @@ using Content.Shared.Popups;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Revenant;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Map;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Server.Light.Components;
|
||||
@@ -15,7 +14,6 @@ using Content.Shared.Item;
|
||||
using Content.Shared.Bed.Sleep;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server.Maps;
|
||||
using Content.Server.Revenant.Components;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Emag.Systems;
|
||||
@@ -28,12 +26,12 @@ using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Revenant.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Revenant.EntitySystems;
|
||||
|
||||
public sealed partial class RevenantSystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
|
||||
[Dependency] private readonly EmagSystem _emag = default!;
|
||||
@@ -213,7 +211,7 @@ public sealed partial class RevenantSystem
|
||||
//var coords = Transform(uid).Coordinates;
|
||||
//var gridId = coords.GetGridUid(EntityManager);
|
||||
var xform = Transform(uid);
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var map))
|
||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var map))
|
||||
return;
|
||||
var tiles = map.GetTilesIntersecting(Box2.CenteredAround(xform.WorldPosition,
|
||||
new Vector2(component.DefileRadius * 2, component.DefileRadius))).ToArray();
|
||||
|
||||
@@ -492,7 +492,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
centcomm.ShuttleIndex += _mapManager.GetGrid(shuttle.Value).LocalAABB.Width + ShuttleSpawnBuffer;
|
||||
centcomm.ShuttleIndex += Comp<MapGridComponent>(shuttle.Value).LocalAABB.Width + ShuttleSpawnBuffer;
|
||||
|
||||
// Update indices for all centcomm comps pointing to same map
|
||||
var query = AllEntityQuery<StationCentcommComponent>();
|
||||
|
||||
@@ -559,7 +559,7 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
private float GetSoundRange(EntityUid uid)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(uid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(uid, out var grid))
|
||||
return 4f;
|
||||
|
||||
return MathF.Max(grid.LocalAABB.Width, grid.LocalAABB.Height) + 12.5f;
|
||||
|
||||
@@ -12,6 +12,7 @@ using Content.Shared.Physics;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using Content.Shared.Temperature;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
@@ -95,7 +96,7 @@ public sealed class ThrusterSystem : EntitySystem
|
||||
return;
|
||||
|
||||
var tilePos = args.NewTile.GridIndices;
|
||||
var grid = _mapManager.GetGrid(uid);
|
||||
var grid = Comp<MapGridComponent>(uid);
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var thrusterQuery = GetEntityQuery<ThrusterComponent>();
|
||||
|
||||
@@ -436,7 +437,7 @@ public sealed class ThrusterSystem : EntitySystem
|
||||
return true;
|
||||
|
||||
var (x, y) = xform.LocalPosition + xform.LocalRotation.Opposite().ToWorldVec();
|
||||
var tile = _mapManager.GetGrid(xform.GridUid.Value).GetTileRef(new Vector2i((int) Math.Floor(x), (int) Math.Floor(y)));
|
||||
var tile = Comp<MapGridComponent>(xform.GridUid.Value).GetTileRef(new Vector2i((int) Math.Floor(x), (int) Math.Floor(y)));
|
||||
|
||||
return tile.Tile.IsSpace();
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
|
||||
/// </summary>
|
||||
public void ConsumeTile(EntityUid hungry, TileRef tile, EventHorizonComponent eventHorizon)
|
||||
{
|
||||
ConsumeTiles(hungry, new List<(Vector2i, Tile)>(new[] { (tile.GridIndices, Tile.Empty) }), tile.GridUid, _mapMan.GetGrid(tile.GridUid), eventHorizon);
|
||||
ConsumeTiles(hungry, new List<(Vector2i, Tile)>(new[] { (tile.GridIndices, Tile.Empty) }), tile.GridUid, Comp<MapGridComponent>(tile.GridUid), eventHorizon);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -238,7 +238,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
|
||||
/// </summary>
|
||||
public void AttemptConsumeTile(EntityUid hungry, TileRef tile, EventHorizonComponent eventHorizon)
|
||||
{
|
||||
AttemptConsumeTiles(hungry, new TileRef[1] { tile }, tile.GridUid, _mapMan.GetGrid(tile.GridUid), eventHorizon);
|
||||
AttemptConsumeTiles(hungry, new TileRef[1] { tile }, tile.GridUid, Comp<MapGridComponent>(tile.GridUid), eventHorizon);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Shared.Construction.Components;
|
||||
using Content.Shared.SubFloor;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.SubFloor;
|
||||
|
||||
@@ -17,7 +18,7 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem
|
||||
// No teleporting entities through floor tiles when anchoring them.
|
||||
var xform = Transform(uid);
|
||||
|
||||
if (MapManager.TryGetGrid(xform.GridUid, out var grid)
|
||||
if (TryComp<MapGridComponent>(xform.GridUid, out var grid)
|
||||
&& HasFloorCover(grid, grid.TileIndicesFor(xform.Coordinates)))
|
||||
{
|
||||
args.Cancel();
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Numerics;
|
||||
using Content.Server.Maps;
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -14,7 +12,6 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
|
||||
|
||||
public sealed class ThrowArtifactSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
@@ -29,7 +26,7 @@ public sealed class ThrowArtifactSystem : EntitySystem
|
||||
private void OnActivated(EntityUid uid, ThrowArtifactComponent component, ArtifactActivatedEvent args)
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
if (_map.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
{
|
||||
var tiles = grid.GetTilesIntersecting(
|
||||
Box2.CenteredAround(xform.WorldPosition, new Vector2(component.Range * 2, component.Range)));
|
||||
|
||||
@@ -270,7 +270,7 @@ public sealed partial class AnchorableSystem : EntitySystem
|
||||
// Probably ignore CanCollide on the anchoring body?
|
||||
var gridUid = coordinates.GetGridUid(EntityManager);
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(gridUid, out var grid))
|
||||
return false;
|
||||
|
||||
var tileIndices = grid.TileIndicesFor(coordinates);
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Shared.Coordinates.Helpers
|
||||
return EntityCoordinates.FromMap(coordinates.EntityId, mapPos, xformSys);
|
||||
}
|
||||
|
||||
var grid = mapManager.GetGrid(gridId.Value);
|
||||
var grid = entMan.GetComponent<MapGridComponent>(gridId.Value);
|
||||
var tileSize = grid.TileSize;
|
||||
var localPos = coordinates.WithEntityId(gridId.Value).Position;
|
||||
var x = (int)Math.Floor(localPos.X / tileSize) + tileSize / 2f;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Shared.Maps
|
||||
@@ -14,11 +15,11 @@ namespace Content.Shared.Maps
|
||||
/// <summary>
|
||||
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
|
||||
/// </summary>
|
||||
public static TileRef GetTileRef(this Vector2i vector2i, EntityUid gridId, IMapManager? mapManager = null)
|
||||
public static TileRef GetTileRef(this Vector2i vector2i, EntityUid gridId, IEntityManager? entityManager = null)
|
||||
{
|
||||
mapManager ??= IoCManager.Resolve<IMapManager>();
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
if (!entityManager.TryGetComponent<MapGridComponent>(gridId, out var grid))
|
||||
return default;
|
||||
|
||||
if (!grid.TryGetTileRef(vector2i, out var tile))
|
||||
@@ -144,9 +145,8 @@ namespace Content.Shared.Maps
|
||||
private static bool GetWorldTileBox(TileRef turf, out Box2Rotated res)
|
||||
{
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var map = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
if (map.TryGetGrid(turf.GridUid, out var tileGrid))
|
||||
if (entManager.TryGetComponent<MapGridComponent>(turf.GridUid, out var tileGrid))
|
||||
{
|
||||
var gridRot = entManager.GetComponent<TransformComponent>(turf.GridUid).WorldRotation;
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public sealed class TurfSystem : EntitySystem
|
||||
/// </summary>
|
||||
public EntityCoordinates GetTileCenter(TileRef turf)
|
||||
{
|
||||
var grid = _mapMan.GetGrid(turf.GridUid);
|
||||
var grid = Comp<MapGridComponent>(turf.GridUid);
|
||||
var center = (turf.GridIndices + new Vector2(0.5f, 0.5f)) * grid.TileSize;
|
||||
return new EntityCoordinates(turf.GridUid, center);
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ namespace Content.Shared.Movement.Systems
|
||||
sound = null;
|
||||
|
||||
// Fallback to the map?
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
{
|
||||
if (TryComp<FootstepModifierComponent>(xform.MapUid, out var modifier))
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Shared.Conveyor;
|
||||
using Content.Shared.Gravity;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Controllers;
|
||||
@@ -146,7 +147,7 @@ public abstract class SharedConveyorController : VirtualController
|
||||
EntityQuery<PhysicsComponent> bodyQuery)
|
||||
{
|
||||
// Check if the thing's centre overlaps the grid tile.
|
||||
var grid = MapManager.GetGrid(xform.GridUid!.Value);
|
||||
var grid = Comp<MapGridComponent>(xform.GridUid!.Value);
|
||||
var tile = grid.GetTileRef(xform.Coordinates);
|
||||
var conveyorBounds = Lookup.GetLocalBounds(tile, grid.TileSize);
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ public sealed class RCDSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var mapGrid = _mapMan.GetGrid(gridId.Value);
|
||||
var mapGrid = Comp<MapGridComponent>(gridId.Value);
|
||||
var tile = mapGrid.GetTileRef(location);
|
||||
|
||||
if (!IsRCDStillValid(uid, comp, args.Event.User, args.Event.Target, mapGrid, tile, args.Event.StartingMode))
|
||||
@@ -157,7 +157,7 @@ public sealed class RCDSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var mapGrid = _mapMan.GetGrid(gridId.Value);
|
||||
var mapGrid = Comp<MapGridComponent>(gridId.Value);
|
||||
var tile = mapGrid.GetTileRef(location);
|
||||
var snapPos = mapGrid.TileIndicesFor(location);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
@@ -25,7 +26,6 @@ public abstract class SharedEmitSoundSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly INetManager _netMan = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefMan = default!;
|
||||
[Dependency] protected readonly IRobustRandom Random = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
@@ -54,7 +54,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem
|
||||
{
|
||||
if (!args.PlaySound ||
|
||||
!TryComp<TransformComponent>(uid, out var xform) ||
|
||||
!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
!TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace Content.Shared.SubFloor
|
||||
[UsedImplicitly]
|
||||
public abstract class SharedSubFloorHideSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly IMapManager MapManager = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
||||
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
||||
@@ -93,7 +92,7 @@ namespace Content.Shared.SubFloor
|
||||
if (args.NewTile.Tile.IsEmpty)
|
||||
return; // Anything that was here will be unanchored anyways.
|
||||
|
||||
UpdateTile(MapManager.GetGrid(args.NewTile.GridUid), args.NewTile.GridIndices);
|
||||
UpdateTile(Comp<MapGridComponent>(args.NewTile.GridUid), args.NewTile.GridIndices);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -104,7 +103,7 @@ namespace Content.Shared.SubFloor
|
||||
if (!Resolve(uid, ref component, ref xform))
|
||||
return;
|
||||
|
||||
if (xform.Anchored && MapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (xform.Anchored && TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
component.IsUnderCover = HasFloorCover(grid, grid.TileIndicesFor(xform.Coordinates));
|
||||
else
|
||||
component.IsUnderCover = false;
|
||||
|
||||
@@ -116,7 +116,7 @@ public sealed class FloorTileSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
}
|
||||
_mapManager.TryGetGrid(location.EntityId, out var mapGrid);
|
||||
TryComp<MapGridComponent>(location.EntityId, out var mapGrid);
|
||||
|
||||
foreach (var currentTile in component.OutputTiles)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user