Remove Explicit GridId References (#8315)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -197,17 +197,17 @@ namespace Content.Client.AI
|
||||
private readonly Dictionary<int, Color> _graphColors = new();
|
||||
|
||||
// Cached regions
|
||||
public readonly Dictionary<GridId, Dictionary<int, List<Vector2>>> CachedRegions =
|
||||
public readonly Dictionary<EntityUid, Dictionary<int, List<Vector2>>> CachedRegions =
|
||||
new();
|
||||
|
||||
private readonly Dictionary<GridId, Dictionary<int, Color>> _cachedRegionColors =
|
||||
private readonly Dictionary<EntityUid, Dictionary<int, Color>> _cachedRegionColors =
|
||||
new();
|
||||
|
||||
// Regions
|
||||
public readonly Dictionary<GridId, Dictionary<int, Dictionary<int, List<Vector2>>>> Regions =
|
||||
public readonly Dictionary<EntityUid, Dictionary<int, Dictionary<int, List<Vector2>>>> Regions =
|
||||
new();
|
||||
|
||||
private readonly Dictionary<GridId, Dictionary<int, Dictionary<int, Color>>> _regionColors =
|
||||
private readonly Dictionary<EntityUid, Dictionary<int, Dictionary<int, Color>>> _regionColors =
|
||||
new();
|
||||
|
||||
// Route debugging
|
||||
@@ -260,7 +260,7 @@ namespace Content.Client.AI
|
||||
|
||||
#region Regions
|
||||
//Server side debugger should increment every region
|
||||
public void UpdateCachedRegions(GridId gridId, Dictionary<int, List<Vector2>> messageRegions, bool cached)
|
||||
public void UpdateCachedRegions(EntityUid gridId, Dictionary<int, List<Vector2>> messageRegions, bool cached)
|
||||
{
|
||||
if (!CachedRegions.ContainsKey(gridId))
|
||||
{
|
||||
@@ -294,7 +294,7 @@ namespace Content.Client.AI
|
||||
private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
||||
{
|
||||
var transform = _entities.GetComponentOrNull<TransformComponent>(_playerManager.LocalPlayer?.ControlledEntity);
|
||||
if (transform == null || !CachedRegions.TryGetValue(transform.GridID, out var entityRegions))
|
||||
if (transform == null || !CachedRegions.TryGetValue(transform.GridEntityId, out var entityRegions))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -312,12 +312,12 @@ namespace Content.Client.AI
|
||||
screenTile.X + 15.0f,
|
||||
screenTile.Y + 15.0f);
|
||||
|
||||
screenHandle.DrawRect(box, _cachedRegionColors[transform.GridID][region]);
|
||||
screenHandle.DrawRect(box, _cachedRegionColors[transform.GridEntityId][region]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateRegions(GridId gridId, Dictionary<int, Dictionary<int, List<Vector2>>> messageRegions)
|
||||
public void UpdateRegions(EntityUid gridId, Dictionary<int, Dictionary<int, List<Vector2>>> messageRegions)
|
||||
{
|
||||
if (!Regions.ContainsKey(gridId))
|
||||
{
|
||||
@@ -344,7 +344,7 @@ namespace Content.Client.AI
|
||||
{
|
||||
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (!_entities.TryGetComponent(attachedEntity, out TransformComponent? transform) ||
|
||||
!Regions.TryGetValue(transform.GridID, out var entityRegions))
|
||||
!Regions.TryGetValue(transform.GridEntityId, out var entityRegions))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -364,7 +364,7 @@ namespace Content.Client.AI
|
||||
screenTile.X + 15.0f,
|
||||
screenTile.Y + 15.0f);
|
||||
|
||||
screenHandle.DrawRect(box, _regionColors[_entities.GetComponent<TransformComponent>(attachedEntity.Value).GridID][chunk][region]);
|
||||
screenHandle.DrawRect(box, _regionColors[_entities.GetComponent<TransformComponent>(attachedEntity.Value).GridEntityId][chunk][region]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public sealed class ExplosionDebugOverlay : Overlay
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
public Dictionary<int, List<Vector2i>>? SpaceTiles;
|
||||
public Dictionary<GridId, Dictionary<int, List<Vector2i>>> Tiles = new();
|
||||
public Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> Tiles = new();
|
||||
public List<float> Intensity = new();
|
||||
public float TotalIntensity;
|
||||
public float Slope;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
@@ -20,12 +20,12 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.GridEntityId != 0);
|
||||
foreach (var grid in _data)
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridID;
|
||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridEntityId;
|
||||
GridOptions.AddItem($"{grid.GridEntityId} {(playerGrid == grid.GridEntityId ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
@@ -37,7 +37,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Index;
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].GridEntityId;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos.Prototypes;
|
||||
@@ -24,12 +24,12 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill out grids
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.GridEntityId != 0);
|
||||
foreach (var grid in _gridData)
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridID;
|
||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridEntityId;
|
||||
GridOptions.AddItem($"{grid.GridEntityId} {(playerGrid == grid.GridEntityId ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
@@ -52,7 +52,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Index;
|
||||
var gridIndex = gridList[GridOptions.SelectedId].GridEntityId;
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos.Prototypes;
|
||||
@@ -24,12 +24,12 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill out grids
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.GridEntityId != 0);
|
||||
foreach (var grid in _gridData)
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridID;
|
||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridEntityId;
|
||||
GridOptions.AddItem($"{grid.GridEntityId} {(playerGrid == grid.GridEntityId ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
@@ -52,7 +52,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Index;
|
||||
var gridIndex = gridList[GridOptions.SelectedId].GridEntityId;
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
@@ -20,12 +20,12 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.GridEntityId != 0);
|
||||
foreach (var grid in _data)
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridID;
|
||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridEntityId;
|
||||
GridOptions.AddItem($"{grid.GridEntityId} {(playerGrid == grid.GridEntityId ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
@@ -37,7 +37,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Index;
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].GridEntityId;
|
||||
IoCManager.Resolve<IClientConsoleHost>()
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Client.Atmos.EntitySystems
|
||||
internal sealed class AtmosDebugOverlaySystem : SharedAtmosDebugOverlaySystem
|
||||
{
|
||||
|
||||
private readonly Dictionary<GridId, AtmosDebugOverlayMessage> _tileData =
|
||||
private readonly Dictionary<EntityUid, AtmosDebugOverlayMessage> _tileData =
|
||||
new();
|
||||
|
||||
// Configuration set by debug commands and used by AtmosDebugOverlay {
|
||||
@@ -77,12 +77,12 @@ namespace Content.Client.Atmos.EntitySystems
|
||||
_tileData.Clear();
|
||||
}
|
||||
|
||||
public bool HasData(GridId gridId)
|
||||
public bool HasData(EntityUid gridId)
|
||||
{
|
||||
return _tileData.ContainsKey(gridId);
|
||||
}
|
||||
|
||||
public AtmosDebugOverlayData? GetData(GridId gridIndex, Vector2i indices)
|
||||
public AtmosDebugOverlayData? GetData(EntityUid gridIndex, Vector2i indices)
|
||||
{
|
||||
if (!_tileData.TryGetValue(gridIndex, out var srcMsg))
|
||||
return null;
|
||||
|
||||
@@ -5,7 +5,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Atmos.EntitySystems
|
||||
@@ -31,7 +30,7 @@ namespace Content.Client.Atmos.EntitySystems
|
||||
public readonly int[] FireFrameCounter = new int[FireStates];
|
||||
public readonly Texture[][] FireFrames = new Texture[FireStates][];
|
||||
|
||||
private readonly Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>> _tileData =
|
||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, GasOverlayChunk>> _tileData =
|
||||
new();
|
||||
|
||||
public const int GasOverlayZIndex = 1;
|
||||
@@ -95,7 +94,7 @@ namespace Content.Client.Atmos.EntitySystems
|
||||
}
|
||||
|
||||
// Slightly different to the server-side system version
|
||||
private GasOverlayChunk GetOrCreateChunk(GridId gridId, Vector2i indices)
|
||||
private GasOverlayChunk GetOrCreateChunk(EntityUid gridId, Vector2i indices)
|
||||
{
|
||||
if (!_tileData.TryGetValue(gridId, out var chunks))
|
||||
{
|
||||
@@ -130,12 +129,12 @@ namespace Content.Client.Atmos.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasData(GridId gridId)
|
||||
public bool HasData(EntityUid gridId)
|
||||
{
|
||||
return _tileData.ContainsKey(gridId);
|
||||
}
|
||||
|
||||
public GasOverlayEnumerator GetOverlays(GridId gridIndex, Vector2i indices)
|
||||
public GasOverlayEnumerator GetOverlays(EntityUid gridIndex, Vector2i indices)
|
||||
{
|
||||
if (!_tileData.TryGetValue(gridIndex, out var chunks))
|
||||
return default;
|
||||
@@ -149,7 +148,7 @@ namespace Content.Client.Atmos.EntitySystems
|
||||
return new GasOverlayEnumerator(overlays, this);
|
||||
}
|
||||
|
||||
public FireOverlayEnumerator GetFireOverlays(GridId gridIndex, Vector2i indices)
|
||||
public FireOverlayEnumerator GetFireOverlays(EntityUid gridIndex, Vector2i indices)
|
||||
{
|
||||
if (!_tileData.TryGetValue(gridIndex, out var chunks))
|
||||
return default;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.Atmos.EntitySystems;
|
||||
using Content.Client.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.EntitySystems;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -41,7 +41,7 @@ namespace Content.Client.Atmos.Overlays
|
||||
|
||||
foreach (var mapGrid in _mapManager.FindGridsIntersecting(mapId, worldBounds))
|
||||
{
|
||||
if (!_atmosDebugOverlaySystem.HasData(mapGrid.Index))
|
||||
if (!_atmosDebugOverlaySystem.HasData(mapGrid.GridEntityId))
|
||||
continue;
|
||||
|
||||
drawHandle.SetTransform(mapGrid.WorldMatrix);
|
||||
@@ -50,7 +50,7 @@ namespace Content.Client.Atmos.Overlays
|
||||
{
|
||||
foreach (var tile in mapGrid.GetTilesIntersecting(worldBounds))
|
||||
{
|
||||
var dataMaybeNull = _atmosDebugOverlaySystem.GetData(mapGrid.Index, tile.GridIndices);
|
||||
var dataMaybeNull = _atmosDebugOverlaySystem.GetData(mapGrid.GridEntityId, tile.GridIndices);
|
||||
if (dataMaybeNull != null)
|
||||
{
|
||||
var data = (SharedAtmosDebugOverlaySystem.AtmosDebugOverlayData) dataMaybeNull!;
|
||||
|
||||
@@ -36,14 +36,14 @@ namespace Content.Client.Atmos.Overlays
|
||||
|
||||
foreach (var mapGrid in _mapManager.FindGridsIntersecting(mapId, worldBounds))
|
||||
{
|
||||
if (!_gasTileOverlaySystem.HasData(mapGrid.Index))
|
||||
if (!_gasTileOverlaySystem.HasData(mapGrid.GridEntityId))
|
||||
continue;
|
||||
|
||||
drawHandle.SetTransform(mapGrid.WorldMatrix);
|
||||
|
||||
foreach (var tile in mapGrid.GetTilesIntersecting(worldBounds))
|
||||
{
|
||||
var enumerator = _gasTileOverlaySystem.GetFireOverlays(mapGrid.Index, tile.GridIndices);
|
||||
var enumerator = _gasTileOverlaySystem.GetFireOverlays(mapGrid.GridEntityId, tile.GridIndices);
|
||||
while (enumerator.MoveNext(out var tuple))
|
||||
{
|
||||
drawHandle.DrawTexture(tuple.Texture, new Vector2(tile.X, tile.Y), tuple.Color);
|
||||
|
||||
@@ -35,14 +35,14 @@ namespace Content.Client.Atmos.Overlays
|
||||
|
||||
foreach (var mapGrid in _mapManager.FindGridsIntersecting(mapId, worldBounds))
|
||||
{
|
||||
if (!_gasTileOverlaySystem.HasData(mapGrid.Index))
|
||||
if (!_gasTileOverlaySystem.HasData(mapGrid.GridEntityId))
|
||||
continue;
|
||||
|
||||
drawHandle.SetTransform(mapGrid.WorldMatrix);
|
||||
|
||||
foreach (var tile in mapGrid.GetTilesIntersecting(worldBounds))
|
||||
{
|
||||
var enumerator = _gasTileOverlaySystem.GetOverlays(mapGrid.Index, tile.GridIndices);
|
||||
var enumerator = _gasTileOverlaySystem.GetOverlays(mapGrid.GridEntityId, tile.GridIndices);
|
||||
while (enumerator.MoveNext(out var tuple))
|
||||
{
|
||||
drawHandle.DrawTexture(tuple.Texture, new Vector2(tile.X, tile.Y), tuple.Color);
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Content.Client.Audio
|
||||
{
|
||||
if(_playMan.LocalPlayer is null || _playMan.LocalPlayer.ControlledEntity != message.Entity) return;
|
||||
if (!TryComp<TransformComponent>(message.Entity, out var xform) ||
|
||||
!_mapManager.TryGetGrid(xform.GridID, out var grid)) return;
|
||||
!_mapManager.TryGetGrid(xform.GridEntityId, out var grid)) return;
|
||||
|
||||
var tileDef = (ContentTileDefinition) _tileDefMan[grid.GetTileRef(xform.Coordinates).Tile.TypeId];
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ namespace Content.Client.Decals
|
||||
{
|
||||
if (zIndexDictionary.Count == 0) continue;
|
||||
|
||||
var gridUid = _mapManager.GetGridEuid(gridId);
|
||||
var xform = xformQuery.GetComponent(gridUid);
|
||||
var xform = xformQuery.GetComponent(gridId);
|
||||
|
||||
handle.SetTransform(_transform.GetWorldMatrix(xform, xformQuery));
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using Content.Shared.Decals;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Decals
|
||||
{
|
||||
@@ -13,8 +11,8 @@ namespace Content.Client.Decals
|
||||
[Dependency] private readonly SpriteSystem _sprites = default!;
|
||||
|
||||
private DecalOverlay _overlay = default!;
|
||||
public Dictionary<GridId, SortedDictionary<int, SortedDictionary<uint, Decal>>> DecalRenderIndex = new();
|
||||
private Dictionary<GridId, Dictionary<uint, int>> DecalZIndexIndex = new();
|
||||
public Dictionary<EntityUid, SortedDictionary<int, SortedDictionary<uint, Decal>>> DecalRenderIndex = new();
|
||||
private Dictionary<EntityUid, Dictionary<uint, int>> DecalZIndexIndex = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -58,13 +56,13 @@ namespace Content.Client.Decals
|
||||
_overlayManager.RemoveOverlay(_overlay);
|
||||
}
|
||||
|
||||
protected override bool RemoveDecalHook(GridId gridId, uint uid)
|
||||
protected override bool RemoveDecalHook(EntityUid gridId, uint uid)
|
||||
{
|
||||
RemoveDecalFromRenderIndex(gridId, uid);
|
||||
return base.RemoveDecalHook(gridId, uid);
|
||||
}
|
||||
|
||||
private void RemoveDecalFromRenderIndex(GridId gridId, uint uid)
|
||||
private void RemoveDecalFromRenderIndex(EntityUid gridId, uint uid)
|
||||
{
|
||||
var zIndex = DecalZIndexIndex[gridId][uid];
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ public sealed class ExplosionOverlaySystem : EntitySystem
|
||||
internal sealed class Explosion
|
||||
{
|
||||
public readonly Dictionary<int, List<Vector2i>>? SpaceTiles;
|
||||
public readonly Dictionary<GridId, Dictionary<int, List<Vector2i>>> Tiles;
|
||||
public readonly Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> Tiles;
|
||||
public readonly List<float> Intensity;
|
||||
public readonly EntityUid LightEntity;
|
||||
public readonly MapId Map;
|
||||
|
||||
@@ -105,7 +105,7 @@ public sealed class EyeLerpingSystem : EntitySystem
|
||||
if (!TryComp(uid, out TransformComponent? transform)
|
||||
|| !TryComp(uid, out EyeComponent? eye)
|
||||
|| eye.Eye == null
|
||||
|| !_mapManager.TryGetGrid(transform.GridID, out var grid))
|
||||
|| !_mapManager.TryGetGrid(transform.GridEntityId, out var grid))
|
||||
{
|
||||
_toRemove.Add(uid);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.IconSmoothing
|
||||
{
|
||||
@@ -14,7 +13,7 @@ namespace Content.Client.IconSmoothing
|
||||
[RegisterComponent]
|
||||
public sealed class IconSmoothComponent : Component
|
||||
{
|
||||
public (GridId, Vector2i)? LastPosition;
|
||||
public (EntityUid, Vector2i)? LastPosition;
|
||||
|
||||
/// <summary>
|
||||
/// We will smooth with other objects with the same key.
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace Content.Client.IconSmoothing
|
||||
var xform = Transform(uid);
|
||||
if (xform.Anchored)
|
||||
{
|
||||
component.LastPosition = _mapManager.TryGetGrid(xform.GridID, out var grid)
|
||||
? (xform.GridID, grid.TileIndicesFor(xform.Coordinates))
|
||||
: (GridId.Invalid, new Vector2i(0, 0));
|
||||
component.LastPosition = _mapManager.TryGetGrid(xform.GridEntityId, out var grid)
|
||||
? (xform.GridEntityId, grid.TileIndicesFor(xform.Coordinates))
|
||||
: (EntityUid.Invalid, new Vector2i(0, 0));
|
||||
|
||||
DirtyNeighbours(uid, component);
|
||||
}
|
||||
@@ -111,14 +111,14 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
Vector2i pos;
|
||||
|
||||
if (transform.Anchored && _mapManager.TryGetGrid(transform.GridID, out var grid))
|
||||
if (transform.Anchored && _mapManager.TryGetGrid(transform.GridEntityId, out var grid))
|
||||
{
|
||||
pos = grid.CoordinatesToTile(transform.Coordinates);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Entity is no longer valid, update around the last position it was at.
|
||||
if (comp.LastPosition is not (GridId gridId, Vector2i oldPos))
|
||||
if (comp.LastPosition is not (EntityUid gridId, Vector2i oldPos))
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridId, out grid))
|
||||
@@ -191,9 +191,9 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
if (xform.Anchored)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(xform.GridID, out grid))
|
||||
if (!_mapManager.TryGetGrid(xform.GridEntityId, out grid))
|
||||
{
|
||||
Logger.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridID} was missing.");
|
||||
Logger.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridEntityId} was missing.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Client.NodeContainer
|
||||
private readonly IEntityManager _entityManager;
|
||||
|
||||
private readonly Dictionary<(int, int), NodeRenderData> _nodeIndex = new();
|
||||
private readonly Dictionary<GridId, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new ();
|
||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, List<(GroupData, NodeDatum)>>> _gridIndex = new ();
|
||||
|
||||
private readonly Font _font;
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Content.Client.NodeContainer
|
||||
var node = _system.NodeLookup[(groupId, nodeId)];
|
||||
|
||||
|
||||
var gridId = _entityManager.GetComponent<TransformComponent>(node.Entity).GridID;
|
||||
var gridId = _entityManager.GetComponent<TransformComponent>(node.Entity).GridEntityId;
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
var gridTile = grid.TileIndicesFor(_entityManager.GetComponent<TransformComponent>(node.Entity).Coordinates);
|
||||
|
||||
@@ -112,12 +112,12 @@ namespace Content.Client.NodeContainer
|
||||
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(map, worldAABB))
|
||||
{
|
||||
foreach (var entity in _lookup.GetEntitiesIntersecting(grid.Index, worldAABB))
|
||||
foreach (var entity in _lookup.GetEntitiesIntersecting(grid.GridEntityId, worldAABB))
|
||||
{
|
||||
if (!_system.Entities.TryGetValue(entity, out var nodeData))
|
||||
continue;
|
||||
|
||||
var gridDict = _gridIndex.GetOrNew(grid.Index);
|
||||
var gridDict = _gridIndex.GetOrNew(grid.GridEntityId);
|
||||
var coords = xformQuery.GetComponent(entity).Coordinates;
|
||||
|
||||
// TODO: This probably shouldn't be capable of returning NaN...
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.Physics.Controllers
|
||||
return;
|
||||
}
|
||||
|
||||
if (xform.GridID != GridId.Invalid)
|
||||
if (xform.GridEntityId != EntityUid.Invalid)
|
||||
mover.LastGridAngle = GetParentGridAngle(xform, mover);
|
||||
|
||||
// Essentially we only want to set our mob to predicted so every other entity we just interpolate
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Body.Systems;
|
||||
@@ -61,7 +61,7 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
MetabolizerSystem metaSys = default;
|
||||
|
||||
MapId mapId;
|
||||
GridId? grid = null;
|
||||
EntityUid? grid = null;
|
||||
SharedBodyComponent body = default;
|
||||
EntityUid human = default;
|
||||
GridAtmosphereComponent relevantAtmos = default;
|
||||
@@ -91,12 +91,11 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var coords = new Vector2(0.5f, -1f);
|
||||
var geid = mapManager.GetGridEuid(grid.Value);
|
||||
var coordinates = new EntityCoordinates(geid, coords);
|
||||
var coordinates = new EntityCoordinates(grid.Value, coords);
|
||||
human = entityManager.SpawnEntity("HumanBodyDummy", coordinates);
|
||||
respSys = EntitySystem.Get<RespiratorSystem>();
|
||||
metaSys = EntitySystem.Get<MetabolizerSystem>();
|
||||
relevantAtmos = entityManager.GetComponent<GridAtmosphereComponent>(geid);
|
||||
relevantAtmos = entityManager.GetComponent<GridAtmosphereComponent>(grid.Value);
|
||||
startingMoles = GetMapMoles();
|
||||
|
||||
Assert.True(entityManager.TryGetComponent(human, out body));
|
||||
@@ -138,7 +137,7 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||
|
||||
MapId mapId;
|
||||
GridId? grid = null;
|
||||
EntityUid? grid = null;
|
||||
RespiratorComponent respirator = null;
|
||||
EntityUid human = default;
|
||||
|
||||
@@ -155,8 +154,7 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var center = new Vector2(0.5f, -1.5f);
|
||||
var geid = mapManager.GetGridEuid(grid.Value);
|
||||
var coordinates = new EntityCoordinates(geid, center);
|
||||
var coordinates = new EntityCoordinates(grid.Value, center);
|
||||
human = entityManager.SpawnEntity("HumanBodyDummy", coordinates);
|
||||
|
||||
Assert.True(entityManager.HasComponent<SharedBodyComponent>(human));
|
||||
|
||||
@@ -45,12 +45,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
mapManager.AddUninitializedMap(mapId);
|
||||
|
||||
var gridId = new GridId(1);
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out grid))
|
||||
{
|
||||
grid = mapManager.CreateGrid(mapId, gridId);
|
||||
}
|
||||
grid = mapManager.CreateGrid(mapId);
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
@@ -136,12 +131,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
mapManager.AddUninitializedMap(mapId);
|
||||
|
||||
var gridId = new GridId(1);
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out grid))
|
||||
{
|
||||
grid = mapManager.CreateGrid(mapId, gridId);
|
||||
}
|
||||
grid = mapManager.CreateGrid(mapId);
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
@@ -239,12 +229,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
mapManager.AddUninitializedMap(mapId);
|
||||
|
||||
var gridId = new GridId(1);
|
||||
|
||||
if (!mapManager.TryGetGrid(gridId, out grid))
|
||||
{
|
||||
grid = mapManager.CreateGrid(mapId, gridId);
|
||||
}
|
||||
grid = mapManager.CreateGrid(mapId);
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Fluids.Components;
|
||||
@@ -55,13 +55,13 @@ public sealed class FluidSpill : ContentIntegrationTest
|
||||
var spillSystem = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<SpillableSystem>();
|
||||
var gameTiming = server.ResolveDependency<IGameTiming>();
|
||||
MapId mapId;
|
||||
GridId gridId = default;
|
||||
EntityUid gridId = default;
|
||||
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
mapId = mapManager.CreateMap();
|
||||
var grid = mapManager.CreateGrid(mapId);
|
||||
gridId = grid.Index;
|
||||
gridId = grid.GridEntityId;
|
||||
|
||||
for (var x = 0; x < 3; x++)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ public sealed class FluidSpill : ContentIntegrationTest
|
||||
var spillSystem = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<SpillableSystem>();
|
||||
var gameTiming = server.ResolveDependency<IGameTiming>();
|
||||
MapId mapId;
|
||||
GridId gridId = default;
|
||||
EntityUid gridId = default;
|
||||
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
@@ -133,7 +133,7 @@ public sealed class FluidSpill : ContentIntegrationTest
|
||||
}
|
||||
}
|
||||
|
||||
gridId = grid.Index;
|
||||
gridId = grid.GridEntityId;
|
||||
});
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
|
||||
@@ -92,8 +92,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
|
||||
MapId sMapId = default;
|
||||
IMapGrid sGrid;
|
||||
GridId sGridId = default;
|
||||
EntityUid sGridEntity = default;
|
||||
EntityUid sGridId = default;
|
||||
EntityCoordinates sCoordinates = default;
|
||||
|
||||
// Spawn a paused map with one tile to spawn puddles on
|
||||
@@ -102,9 +101,8 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
sMapId = sMapManager.CreateMap();
|
||||
sMapManager.SetMapPaused(sMapId, true);
|
||||
sGrid = sMapManager.CreateGrid(sMapId);
|
||||
sGridId = sGrid.Index;
|
||||
sGridEntity = sGrid.GridEntityId;
|
||||
entityManager.GetComponent<MetaDataComponent>(sGridEntity).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1444
|
||||
sGridId = sGrid.GridEntityId;
|
||||
entityManager.GetComponent<MetaDataComponent>(sGridId).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1444
|
||||
|
||||
var tileDefinition = sTileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
|
||||
@@ -25,8 +25,9 @@ namespace Content.IntegrationTests.Tests
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
server.Post(() =>
|
||||
{
|
||||
// TODO: Un-hardcode the grid Id for this test.
|
||||
mapLoader.SaveBlueprint(new GridId(1), "save load save 1.yml");
|
||||
// TODO: Properly find the "main" station grid.
|
||||
var grid0 = mapManager.GetAllGrids().First();
|
||||
mapLoader.SaveBlueprint(grid0.GridEntityId, "save load save 1.yml");
|
||||
var mapId = mapManager.CreateMap();
|
||||
var grid = mapLoader.LoadBlueprint(mapId, "save load save 1.yml").gridId;
|
||||
mapLoader.SaveBlueprint(grid!.Value, "save load save 2.yml");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -25,8 +25,8 @@ namespace Content.MapRenderer.Painters
|
||||
private readonly IEntityManager _sEntityManager;
|
||||
private readonly IMapManager _sMapManager;
|
||||
|
||||
private readonly ConcurrentDictionary<GridId, List<EntityData>> _entities;
|
||||
private readonly Dictionary<GridId, List<DecalData>> _decals;
|
||||
private readonly ConcurrentDictionary<EntityUid, List<EntityData>> _entities;
|
||||
private readonly Dictionary<EntityUid, List<DecalData>> _decals;
|
||||
|
||||
public GridPainter(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
||||
{
|
||||
@@ -48,27 +48,27 @@ namespace Content.MapRenderer.Painters
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
if (!_entities.TryGetValue(grid.Index, out var entities))
|
||||
if (!_entities.TryGetValue(grid.GridEntityId, out var entities))
|
||||
{
|
||||
Console.WriteLine($"No entities found on grid {grid.Index}");
|
||||
Console.WriteLine($"No entities found on grid {grid.GridEntityId}");
|
||||
return;
|
||||
}
|
||||
|
||||
// Decals are always painted before entities, and are also optional.
|
||||
if (_decals.TryGetValue(grid.Index, out var decals))
|
||||
if (_decals.TryGetValue(grid.GridEntityId, out var decals))
|
||||
_decalPainter.Run(gridCanvas, decals);
|
||||
|
||||
|
||||
_entityPainter.Run(gridCanvas, entities);
|
||||
Console.WriteLine($"{nameof(GridPainter)} painted grid {grid.Index} in {(int) stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||
Console.WriteLine($"{nameof(GridPainter)} painted grid {grid.GridEntityId} in {(int) stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||
}
|
||||
|
||||
private ConcurrentDictionary<GridId, List<EntityData>> GetEntities()
|
||||
private ConcurrentDictionary<EntityUid, List<EntityData>> GetEntities()
|
||||
{
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
var components = new ConcurrentDictionary<GridId, List<EntityData>>();
|
||||
var components = new ConcurrentDictionary<EntityUid, List<EntityData>>();
|
||||
|
||||
foreach (var entity in _sEntityManager.GetEntities())
|
||||
{
|
||||
@@ -90,14 +90,14 @@ namespace Content.MapRenderer.Painters
|
||||
}
|
||||
|
||||
var transform = _sEntityManager.GetComponent<TransformComponent>(entity);
|
||||
if (_cMapManager.TryGetGrid(transform.GridID, out var grid))
|
||||
if (_cMapManager.TryGetGrid(transform.GridEntityId, out var grid))
|
||||
{
|
||||
var position = transform.LocalPosition;
|
||||
|
||||
var (x, y) = TransformLocalPosition(position, grid);
|
||||
var data = new EntityData(sprite, x, y);
|
||||
|
||||
components.GetOrAdd(transform.GridID, _ => new List<EntityData>()).Add(data);
|
||||
components.GetOrAdd(transform.GridEntityId, _ => new List<EntityData>()).Add(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,12 +106,12 @@ namespace Content.MapRenderer.Painters
|
||||
return components;
|
||||
}
|
||||
|
||||
private Dictionary<GridId, List<DecalData>> GetDecals()
|
||||
private Dictionary<EntityUid, List<DecalData>> GetDecals()
|
||||
{
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
var decals = new Dictionary<GridId, List<DecalData>>();
|
||||
var decals = new Dictionary<EntityUid, List<DecalData>>();
|
||||
|
||||
foreach (var grid in _sMapManager.GetAllGrids())
|
||||
{
|
||||
@@ -126,7 +126,7 @@ namespace Content.MapRenderer.Painters
|
||||
foreach (var (_, decal) in list)
|
||||
{
|
||||
var (x, y) = TransformLocalPosition(decal.Coordinates, grid);
|
||||
decals.GetOrNew(grid.Index).Add(new DecalData(decal, x, y));
|
||||
decals.GetOrNew(grid.GridEntityId).Add(new DecalData(decal, x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -51,7 +51,7 @@ namespace Content.MapRenderer.Painters
|
||||
i++;
|
||||
});
|
||||
|
||||
Console.WriteLine($"{nameof(TilePainter)} painted {i} tiles on grid {grid.Index} in {(int) stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||
Console.WriteLine($"{nameof(TilePainter)} painted {i} tiles on grid {grid.GridEntityId} in {(int) stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||
}
|
||||
|
||||
private Dictionary<string, List<Image>> GetTileImages(
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
{
|
||||
var targetTransform = _entMan.GetComponent<TransformComponent>(_useTarget);
|
||||
|
||||
if (targetTransform.GridID != _entMan.GetComponent<TransformComponent>(_owner).GridID)
|
||||
if (targetTransform.GridEntityId != _entMan.GetComponent<TransformComponent>(_owner).GridEntityId)
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
/// Regions are groups of nodes with the same profile (for pathfinding purposes)
|
||||
/// i.e. same collision, not-space, same access, etc.
|
||||
/// </summary>
|
||||
private readonly Dictionary<GridId, Dictionary<PathfindingChunk, HashSet<PathfindingRegion>>> _regions =
|
||||
private readonly Dictionary<EntityUid, Dictionary<PathfindingChunk, HashSet<PathfindingRegion>>> _regions =
|
||||
new();
|
||||
|
||||
/// <summary>
|
||||
@@ -168,10 +168,10 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
{
|
||||
var xform = EntityManager.GetComponent<TransformComponent>(target);
|
||||
// TODO: Handle this gracefully instead of just failing.
|
||||
if (!xform.GridID.IsValid())
|
||||
if (!xform.GridEntityId.IsValid())
|
||||
return false;
|
||||
|
||||
var targetTile = _mapManager.GetGrid(xform.GridID).GetTileRef(xform.Coordinates);
|
||||
var targetTile = _mapManager.GetGrid(xform.GridEntityId).GetTileRef(xform.Coordinates);
|
||||
var targetNode = _pathfindingSystem.GetNode(targetTile);
|
||||
|
||||
var collisionMask = 0;
|
||||
@@ -206,10 +206,10 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
{
|
||||
var xform = EntityManager.GetComponent<TransformComponent>(entity);
|
||||
|
||||
if (xform.GridID != targetNode.TileRef.GridIndex)
|
||||
if (xform.GridEntityId != targetNode.TileRef.GridUid)
|
||||
return false;
|
||||
|
||||
var entityTile = _mapManager.GetGrid(xform.GridID).GetTileRef(xform.Coordinates);
|
||||
var entityTile = _mapManager.GetGrid(xform.GridEntityId).GetTileRef(xform.Coordinates);
|
||||
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
||||
var entityRegion = GetRegion(entityNode);
|
||||
var targetRegion = GetRegion(targetNode);
|
||||
@@ -421,12 +421,12 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
{
|
||||
var xform = EntityManager.GetComponent<TransformComponent>(entity);
|
||||
|
||||
if (!xform.GridID.IsValid())
|
||||
if (!xform.GridEntityId.IsValid())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var entityTile = _mapManager.GetGrid(xform.GridID).GetTileRef(xform.Coordinates);
|
||||
var entityTile = _mapManager.GetGrid(xform.GridEntityId).GetTileRef(xform.Coordinates);
|
||||
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
||||
return GetRegion(entityNode);
|
||||
}
|
||||
@@ -709,7 +709,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
private void SendRegionsDebugMessage(GridId gridId)
|
||||
private void SendRegionsDebugMessage(EntityUid gridId)
|
||||
{
|
||||
if (_subscribedSessions.Count == 0) return;
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
@@ -757,7 +757,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
||||
/// <param name="gridId"></param>
|
||||
/// <param name="regions"></param>
|
||||
/// <param name="cached"></param>
|
||||
private void SendRegionCacheMessage(GridId gridId, IEnumerable<PathfindingRegion> regions, bool cached)
|
||||
private void SendRegionCacheMessage(EntityUid gridId, IEnumerable<PathfindingRegion> regions, bool cached)
|
||||
{
|
||||
if (_subscribedSessions.Count == 0) return;
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace Content.Server.AI.Pathfinding
|
||||
cameFrom.Remove(previousCurrent);
|
||||
var pathfindingSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<PathfindingSystem>();
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var grid = mapManager.GetGrid(current.TileRef.GridIndex);
|
||||
var grid = mapManager.GetGrid(current.TileRef.GridUid);
|
||||
|
||||
// Get all the intermediate nodes
|
||||
while (true)
|
||||
|
||||
@@ -97,7 +97,7 @@ public sealed partial class PathfindingSystem
|
||||
private PathfindingChunk CreateChunk(GridPathfindingComponent comp, Vector2i indices)
|
||||
{
|
||||
var grid = _mapManager.GetGrid(comp.Owner);
|
||||
var newChunk = new PathfindingChunk(grid.Index, indices);
|
||||
var newChunk = new PathfindingChunk(grid.GridEntityId, indices);
|
||||
comp.Graph.Add(indices, newChunk);
|
||||
newChunk.Initialize(grid);
|
||||
|
||||
@@ -121,7 +121,7 @@ public sealed partial class PathfindingSystem
|
||||
|
||||
private void OnTileUpdate(TileRef tile)
|
||||
{
|
||||
if (!_mapManager.GridExists(tile.GridIndex)) return;
|
||||
if (!_mapManager.GridExists(tile.GridUid)) return;
|
||||
|
||||
var node = GetNode(tile);
|
||||
node.UpdateTile(tile);
|
||||
@@ -129,7 +129,7 @@ public sealed partial class PathfindingSystem
|
||||
|
||||
private bool IsRelevant(TransformComponent xform, PhysicsComponent physics)
|
||||
{
|
||||
return xform.GridID != GridId.Invalid && (TrackedCollisionLayers & physics.CollisionLayer) != 0;
|
||||
return xform.GridEntityId != EntityUid.Invalid && (TrackedCollisionLayers & physics.CollisionLayer) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -143,7 +143,7 @@ public sealed partial class PathfindingSystem
|
||||
!Resolve(entity, ref physics, false)) return;
|
||||
|
||||
if (!IsRelevant(xform, physics) ||
|
||||
!_mapManager.TryGetGrid(xform.GridID, out var grid))
|
||||
!_mapManager.TryGetGrid(xform.GridEntityId, out var grid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public sealed partial class PathfindingSystem
|
||||
private void OnEntityRemove(EntityUid entity, TransformComponent? xform = null)
|
||||
{
|
||||
if (!Resolve(entity, ref xform, false) ||
|
||||
!_mapManager.TryGetGrid(xform.GridID, out var grid)) return;
|
||||
!_mapManager.TryGetGrid(xform.GridEntityId, out var grid)) return;
|
||||
|
||||
var node = GetNode(grid.GetTileRef(xform.Coordinates));
|
||||
node.RemoveEntity(entity);
|
||||
@@ -166,7 +166,7 @@ public sealed partial class PathfindingSystem
|
||||
|
||||
private void OnEntityRemove(EntityUid entity, EntityCoordinates coordinates)
|
||||
{
|
||||
var gridId = coordinates.GetGridId(EntityManager);
|
||||
var gridId = coordinates.GetGridEntityId(EntityManager);
|
||||
if (!_mapManager.TryGetGrid(gridId, out var grid)) return;
|
||||
|
||||
var node = GetNode(grid.GetTileRef(coordinates));
|
||||
@@ -175,13 +175,13 @@ public sealed partial class PathfindingSystem
|
||||
|
||||
private PathfindingNode? GetNode(TransformComponent xform)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(xform.GridID, out var grid)) return null;
|
||||
if (!_mapManager.TryGetGrid(xform.GridEntityId, out var grid)) return null;
|
||||
return GetNode(grid.GetTileRef(xform.Coordinates));
|
||||
}
|
||||
|
||||
private PathfindingNode? GetNode(EntityCoordinates coordinates)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(coordinates.GetGridId(EntityManager), out var grid)) return null;
|
||||
if (!_mapManager.TryGetGrid(coordinates.GetGridEntityId(EntityManager), out var grid)) return null;
|
||||
return GetNode(grid.GetTileRef(coordinates));
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public sealed partial class PathfindingSystem
|
||||
// Also look at increasing tile cost the more physics entities are on it
|
||||
public bool CanTraverse(EntityUid entity, EntityCoordinates coordinates)
|
||||
{
|
||||
var gridId = coordinates.GetGridId(EntityManager);
|
||||
var gridId = coordinates.GetGridEntityId(EntityManager);
|
||||
var tile = _mapManager.GetGrid(gridId).GetTileRef(coordinates);
|
||||
var node = GetNode(tile);
|
||||
return CanTraverse(entity, node);
|
||||
|
||||
@@ -29,16 +29,16 @@ namespace Content.Server.AI.Pathfinding
|
||||
var route = new List<Vector2>();
|
||||
foreach (var tile in routeDebug.Route)
|
||||
{
|
||||
var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices);
|
||||
var tileGrid = mapManager.GetGrid(tile.GridUid).GridTileToLocal(tile.GridIndices);
|
||||
route.Add(tileGrid.ToMapPos(EntityManager));
|
||||
}
|
||||
|
||||
var cameFrom = new Dictionary<Vector2, Vector2>();
|
||||
foreach (var (from, to) in routeDebug.CameFrom)
|
||||
{
|
||||
var tileOneGrid = mapManager.GetGrid(from.GridIndex).GridTileToLocal(from.GridIndices);
|
||||
var tileOneGrid = mapManager.GetGrid(from.GridUid).GridTileToLocal(from.GridIndices);
|
||||
var tileOneWorld = tileOneGrid.ToMapPos(EntityManager);
|
||||
var tileTwoGrid = mapManager.GetGrid(to.GridIndex).GridTileToLocal(to.GridIndices);
|
||||
var tileTwoGrid = mapManager.GetGrid(to.GridUid).GridTileToLocal(to.GridIndices);
|
||||
var tileTwoWorld = tileTwoGrid.ToMapPos(EntityManager);
|
||||
cameFrom[tileOneWorld] = tileTwoWorld;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace Content.Server.AI.Pathfinding
|
||||
var gScores = new Dictionary<Vector2, float>();
|
||||
foreach (var (tile, score) in routeDebug.GScores)
|
||||
{
|
||||
var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices);
|
||||
var tileGrid = mapManager.GetGrid(tile.GridUid).GridTileToLocal(tile.GridIndices);
|
||||
gScores[tileGrid.ToMapPos(EntityManager)] = score;
|
||||
}
|
||||
|
||||
@@ -67,14 +67,14 @@ namespace Content.Server.AI.Pathfinding
|
||||
var route = new List<Vector2>();
|
||||
foreach (var tile in routeDebug.Route)
|
||||
{
|
||||
var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices);
|
||||
var tileGrid = mapManager.GetGrid(tile.GridUid).GridTileToLocal(tile.GridIndices);
|
||||
route.Add(tileGrid.ToMapPos(EntityManager));
|
||||
}
|
||||
|
||||
var jumpNodes = new List<Vector2>();
|
||||
foreach (var tile in routeDebug.JumpNodes)
|
||||
{
|
||||
var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices);
|
||||
var tileGrid = mapManager.GetGrid(tile.GridUid).GridTileToLocal(tile.GridIndices);
|
||||
jumpNodes.Add(tileGrid.ToMapPos(EntityManager));
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace Content.Server.AI.Steering
|
||||
if (Deleted(entity) ||
|
||||
!EntityManager.TryGetComponent(entity, out AiControllerComponent? controller) ||
|
||||
!controller.CanMove ||
|
||||
!EntityManager.GetComponent<TransformComponent>(entity).GridID.IsValid())
|
||||
!EntityManager.GetComponent<TransformComponent>(entity).GridEntityId.IsValid())
|
||||
{
|
||||
return SteeringStatus.NoPath;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ namespace Content.Server.AI.Steering
|
||||
return SteeringStatus.NoPath;
|
||||
}
|
||||
|
||||
if (_mapManager.IsGridPaused(EntityManager.GetComponent<TransformComponent>(entity).GridID))
|
||||
if (_mapManager.IsGridPaused(EntityManager.GetComponent<TransformComponent>(entity).GridEntityId))
|
||||
{
|
||||
controller.VelocityDir = Vector2.Zero;
|
||||
return SteeringStatus.Pending;
|
||||
@@ -263,7 +263,7 @@ namespace Content.Server.AI.Steering
|
||||
|
||||
// Validation
|
||||
// Check if we can even arrive -> Currently only samegrid movement supported
|
||||
if (EntityManager.GetComponent<TransformComponent>(entity).GridID != steeringRequest.TargetGrid.GetGridId(EntityManager))
|
||||
if (EntityManager.GetComponent<TransformComponent>(entity).GridEntityId != steeringRequest.TargetGrid.GetGridEntityId(EntityManager))
|
||||
{
|
||||
controller.VelocityDir = Vector2.Zero;
|
||||
return SteeringStatus.NoPath;
|
||||
@@ -408,7 +408,7 @@ namespace Content.Server.AI.Steering
|
||||
}
|
||||
|
||||
var cancelToken = new CancellationTokenSource();
|
||||
var gridManager = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridID);
|
||||
var gridManager = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridEntityId);
|
||||
var startTile = gridManager.GetTileRef(EntityManager.GetComponent<TransformComponent>(entity).Coordinates);
|
||||
var endTile = gridManager.GetTileRef(steeringRequest.TargetGrid);
|
||||
var collisionMask = 0;
|
||||
@@ -439,7 +439,7 @@ namespace Content.Server.AI.Steering
|
||||
{
|
||||
_pathfindingRequests.Remove(entity);
|
||||
|
||||
var entityTile = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridID).GetTileRef(EntityManager.GetComponent<TransformComponent>(entity).Coordinates);
|
||||
var entityTile = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridEntityId).GetTileRef(EntityManager.GetComponent<TransformComponent>(entity).Coordinates);
|
||||
var tile = path.Dequeue();
|
||||
var closestDistance = PathfindingHelpers.OctileDistance(entityTile, tile);
|
||||
|
||||
@@ -508,7 +508,7 @@ namespace Content.Server.AI.Steering
|
||||
{
|
||||
if (_paths[entity].Count == 0) return;
|
||||
var nextTile = dequeue ? _paths[entity].Dequeue() : _paths[entity].Peek();
|
||||
var nextGrid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridID).GridTileToLocal(nextTile.GridIndices);
|
||||
var nextGrid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridEntityId).GridTileToLocal(nextTile.GridIndices);
|
||||
_nextGrid[entity] = nextGrid;
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ namespace Content.Server.AI.Steering
|
||||
var checkTiles = new HashSet<TileRef>();
|
||||
var avoidTiles = new HashSet<TileRef>();
|
||||
var entityGridCoords = EntityManager.GetComponent<TransformComponent>(entity).Coordinates;
|
||||
var grid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridID);
|
||||
var grid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridEntityId);
|
||||
var currentTile = grid.GetTileRef(entityGridCoords);
|
||||
var halfwayTile = grid.GetTileRef(entityGridCoords.Offset(direction / 2));
|
||||
var nextTile = grid.GetTileRef(entityGridCoords.Offset(direction));
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.Server.AI.Utility.Actions.Idle
|
||||
|
||||
var targetNode = robustRandom.Pick(reachableNodes);
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var grid = mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridID);
|
||||
var grid = mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridEntityId);
|
||||
var targetGrid = grid.GridTileToLocal(targetNode.TileRef.GridIndices);
|
||||
|
||||
return targetGrid;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Server.AI.Utility.Considerations.Movement
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (context.GetState<TargetEntityState>().GetValue() is not {Valid: true} target || entities.Deleted(target) ||
|
||||
entities.GetComponent<TransformComponent>(target).GridID != entities.GetComponent<TransformComponent>(self).GridID)
|
||||
entities.GetComponent<TransformComponent>(target).GridEntityId != entities.GetComponent<TransformComponent>(self).GridEntityId)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Server.AI.Utils
|
||||
{
|
||||
var transform = entityManager.GetComponent<TransformComponent>(entity);
|
||||
|
||||
if (transform.Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager))
|
||||
if (transform.Coordinates.GetGridEntityId(entityManager) != grid.GetGridEntityId(entityManager))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Server.AME.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Hands.Components;
|
||||
@@ -90,7 +90,7 @@ namespace Content.Server.AME
|
||||
if (!_toolSystem.HasQuality(args.Used, component.QualityNeeded))
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridId(EntityManager), out var mapGrid))
|
||||
if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridEntityId(EntityManager), out var mapGrid))
|
||||
return; // No AME in space.
|
||||
|
||||
var snapPos = mapGrid.TileIndicesFor(args.ClickLocation);
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Content.Server.Administration.Commands;
|
||||
[AdminCommand(AdminFlags.Mapping)]
|
||||
public sealed class VariantizeCommand : IConsoleCommand
|
||||
{
|
||||
|
||||
public string Command => "variantize";
|
||||
|
||||
public string Description => Loc.GetString("variantize-command-description");
|
||||
@@ -24,26 +23,26 @@ public sealed class VariantizeCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
|
||||
if (!int.TryParse(args[0], out var targetId))
|
||||
if (EntityUid.TryParse(args[0], out var euid))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-argument-must-be-number"));
|
||||
shell.WriteError($"Failed to parse euid '{args[0]}'.");
|
||||
return;
|
||||
}
|
||||
|
||||
var gridId = new GridId(targetId);
|
||||
if (!mapManager.TryGetGrid(gridId, out var grid))
|
||||
if (!entMan.TryGetComponent(euid, out IMapGridComponent? gridComp))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-invalid-grid-id"));
|
||||
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
|
||||
return;
|
||||
}
|
||||
foreach (var tile in grid.GetAllTiles())
|
||||
|
||||
foreach (var tile in gridComp.Grid.GetAllTiles())
|
||||
{
|
||||
var def = tile.GetContentTileDefinition();
|
||||
var newTile = new Tile(tile.Tile.TypeId, tile.Tile.Flags, random.Pick(def.PlacementVariants));
|
||||
grid.SetTile(tile.GridIndices, newTile);
|
||||
gridComp.Grid.SetTile(tile.GridIndices, newTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var currentMap = entMan.GetComponent<TransformComponent>(playerEntity).MapID;
|
||||
var currentGrid = entMan.GetComponent<TransformComponent>(playerEntity).GridID;
|
||||
var currentGrid = entMan.GetComponent<TransformComponent>(playerEntity).GridEntityId;
|
||||
|
||||
var found = entMan.EntityQuery<WarpPointComponent>(true)
|
||||
.Where(p => p.Location == location)
|
||||
@@ -62,8 +62,8 @@ namespace Content.Server.Administration.Commands
|
||||
// Sort so that warp points on the same grid/map are first.
|
||||
// So if you have two maps loaded with the same warp points,
|
||||
// it will prefer the warp points on the map you're currently on.
|
||||
var aGrid = a.GetGridId(entMan);
|
||||
var bGrid = b.GetGridId(entMan);
|
||||
var aGrid = a.GetGridEntityId(entMan);
|
||||
var bGrid = b.GetGridEntityId(entMan);
|
||||
|
||||
if (aGrid == bGrid)
|
||||
{
|
||||
@@ -80,8 +80,8 @@ namespace Content.Server.Administration.Commands
|
||||
return 1;
|
||||
}
|
||||
|
||||
var mapA = mapManager.GetGrid(aGrid).ParentMapId;
|
||||
var mapB = mapManager.GetGrid(bGrid).ParentMapId;
|
||||
var mapA = a.GetMapId(entMan);
|
||||
var mapB = a.GetMapId(entMan);
|
||||
|
||||
if (mapA == mapB)
|
||||
{
|
||||
@@ -102,7 +102,8 @@ namespace Content.Server.Administration.Commands
|
||||
}))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (found.GetGridId(entMan) != GridId.Invalid)
|
||||
var entityUid = found.GetGridEntityId(entMan);
|
||||
if (entityUid != EntityUid.Invalid)
|
||||
{
|
||||
entMan.GetComponent<TransformComponent>(playerEntity).Coordinates = found;
|
||||
if (entMan.TryGetComponent(playerEntity, out IPhysBody? physics))
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
@@ -23,37 +22,29 @@ namespace Content.Server.Atmos.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if(EntityUid.TryParse(args[0], out var euid))
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
shell.WriteError($"Failed to parse euid '{args[0]}'.");
|
||||
return;
|
||||
}
|
||||
|
||||
var gridId = new GridId(id);
|
||||
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
if (!entMan.HasComponent<IMapGridComponent>(euid))
|
||||
{
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_entities.EntityExists(gridComp.GridEntityId))
|
||||
{
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_entities.HasComponent<IAtmosphereComponent>(gridComp.GridEntityId))
|
||||
if (_entities.HasComponent<IAtmosphereComponent>(euid))
|
||||
{
|
||||
shell.WriteLine("Grid already has an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
_entities.AddComponent<GridAtmosphereComponent>(gridComp.GridEntityId);
|
||||
_entities.AddComponent<GridAtmosphereComponent>(euid);
|
||||
|
||||
shell.WriteLine($"Added atmosphere to grid {id}.");
|
||||
shell.WriteLine($"Added atmosphere to grid {euid}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -12,22 +12,28 @@ namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
public string Command => "addgas";
|
||||
public string Description => "Adds gas at a certain position.";
|
||||
public string Help => "addgas <X> <Y> <GridId> <Gas> <moles>";
|
||||
public string Help => "addgas <X> <Y> <GridEid> <Gas> <moles>";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 5) return;
|
||||
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
|| !int.TryParse(args[1], out var y)
|
||||
|| !int.TryParse(args[2], out var id)
|
||||
|| !EntityUid.TryParse(args[2], out var euid)
|
||||
|| !(AtmosCommandUtils.TryParseGasID(args[3], out var gasId))
|
||||
|| !float.TryParse(args[4], out var moles)) return;
|
||||
|
||||
var gridId = new GridId(id);
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entMan.HasComponent<IMapGridComponent>(euid))
|
||||
{
|
||||
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
|
||||
return;
|
||||
}
|
||||
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
var indices = new Vector2i(x, y);
|
||||
var tile = atmosphereSystem.GetTileMixture(gridId, indices, true);
|
||||
var tile = atmosphereSystem.GetTileMixture(euid, indices, true);
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
@@ -21,39 +20,29 @@ namespace Content.Server.Atmos.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
var gridId = new GridId(id);
|
||||
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entMan.EntityExists(gridComp.GridEntityId))
|
||||
if (EntityUid.TryParse(args[0], out var euid))
|
||||
{
|
||||
shell.WriteLine("Failed to get grid entity.");
|
||||
shell.WriteError($"Failed to parse euid '{args[0]}'.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (entMan.HasComponent<IAtmosphereComponent>(gridComp.GridEntityId))
|
||||
if (!entMan.HasComponent<IMapGridComponent>(euid))
|
||||
{
|
||||
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (entMan.HasComponent<IAtmosphereComponent>(euid))
|
||||
{
|
||||
shell.WriteLine("Grid already has an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
entMan.AddComponent<UnsimulatedGridAtmosphereComponent>(gridComp.GridEntityId);
|
||||
entMan.AddComponent<UnsimulatedGridAtmosphereComponent>(euid);
|
||||
|
||||
shell.WriteLine($"Added unsimulated atmosphere to grid {id}.");
|
||||
shell.WriteLine($"Added unsimulated atmosphere to grid {euid}.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Server.Atmos.Commands
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
GridId gridId;
|
||||
EntityUid gridId;
|
||||
Gas? gas = null;
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
@@ -39,9 +39,9 @@ namespace Content.Server.Atmos.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = entMan.GetComponent<TransformComponent>(playerEntity).GridID;
|
||||
gridId = entMan.GetComponent<TransformComponent>(playerEntity).GridEntityId;
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
if (gridId == EntityUid.Invalid)
|
||||
{
|
||||
shell.WriteLine("You aren't on a grid to delete gas from.");
|
||||
return;
|
||||
@@ -51,7 +51,7 @@ namespace Content.Server.Atmos.Commands
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (!int.TryParse(args[0], out var number))
|
||||
if (!EntityUid.TryParse(args[0], out var number))
|
||||
{
|
||||
// Argument is a gas
|
||||
if (player == null)
|
||||
@@ -66,9 +66,9 @@ namespace Content.Server.Atmos.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = entMan.GetComponent<TransformComponent>(playerEntity).GridID;
|
||||
gridId = entMan.GetComponent<TransformComponent>(playerEntity).GridEntityId;
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
if (gridId == EntityUid.Invalid)
|
||||
{
|
||||
shell.WriteLine("You aren't on a grid to delete gas from.");
|
||||
return;
|
||||
@@ -85,27 +85,20 @@ namespace Content.Server.Atmos.Commands
|
||||
}
|
||||
|
||||
// Argument is a grid
|
||||
gridId = new GridId(number);
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
{
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = number;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (!int.TryParse(args[0], out var first))
|
||||
if (!EntityUid.TryParse(args[0], out var first))
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid integer for a grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = new GridId(first);
|
||||
gridId = first;
|
||||
|
||||
if (gridId == GridId.Invalid)
|
||||
if (gridId == EntityUid.Invalid)
|
||||
{
|
||||
shell.WriteLine($"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -12,17 +12,15 @@ namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
public string Command => "fillgas";
|
||||
public string Description => "Adds gas to all tiles in a grid.";
|
||||
public string Help => "fillgas <GridId> <Gas> <moles>";
|
||||
public string Help => "fillgas <GridEid> <Gas> <moles>";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 3) return;
|
||||
if(!int.TryParse(args[0], out var id)
|
||||
if(!EntityUid.TryParse(args[0], out var gridId)
|
||||
|| !(AtmosCommandUtils.TryParseGasID(args[1], out var gasId))
|
||||
|| !float.TryParse(args[2], out var moles)) return;
|
||||
|
||||
var gridId = new GridId(id);
|
||||
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out _))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
@@ -18,15 +18,13 @@ namespace Content.Server.Atmos.Commands
|
||||
if (args.Length < 5) return;
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
|| !int.TryParse(args[1], out var y)
|
||||
|| !int.TryParse(args[2], out var id)
|
||||
|| !EntityUid.TryParse(args[2], out var id)
|
||||
|| !float.TryParse(args[3], out var amount)
|
||||
|| !bool.TryParse(args[4], out var ratio)) return;
|
||||
|
||||
var gridId = new GridId(id);
|
||||
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
var indices = new Vector2i(x, y);
|
||||
var tile = atmosphereSystem.GetTileMixture(gridId, indices, true);
|
||||
var tile = atmosphereSystem.GetTileMixture(id, indices, true);
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -17,11 +17,9 @@ namespace Content.Server.Atmos.Commands
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 2) return;
|
||||
if(!int.TryParse(args[0], out var id)
|
||||
if(!EntityUid.TryParse(args[0], out var gridId)
|
||||
|| !float.TryParse(args[1], out var temperature)) return;
|
||||
|
||||
var gridId = new GridId(id);
|
||||
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
if (temperature < Atmospherics.TCMB)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -19,11 +19,9 @@ namespace Content.Server.Atmos.Commands
|
||||
if (args.Length < 4) return;
|
||||
if(!int.TryParse(args[0], out var x)
|
||||
|| !int.TryParse(args[1], out var y)
|
||||
|| !int.TryParse(args[2], out var id)
|
||||
|| !EntityUid.TryParse(args[2], out var gridId)
|
||||
|| !float.TryParse(args[3], out var temperature)) return;
|
||||
|
||||
var gridId = new GridId(id);
|
||||
|
||||
if (temperature < Atmospherics.TCMB)
|
||||
{
|
||||
shell.WriteLine("Invalid temperature.");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Atmos.Components
|
||||
[RegisterComponent]
|
||||
public sealed class AirtightComponent : Component
|
||||
{
|
||||
public (GridId Grid, Vector2i Tile) LastPosition { get; set; }
|
||||
public (EntityUid Grid, Vector2i Tile) LastPosition { get; set; }
|
||||
|
||||
[DataField("airBlockedDirection", customTypeSerializer: typeof(FlagSerializer<AtmosDirectionFlags>))]
|
||||
[ViewVariables]
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
var xform = Transform(uid);
|
||||
|
||||
// If the grid is deleting no point updating atmos.
|
||||
if (_mapManager.TryGetGrid(xform.GridID, out var grid))
|
||||
if (_mapManager.TryGetGrid(xform.GridEntityId, out var grid))
|
||||
{
|
||||
if (MetaData(grid.GridEntityId).EntityLifeStage > EntityLifeStage.MapInitialized) return;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
|
||||
var gridId = xform.GridID;
|
||||
var gridId = xform.GridEntityId;
|
||||
var coords = xform.Coordinates;
|
||||
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
@@ -100,15 +100,15 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
if (!Resolve(airtight.Owner, ref xform)) return;
|
||||
|
||||
if (!xform.Anchored || !xform.GridID.IsValid())
|
||||
if (!xform.Anchored || !xform.GridEntityId.IsValid())
|
||||
return;
|
||||
|
||||
var grid = _mapManager.GetGrid(xform.GridID);
|
||||
airtight.LastPosition = (xform.GridID, grid.TileIndicesFor(xform.Coordinates));
|
||||
var grid = _mapManager.GetGrid(xform.GridEntityId);
|
||||
airtight.LastPosition = (xform.GridEntityId, grid.TileIndicesFor(xform.Coordinates));
|
||||
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked);
|
||||
}
|
||||
|
||||
public void InvalidatePosition(GridId gridId, Vector2i pos, bool fixVacuum = false)
|
||||
public void InvalidatePosition(EntityUid gridId, Vector2i pos, bool fixVacuum = false)
|
||||
{
|
||||
if (!gridId.IsValid())
|
||||
return;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
RaiseNetworkEvent(new AtmosDebugOverlayMessage(grid.Index, baseTile, debugOverlayContent), session.ConnectedClient);
|
||||
RaiseNetworkEvent(new AtmosDebugOverlayMessage(grid.GridEntityId, baseTile, debugOverlayContent), session.ConnectedClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,26 +57,25 @@ public sealed partial class AtmosphereSystem
|
||||
mixtures[5].AdjustMoles(Gas.Plasma, Atmospherics.MolesCellGasMiner);
|
||||
mixtures[5].Temperature = 5000f;
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
foreach (var gid in args)
|
||||
{
|
||||
// I like offering detailed error messages, that's why I don't use one of the extension methods.
|
||||
if (!int.TryParse(gid, out var i) || i <= 0)
|
||||
if(EntityUid.TryParse(gid, out var euid))
|
||||
{
|
||||
shell.WriteError($"Invalid grid ID \"{gid}\".");
|
||||
continue;
|
||||
shell.WriteError($"Failed to parse euid '{gid}'.");
|
||||
return;
|
||||
}
|
||||
|
||||
var gridId = new GridId(i);
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridId, out var mapGrid))
|
||||
if (!TryComp(euid, out IMapGridComponent? gridComp))
|
||||
{
|
||||
shell.WriteError($"Grid \"{i}\" doesn't exist.");
|
||||
continue;
|
||||
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryComp(mapGrid.GridEntityId, out GridAtmosphereComponent? gridAtmosphere))
|
||||
if (!TryComp(euid, out GridAtmosphereComponent? gridAtmosphere))
|
||||
{
|
||||
shell.WriteError($"Grid \"{i}\" has no atmosphere component, try addatmos.");
|
||||
shell.WriteError($"Grid \"{euid}\" has no atmosphere component, try addatmos.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -88,7 +87,7 @@ public sealed partial class AtmosphereSystem
|
||||
|
||||
tile.Clear();
|
||||
var mixtureId = 0;
|
||||
foreach (var entUid in mapGrid.GetAnchoredEntities(indices))
|
||||
foreach (var entUid in gridComp.Grid.GetAnchoredEntities(indices))
|
||||
{
|
||||
if (!TryComp(entUid, out AtmosFixMarkerComponent? afm))
|
||||
continue;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
try
|
||||
{
|
||||
gridAtmosphere.Tiles.Add(indices, new TileAtmosphere(mapGrid.GridIndex, indices, (GasMixture) gridAtmosphere.UniqueMixes![mix].Clone()));
|
||||
gridAtmosphere.Tiles.Add(indices, new TileAtmosphere(mapGrid.Owner, indices, (GasMixture) gridAtmosphere.UniqueMixes![mix].Clone()));
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
@@ -125,7 +125,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid to be checked.</param>
|
||||
/// <returns>Whether the grid has a simulated atmosphere.</returns>
|
||||
public bool IsSimulatedGrid(GridId grid)
|
||||
public bool IsSimulatedGrid(EntityUid grid)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return false;
|
||||
@@ -160,7 +160,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get all tile mixtures from.</param>
|
||||
/// <param name="invalidate">Whether to invalidate all tiles.</param>
|
||||
/// <returns>All tile mixtures in a grid.</returns>
|
||||
public IEnumerable<GasMixture> GetAllTileMixtures(GridId grid, bool invalidate = false)
|
||||
public IEnumerable<GasMixture> GetAllTileMixtures(EntityUid grid, bool invalidate = false)
|
||||
{
|
||||
// Return an array with a single space gas mixture for invalid grids.
|
||||
if (!grid.IsValid())
|
||||
@@ -207,7 +207,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">The grid in question.</param>
|
||||
/// <param name="tiles">The amount of tiles.</param>
|
||||
/// <returns>The volume in liters that the tiles occupy.</returns>
|
||||
public float GetVolumeForTiles(GridId grid, int tiles = 1)
|
||||
public float GetVolumeForTiles(EntityUid grid, int tiles = 1)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return Atmospherics.CellVolume * tiles;
|
||||
@@ -289,7 +289,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
foreach (var tile in mapGrid.GetAllTiles())
|
||||
{
|
||||
if(!gridAtmosphere.Tiles.ContainsKey(tile.GridIndices))
|
||||
gridAtmosphere.Tiles[tile.GridIndices] = new TileAtmosphere(tile.GridIndex, tile.GridIndices, new GasMixture(volume){Temperature = Atmospherics.T20C});
|
||||
gridAtmosphere.Tiles[tile.GridIndices] = new TileAtmosphere(tile.GridUid, tile.GridIndices, new GasMixture(volume){Temperature = Atmospherics.T20C});
|
||||
|
||||
InvalidateTile(gridAtmosphere, tile.GridIndices);
|
||||
}
|
||||
@@ -297,7 +297,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
foreach (var (position, tile) in gridAtmosphere.Tiles.ToArray())
|
||||
{
|
||||
UpdateAdjacent(mapGrid, gridAtmosphere, tile);
|
||||
InvalidateVisuals(mapGrid.Index, position);
|
||||
InvalidateVisuals(mapGrid.GridEntityId, position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to invalidate the tile.</param>
|
||||
/// <param name="tile">The indices of the tile.</param>
|
||||
public void InvalidateTile(GridId grid, Vector2i tile)
|
||||
public void InvalidateTile(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -371,7 +371,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void InvalidateVisuals(GridId grid, Vector2i tile)
|
||||
public void InvalidateVisuals(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
_gasTileOverlaySystem.Invalidate(grid, tile);
|
||||
}
|
||||
@@ -401,7 +401,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <remarks>Do NOT use this outside of atmos internals.</remarks>
|
||||
/// <returns>The Tile Atmosphere in the position, or null.</returns>
|
||||
public TileAtmosphere? GetTileAtmosphere(GridId grid, Vector2i tile)
|
||||
public TileAtmosphere? GetTileAtmosphere(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return null;
|
||||
@@ -450,7 +450,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <remarks>Do NOT use this outside of atmos internals.</remarks>
|
||||
/// <returns>The tile atmosphere of a specific position in a grid, a space tile atmosphere if the tile is space or null if the grid doesn't exist.</returns>
|
||||
public TileAtmosphere? GetTileAtmosphereOrCreateSpace(GridId grid, Vector2i tile)
|
||||
public TileAtmosphere? GetTileAtmosphereOrCreateSpace(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return null;
|
||||
@@ -480,7 +480,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
// attempts to get the tile atmosphere for it before it has been revalidated by atmos.
|
||||
// The tile atmosphere will get revalidated on the next atmos tick, however.
|
||||
|
||||
return tileAtmosphere ?? new TileAtmosphere(mapGrid.Index, tile, new GasMixture(Atmospherics.CellVolume) {Temperature = Atmospherics.TCMB}, true);
|
||||
return tileAtmosphere ?? new TileAtmosphere(mapGrid.GridEntityId, tile, new GasMixture(Atmospherics.CellVolume) {Temperature = Atmospherics.TCMB}, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -502,7 +502,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile to be activated.</param>
|
||||
public void AddActiveTile(GridId grid, Vector2i tile)
|
||||
public void AddActiveTile(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -563,7 +563,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile to be deactivated.</param>
|
||||
/// <param name="disposeExcitedGroup">Whether to dispose of the tile's <see cref="ExcitedGroup"/></param>
|
||||
public void RemoveActiveTile(GridId grid, Vector2i tile, bool disposeExcitedGroup = true)
|
||||
public void RemoveActiveTile(EntityUid grid, Vector2i tile, bool disposeExcitedGroup = true)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -632,7 +632,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <param name="invalidate">Whether to invalidate the tile.</param>
|
||||
/// <returns>The tile mixture, or null</returns>
|
||||
public GasMixture? GetTileMixture(GridId grid, Vector2i tile, bool invalidate = false)
|
||||
public GasMixture? GetTileMixture(EntityUid grid, Vector2i tile, bool invalidate = false)
|
||||
{
|
||||
// Always return space gas mixtures for invalid grids (grid 0)
|
||||
if (!grid.IsValid())
|
||||
@@ -699,7 +699,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <returns>Reaction results.</returns>
|
||||
public ReactionResult React(GridId grid, Vector2i tile)
|
||||
public ReactionResult React(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return ReactionResult.NoReaction;
|
||||
@@ -755,7 +755,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <param name="direction">Directions to check.</param>
|
||||
/// <returns>Whether the tile is blocked in the directions specified.</returns>
|
||||
public bool IsTileAirBlocked(GridId grid, Vector2i tile, AtmosDirection direction = AtmosDirection.All)
|
||||
public bool IsTileAirBlocked(EntityUid grid, Vector2i tile, AtmosDirection direction = AtmosDirection.All)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return false;
|
||||
@@ -816,7 +816,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to check the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <returns>Whether the tile is space or not.</returns>
|
||||
public bool IsTileSpace(GridId grid, Vector2i tile)
|
||||
public bool IsTileSpace(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
return !_mapManager.TryGetGrid(grid, out var mapGrid) || IsTileSpace(mapGrid, tile);
|
||||
}
|
||||
@@ -847,7 +847,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <summary>
|
||||
/// Get a tile's heat capacity, based on the tile type, tile contents and tile gas mixture.
|
||||
/// </summary>
|
||||
public float GetTileHeatCapacity(GridId grid, Vector2i tile)
|
||||
public float GetTileHeatCapacity(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
// Always return space gas mixtures for invalid grids (grid 0)
|
||||
if (!grid.IsValid())
|
||||
@@ -913,7 +913,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <param name="includeBlocked">Whether to include tiles in directions the tile is air-blocked in.</param>
|
||||
/// <returns>The positions adjacent to the tile.</returns>
|
||||
public IEnumerable<Vector2i> GetAdjacentTiles(GridId grid, Vector2i tile, bool includeBlocked = false)
|
||||
public IEnumerable<Vector2i> GetAdjacentTiles(EntityUid grid, Vector2i tile, bool includeBlocked = false)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return Enumerable.Empty<Vector2i>();
|
||||
@@ -986,7 +986,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="includeBlocked">Whether to include tiles in directions the tile is air-blocked in.</param>
|
||||
/// <param name="invalidate">Whether to invalidate all adjacent tiles.</param>
|
||||
/// <returns>All adjacent tile gas mixtures to the tile in question</returns>
|
||||
public IEnumerable<GasMixture> GetAdjacentTileMixtures(GridId grid, Vector2i tile, bool includeBlocked = false, bool invalidate = false)
|
||||
public IEnumerable<GasMixture> GetAdjacentTileMixtures(EntityUid grid, Vector2i tile, bool includeBlocked = false, bool invalidate = false)
|
||||
{
|
||||
// For invalid grids, return an array with a single space gas mixture in it.
|
||||
if (!grid.IsValid())
|
||||
@@ -1073,7 +1073,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
public void UpdateAdjacent(GridId grid, Vector2i tile)
|
||||
public void UpdateAdjacent(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1149,7 +1149,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <param name="direction">Direction to be updated.</param>
|
||||
public void UpdateAdjacent(GridId grid, Vector2i tile, AtmosDirection direction)
|
||||
public void UpdateAdjacent(EntityUid grid, Vector2i tile, AtmosDirection direction)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1227,7 +1227,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="exposedTemperature">Temperature to expose to the tile.</param>
|
||||
/// <param name="exposedVolume">Volume of the exposed temperature.</param>
|
||||
/// <param name="soh">If true, the existing hotspot values will be set to the exposed values, but only if they're smaller.</param>
|
||||
public void HotspotExpose(GridId grid, Vector2i tile, float exposedTemperature, float exposedVolume, bool soh = false)
|
||||
public void HotspotExpose(EntityUid grid, Vector2i tile, float exposedTemperature, float exposedVolume, bool soh = false)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1264,7 +1264,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
public void HotspotExtinguish(GridId grid, Vector2i tile)
|
||||
public void HotspotExtinguish(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1313,7 +1313,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile</param>
|
||||
/// <param name="tile">Indices for the tile</param>
|
||||
/// <returns>Whether the hotspot is active or not.</returns>
|
||||
public bool IsHotspotActive(GridId grid, Vector2i tile)
|
||||
public bool IsHotspotActive(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return false;
|
||||
@@ -1376,7 +1376,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
public bool AddAtmosDevice(AtmosDeviceComponent atmosDevice)
|
||||
{
|
||||
var grid = Comp<TransformComponent>(atmosDevice.Owner).GridID;
|
||||
var grid = Comp<TransformComponent>(atmosDevice.Owner).GridEntityId;
|
||||
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return false;
|
||||
@@ -1438,7 +1438,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
/// <returns>Whether the tile's gas mixture is probably safe.</returns>
|
||||
public bool IsTileMixtureProbablySafe(GridId grid, Vector2i tile)
|
||||
public bool IsTileMixtureProbablySafe(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
return IsMixtureProbablySafe(GetTileMixture(grid, tile));
|
||||
}
|
||||
@@ -1491,7 +1491,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// </summary>
|
||||
/// <param name="grid">Grid where to get the tile.</param>
|
||||
/// <param name="tile">Indices of the tile.</param>
|
||||
public void FixVacuum(GridId grid, Vector2i tile)
|
||||
public void FixVacuum(EntityUid grid, Vector2i tile)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||
return;
|
||||
@@ -1558,7 +1558,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return tile.GridIndices.GetTileRef(tile.GridIndex, _mapManager);
|
||||
}
|
||||
|
||||
public bool TryGetGridAndTile(MapCoordinates coordinates, [NotNullWhen(true)] out (GridId Grid, Vector2i Tile)? tuple)
|
||||
public bool TryGetGridAndTile(MapCoordinates coordinates, [NotNullWhen(true)] out (EntityUid Grid, Vector2i Tile)? tuple)
|
||||
{
|
||||
if (!_mapManager.TryFindGridAt(coordinates, out var grid))
|
||||
{
|
||||
@@ -1566,11 +1566,11 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
tuple = (grid.Index, grid.TileIndicesFor(coordinates));
|
||||
tuple = (grid.GridEntityId, grid.TileIndicesFor(coordinates));
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetGridAndTile(EntityCoordinates coordinates, [NotNullWhen(true)] out (GridId Grid, Vector2i Tile)? tuple)
|
||||
public bool TryGetGridAndTile(EntityCoordinates coordinates, [NotNullWhen(true)] out (EntityUid Grid, Vector2i Tile)? tuple)
|
||||
{
|
||||
if (!coordinates.IsValid(EntityManager))
|
||||
{
|
||||
@@ -1578,7 +1578,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
var gridId = coordinates.GetGridId(EntityManager);
|
||||
var gridId = coordinates.GetGridEntityId(EntityManager);
|
||||
|
||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
tile = new TileAtmosphere(mapGrid.Index, indices, new GasMixture(volume){Temperature = Atmospherics.T20C});
|
||||
tile = new TileAtmosphere(mapGrid.GridEntityId, indices, new GasMixture(volume){Temperature = Atmospherics.T20C});
|
||||
atmosphere.Tiles[indices] = tile;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
var tileDef = GetTile(tile)?.Tile.GetContentTileDefinition(_tileDefinitionManager);
|
||||
tile.ThermalConductivity = tileDef?.ThermalConductivity ?? 0.5f;
|
||||
tile.HeatCapacity = tileDef?.HeatCapacity ?? float.PositiveInfinity;
|
||||
InvalidateVisuals(mapGrid.Index, indices);
|
||||
InvalidateVisuals(mapGrid.GridEntityId, indices);
|
||||
|
||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
InvalidateTile(ev.NewTile.GridIndex, ev.NewTile.GridIndices);
|
||||
InvalidateTile(ev.NewTile.GridUid, ev.NewTile.GridIndices);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <summary>
|
||||
/// The tiles that have had their atmos data updated since last tick
|
||||
/// </summary>
|
||||
private readonly Dictionary<GridId, HashSet<Vector2i>> _invalidTiles = new();
|
||||
private readonly Dictionary<EntityUid, HashSet<Vector2i>> _invalidTiles = new();
|
||||
|
||||
private readonly Dictionary<IPlayerSession, PlayerGasOverlay> _knownPlayerChunks =
|
||||
new();
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
/// <summary>
|
||||
/// Gas data stored in chunks to make PVS / bubbling easier.
|
||||
/// </summary>
|
||||
private readonly Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>> _overlay =
|
||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, GasOverlayChunk>> _overlay =
|
||||
new();
|
||||
|
||||
/// <summary>
|
||||
@@ -77,7 +77,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Invalidate(GridId gridIndex, Vector2i indices)
|
||||
public void Invalidate(EntityUid gridIndex, Vector2i indices)
|
||||
{
|
||||
if (!_invalidTiles.TryGetValue(gridIndex, out var existing))
|
||||
{
|
||||
@@ -88,7 +88,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
existing.Add(indices);
|
||||
}
|
||||
|
||||
private GasOverlayChunk GetOrCreateChunk(GridId gridIndex, Vector2i indices)
|
||||
private GasOverlayChunk GetOrCreateChunk(EntityUid gridIndex, Vector2i indices)
|
||||
{
|
||||
if (!_overlay.TryGetValue(gridIndex, out var chunks))
|
||||
{
|
||||
@@ -204,7 +204,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(xform.MapID, worldBounds))
|
||||
{
|
||||
if (!_overlay.TryGetValue(grid.Index, out var chunks))
|
||||
if (!_overlay.TryGetValue(grid.GridEntityId, out var chunks))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
AccumulatedFrameTime -= _updateCooldown;
|
||||
|
||||
var gridAtmosComponents = new Dictionary<GridId, GridAtmosphereComponent>();
|
||||
var gridAtmosComponents = new Dictionary<EntityUid, GridAtmosphereComponent>();
|
||||
var updatedTiles = new Dictionary<GasOverlayChunk, HashSet<Vector2i>>();
|
||||
|
||||
// So up to this point we've been caching the updated tiles for multiple ticks.
|
||||
@@ -351,7 +351,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
overlay.RemoveChunk(chunk);
|
||||
}
|
||||
|
||||
var clientInvalids = new Dictionary<GridId, List<(Vector2i, GasOverlayData)>>();
|
||||
var clientInvalids = new Dictionary<EntityUid, List<(Vector2i, GasOverlayData)>>();
|
||||
|
||||
// Check for any dirty chunks in range and bundle the data to send to the client.
|
||||
foreach (var chunk in chunksInRange)
|
||||
@@ -378,13 +378,13 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
}
|
||||
private sealed class PlayerGasOverlay
|
||||
{
|
||||
private readonly Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>> _data =
|
||||
private readonly Dictionary<EntityUid, Dictionary<Vector2i, GasOverlayChunk>> _data =
|
||||
new();
|
||||
|
||||
private readonly Dictionary<GasOverlayChunk, GameTick> _lastSent =
|
||||
new();
|
||||
|
||||
public GasOverlayMessage UpdateClient(GridId grid, List<(Vector2i, GasOverlayData)> data)
|
||||
public GasOverlayMessage UpdateClient(EntityUid grid, List<(Vector2i, GasOverlayData)> data)
|
||||
{
|
||||
return new(grid, data);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Atmos.Piping.Components
|
||||
[ViewVariables]
|
||||
public TimeSpan LastProcess { get; set; } = TimeSpan.Zero;
|
||||
|
||||
public GridId? JoinedGrid { get; set; }
|
||||
public EntityUid? JoinedGrid { get; set; }
|
||||
}
|
||||
|
||||
public sealed class AtmosDeviceUpdateEvent : EntityEventArgs
|
||||
|
||||
@@ -29,7 +29,7 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
|
||||
if (!Resolve(uid, ref appearance, ref container, ref xform, false))
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(xform.GridID, out var grid))
|
||||
if (!_mapManager.TryGetGrid(xform.GridEntityId, out var grid))
|
||||
return;
|
||||
|
||||
// get connected entities
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
return;
|
||||
|
||||
// If we can't find any ports, cancel the anchoring.
|
||||
if(!FindGasPortIn(transform.GridID, transform.Coordinates, out _))
|
||||
if(!FindGasPortIn(transform.GridEntityId, transform.Coordinates, out _))
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
private bool FindGasPortIn(GridId gridId, EntityCoordinates coordinates, [NotNullWhen(true)] out GasPortComponent? port)
|
||||
private bool FindGasPortIn(EntityUid gridId, EntityCoordinates coordinates, [NotNullWhen(true)] out GasPortComponent? port)
|
||||
{
|
||||
port = null;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Content.Server.Atmos
|
||||
public AtmosDirection LastPressureDirection;
|
||||
|
||||
[ViewVariables]
|
||||
public GridId GridIndex { get; }
|
||||
public EntityUid GridIndex { get; }
|
||||
|
||||
[ViewVariables]
|
||||
public TileRef? Tile => GridIndices.GetTileRef(GridIndex);
|
||||
@@ -93,7 +93,7 @@ namespace Content.Server.Atmos
|
||||
[ViewVariables]
|
||||
public AtmosDirection BlockedAirflow { get; set; } = AtmosDirection.Invalid;
|
||||
|
||||
public TileAtmosphere(GridId gridIndex, Vector2i gridIndices, GasMixture? mixture = null, bool immutable = false)
|
||||
public TileAtmosphere(EntityUid gridIndex, Vector2i gridIndices, GasMixture? mixture = null, bool immutable = false)
|
||||
{
|
||||
GridIndex = gridIndex;
|
||||
GridIndices = gridIndices;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
var xform = _entities.GetComponent<TransformComponent>(Owner);
|
||||
var solSys = _systems.GetEntitySystem<SolutionContainerSystem>();
|
||||
var grid = MapManager.GetGrid(xform.GridID);
|
||||
var grid = MapManager.GetGrid(xform.GridEntityId);
|
||||
var origin = grid.TileIndicesFor(xform.Coordinates);
|
||||
|
||||
DebugTools.Assert(xform.Anchored, "Area effect entity prototypes must be anchored.");
|
||||
@@ -146,7 +146,7 @@ namespace Content.Server.Chemistry.Components
|
||||
|
||||
var chemistry = EntitySystem.Get<ReactiveSystem>();
|
||||
var xform = _entities.GetComponent<TransformComponent>(Owner);
|
||||
var mapGrid = MapManager.GetGrid(xform.GridID);
|
||||
var mapGrid = MapManager.GetGrid(xform.GridEntityId);
|
||||
var tile = mapGrid.GetTileRef(xform.Coordinates.ToVector2i(_entities, MapManager));
|
||||
var lookup = EntitySystem.Get<EntityLookupSystem>();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
@@ -94,10 +94,10 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
vapor.Timer += frameTime;
|
||||
vapor.ReactTimer += frameTime;
|
||||
|
||||
if (vapor.ReactTimer >= ReactTime && EntityManager.GetComponent<TransformComponent>(vapor.Owner).GridID.IsValid())
|
||||
if (vapor.ReactTimer >= ReactTime && EntityManager.GetComponent<TransformComponent>(vapor.Owner).GridEntityId.IsValid())
|
||||
{
|
||||
vapor.ReactTimer = 0;
|
||||
var mapGrid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridID);
|
||||
var mapGrid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(entity).GridEntityId);
|
||||
|
||||
var tile = mapGrid.GetTileRef(EntityManager.GetComponent<TransformComponent>(entity).Coordinates.ToVector2i(EntityManager, _mapManager));
|
||||
foreach (var reagentQuantity in contents.Contents.ToArray())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Server.Cleanable;
|
||||
using Content.Server.Decals;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
@@ -39,9 +39,9 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
}
|
||||
|
||||
var decalSystem = EntitySystem.Get<DecalSystem>();
|
||||
foreach (var (uid, _) in decalSystem.GetDecalsInRange(tile.GridIndex, tile.GridIndices+new Vector2(0.5f, 0.5f), validDelegate: x => x.Cleanable))
|
||||
foreach (var (uid, _) in decalSystem.GetDecalsInRange(tile.GridUid, tile.GridIndices+new Vector2(0.5f, 0.5f), validDelegate: x => x.Cleanable))
|
||||
{
|
||||
decalSystem.RemoveDecal(tile.GridIndex, uid);
|
||||
decalSystem.RemoveDecal(tile.GridUid, uid);
|
||||
}
|
||||
|
||||
return amount;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
@@ -21,17 +21,17 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
var environment = atmosphereSystem.GetTileMixture(tile.GridIndex, tile.GridIndices, true);
|
||||
var environment = atmosphereSystem.GetTileMixture(tile.GridUid, tile.GridIndices, true);
|
||||
|
||||
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridIndex, tile.GridIndices))
|
||||
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridUid, tile.GridIndices))
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
environment.Temperature =
|
||||
MathF.Max(MathF.Min(environment.Temperature - (_coolingTemperature * 1000f),
|
||||
environment.Temperature / _coolingTemperature), Atmospherics.TCMB);
|
||||
|
||||
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
|
||||
atmosphereSystem.HotspotExtinguish(tile.GridIndex, tile.GridIndices);
|
||||
atmosphereSystem.React(tile.GridUid, tile.GridIndices);
|
||||
atmosphereSystem.HotspotExtinguish(tile.GridUid, tile.GridIndices);
|
||||
|
||||
return FixedPoint2.Zero;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
@@ -20,12 +20,12 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
var environment = atmosphereSystem.GetTileMixture(tile.GridIndex, tile.GridIndices, true);
|
||||
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridIndex, tile.GridIndices))
|
||||
var environment = atmosphereSystem.GetTileMixture(tile.GridUid, tile.GridIndices, true);
|
||||
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridUid, tile.GridIndices))
|
||||
return FixedPoint2.Zero;
|
||||
|
||||
environment.Temperature *= MathF.Max(_temperatureMultiplier * reactVolume.Float(), 1f);
|
||||
atmosphereSystem.React(tile.GridIndex, tile.GridIndices);
|
||||
atmosphereSystem.React(tile.GridUid, tile.GridIndices);
|
||||
|
||||
return reactVolume;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Server.Construction.Commands
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
GridId gridId;
|
||||
EntityUid gridId;
|
||||
var xformQuery = entityManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
switch (args.Length)
|
||||
@@ -33,16 +33,16 @@ namespace Content.Server.Construction.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = xformQuery.GetComponent(playerEntity).GridID;
|
||||
gridId = xformQuery.GetComponent(playerEntity).GridEntityId;
|
||||
break;
|
||||
case 1:
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.WriteError($"{args[0]} is not a valid integer.");
|
||||
shell.WriteError($"{args[0]} is not a valid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = new GridId(id);
|
||||
gridId = id;
|
||||
break;
|
||||
default:
|
||||
shell.WriteLine(Help);
|
||||
|
||||
@@ -21,7 +21,7 @@ sealed class TileReplaceCommand : IConsoleCommand
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
GridId gridId;
|
||||
EntityUid gridId;
|
||||
string tileIdA = "";
|
||||
string tileIdB = "";
|
||||
|
||||
@@ -34,18 +34,18 @@ sealed class TileReplaceCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = entityManager.GetComponent<TransformComponent>(playerEntity).GridID;
|
||||
gridId = entityManager.GetComponent<TransformComponent>(playerEntity).GridEntityId;
|
||||
tileIdA = args[0];
|
||||
tileIdB = args[1];
|
||||
break;
|
||||
case 3:
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = new GridId(id);
|
||||
gridId = id;
|
||||
tileIdA = args[1];
|
||||
tileIdB = args[2];
|
||||
break;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Construction.Commands
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
GridId gridId;
|
||||
EntityUid gridId;
|
||||
|
||||
switch (args.Length)
|
||||
{
|
||||
@@ -35,16 +35,16 @@ namespace Content.Server.Construction.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = entityManager.GetComponent<TransformComponent>(playerEntity).GridID;
|
||||
gridId = entityManager.GetComponent<TransformComponent>(playerEntity).GridEntityId;
|
||||
break;
|
||||
case 1:
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
if (!EntityUid.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
shell.WriteLine($"{args[0]} is not a valid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = new GridId(id);
|
||||
gridId = id;
|
||||
break;
|
||||
default:
|
||||
shell.WriteLine(Help);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Construction.Conditions
|
||||
|
||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||
var indices = transform.Coordinates.ToVector2i(entityManager, IoCManager.Resolve<IMapManager>());
|
||||
var entities = indices.GetEntitiesInTile(transform.GridID, LookupFlags.Approximate | LookupFlags.Anchored, EntitySystem.Get<EntityLookupSystem>());
|
||||
var entities = indices.GetEntitiesInTile(transform.GridEntityId, LookupFlags.Approximate | LookupFlags.Anchored, EntitySystem.Get<EntityLookupSystem>());
|
||||
|
||||
foreach (var ent in entities)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Server.Coordinates.Helpers
|
||||
{
|
||||
IoCManager.Resolve(ref entMan, ref mapManager);
|
||||
|
||||
var gridId = coordinates.GetGridId(entMan);
|
||||
var gridId = coordinates.GetGridEntityId(entMan);
|
||||
|
||||
var tileSize = 1f;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Server.Decals.Commands
|
||||
}
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
if (!int.TryParse(args[3], out var gridIdRaw) || !mapManager.TryGetGrid(new GridId(gridIdRaw), out var grid))
|
||||
if (!EntityUid.TryParse(args[3], out var gridIdRaw) || !mapManager.TryGetGrid(gridIdRaw, out var grid))
|
||||
{
|
||||
shell.WriteError($"Failed parsing gridId '{args[3]}'.");
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
@@ -27,7 +27,7 @@ Possible modes are:\n
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var gridIdRaw))
|
||||
if (!EntityUid.TryParse(args[0], out var gridId))
|
||||
{
|
||||
shell.WriteError($"Failed parsing gridId '{args[3]}'.");
|
||||
return;
|
||||
@@ -39,7 +39,6 @@ Possible modes are:\n
|
||||
return;
|
||||
}
|
||||
|
||||
var gridId = new GridId(gridIdRaw);
|
||||
if (!IoCManager.Resolve<IMapManager>().GridExists(gridId))
|
||||
{
|
||||
shell.WriteError($"No grid with gridId {gridId} exists.");
|
||||
|
||||
@@ -25,14 +25,14 @@ namespace Content.Server.Decals.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[1], out var rawGridId) ||
|
||||
!IoCManager.Resolve<IMapManager>().GridExists(new GridId(rawGridId)))
|
||||
if (!EntityUid.TryParse(args[1], out var rawGridId) ||
|
||||
!IoCManager.Resolve<IMapManager>().GridExists(rawGridId))
|
||||
{
|
||||
shell.WriteError("Failed parsing gridId.");
|
||||
}
|
||||
|
||||
var decalSystem = EntitySystem.Get<DecalSystem>();
|
||||
if (decalSystem.RemoveDecal(new GridId(rawGridId), uid))
|
||||
if (decalSystem.RemoveDecal(rawGridId, uid))
|
||||
{
|
||||
shell.WriteLine($"Successfully removed decal {uid}.");
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Decals;
|
||||
@@ -19,17 +19,17 @@ namespace Content.Server.Decals
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefMan = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
private readonly Dictionary<GridId, HashSet<Vector2i>> _dirtyChunks = new();
|
||||
private readonly Dictionary<IPlayerSession, Dictionary<GridId, HashSet<Vector2i>>> _previousSentChunks = new();
|
||||
private readonly Dictionary<EntityUid, HashSet<Vector2i>> _dirtyChunks = new();
|
||||
private readonly Dictionary<IPlayerSession, Dictionary<EntityUid, HashSet<Vector2i>>> _previousSentChunks = new();
|
||||
|
||||
// If this ever gets parallelised then you'll want to increase the pooled count.
|
||||
private ObjectPool<HashSet<Vector2i>> _chunkIndexPool =
|
||||
new DefaultObjectPool<HashSet<Vector2i>>(
|
||||
new DefaultPooledObjectPolicy<HashSet<Vector2i>>(), 64);
|
||||
|
||||
private ObjectPool<Dictionary<GridId, HashSet<Vector2i>>> _chunkViewerPool =
|
||||
new DefaultObjectPool<Dictionary<GridId, HashSet<Vector2i>>>(
|
||||
new DefaultPooledObjectPolicy<Dictionary<GridId, HashSet<Vector2i>>>(), 64);
|
||||
private ObjectPool<Dictionary<EntityUid, HashSet<Vector2i>>> _chunkViewerPool =
|
||||
new DefaultObjectPool<Dictionary<EntityUid, HashSet<Vector2i>>>(
|
||||
new DefaultPooledObjectPolicy<Dictionary<EntityUid, HashSet<Vector2i>>>(), 64);
|
||||
|
||||
// Pool if we ever parallelise.
|
||||
private HashSet<EntityUid> _viewers = new(64);
|
||||
@@ -122,10 +122,10 @@ namespace Content.Server.Decals
|
||||
|
||||
foreach (var uid in toDelete)
|
||||
{
|
||||
RemoveDecalInternal(args.NewTile.GridIndex, uid);
|
||||
RemoveDecalInternal( args.NewTile.GridUid, uid);
|
||||
}
|
||||
|
||||
DirtyChunk(args.NewTile.GridIndex, indices);
|
||||
DirtyChunk(args.NewTile.GridUid, indices);
|
||||
}
|
||||
|
||||
private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
|
||||
@@ -168,7 +168,7 @@ namespace Content.Server.Decals
|
||||
if (!ev.Coordinates.IsValid(EntityManager))
|
||||
return;
|
||||
|
||||
var gridId = ev.Coordinates.GetGridId(EntityManager);
|
||||
var gridId = ev.Coordinates.GetGridEntityId(EntityManager);
|
||||
|
||||
if (!gridId.IsValid())
|
||||
return;
|
||||
@@ -181,7 +181,7 @@ namespace Content.Server.Decals
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DirtyChunk(GridId id, Vector2i chunkIndices)
|
||||
protected override void DirtyChunk(EntityUid id, Vector2i chunkIndices)
|
||||
{
|
||||
if(!_dirtyChunks.ContainsKey(id))
|
||||
_dirtyChunks[id] = new HashSet<Vector2i>();
|
||||
@@ -205,7 +205,7 @@ namespace Content.Server.Decals
|
||||
if (!PrototypeManager.HasIndex<DecalPrototype>(decal.Id))
|
||||
return false;
|
||||
|
||||
var gridId = coordinates.GetGridId(EntityManager);
|
||||
var gridId = coordinates.GetGridEntityId(EntityManager);
|
||||
if (!MapManager.TryGetGrid(gridId, out var grid))
|
||||
return false;
|
||||
|
||||
@@ -224,9 +224,9 @@ namespace Content.Server.Decals
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool RemoveDecal(GridId gridId, uint uid) => RemoveDecalInternal(gridId, uid);
|
||||
public bool RemoveDecal(EntityUid gridId, uint uid) => RemoveDecalInternal(gridId, uid);
|
||||
|
||||
public HashSet<(uint Index, Decal Decal)> GetDecalsInRange(GridId gridId, Vector2 position, float distance = 0.75f, Func<Decal, bool>? validDelegate = null)
|
||||
public HashSet<(uint Index, Decal Decal)> GetDecalsInRange(EntityUid gridId, Vector2 position, float distance = 0.75f, Func<Decal, bool>? validDelegate = null)
|
||||
{
|
||||
var uids = new HashSet<(uint, Decal)>();
|
||||
var chunkCollection = ChunkCollection(gridId);
|
||||
@@ -248,12 +248,12 @@ namespace Content.Server.Decals
|
||||
return uids;
|
||||
}
|
||||
|
||||
public bool SetDecalPosition(GridId gridId, uint uid, EntityCoordinates coordinates)
|
||||
public bool SetDecalPosition(EntityUid gridId, uint uid, EntityCoordinates coordinates)
|
||||
{
|
||||
return SetDecalPosition(gridId, uid, coordinates.GetGridId(EntityManager), coordinates.Position);
|
||||
return SetDecalPosition(gridId, uid, coordinates.GetGridEntityId(EntityManager), coordinates.Position);
|
||||
}
|
||||
|
||||
public bool SetDecalPosition(GridId gridId, uint uid, GridId newGridId, Vector2 position)
|
||||
public bool SetDecalPosition(EntityUid gridId, uint uid, EntityUid newGridId, Vector2 position)
|
||||
{
|
||||
if (!ChunkIndex.TryGetValue(gridId, out var values) || !values.TryGetValue(uid, out var indices))
|
||||
{
|
||||
@@ -281,7 +281,7 @@ namespace Content.Server.Decals
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDecalColor(GridId gridId, uint uid, Color? color)
|
||||
public bool SetDecalColor(EntityUid gridId, uint uid, Color? color)
|
||||
{
|
||||
if (!ChunkIndex.TryGetValue(gridId, out var values) || !values.TryGetValue(uid, out var indices))
|
||||
{
|
||||
@@ -295,7 +295,7 @@ namespace Content.Server.Decals
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDecalId(GridId gridId, uint uid, string id)
|
||||
public bool SetDecalId(EntityUid gridId, uint uid, string id)
|
||||
{
|
||||
if (!ChunkIndex.TryGetValue(gridId, out var values) || !values.TryGetValue(uid, out var indices))
|
||||
{
|
||||
@@ -312,7 +312,7 @@ namespace Content.Server.Decals
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDecalRotation(GridId gridId, uint uid, Angle angle)
|
||||
public bool SetDecalRotation(EntityUid gridId, uint uid, Angle angle)
|
||||
{
|
||||
if (!ChunkIndex.TryGetValue(gridId, out var values) || !values.TryGetValue(uid, out var indices))
|
||||
{
|
||||
@@ -326,7 +326,7 @@ namespace Content.Server.Decals
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDecalZIndex(GridId gridId, uint uid, int zIndex)
|
||||
public bool SetDecalZIndex(EntityUid gridId, uint uid, int zIndex)
|
||||
{
|
||||
if (!ChunkIndex.TryGetValue(gridId, out var values) || !values.TryGetValue(uid, out var indices))
|
||||
{
|
||||
@@ -340,7 +340,7 @@ namespace Content.Server.Decals
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDecalCleanable(GridId gridId, uint uid, bool cleanable)
|
||||
public bool SetDecalCleanable(EntityUid gridId, uint uid, bool cleanable)
|
||||
{
|
||||
if (!ChunkIndex.TryGetValue(gridId, out var values) || !values.TryGetValue(uid, out var indices))
|
||||
{
|
||||
@@ -364,12 +364,12 @@ namespace Content.Server.Decals
|
||||
continue;
|
||||
|
||||
var chunksInRange = GetChunksForSession(playerSession);
|
||||
var staleChunks = new Dictionary<GridId, HashSet<Vector2i>>();
|
||||
var staleChunks = new Dictionary<EntityUid, HashSet<Vector2i>>();
|
||||
|
||||
// Get any chunks not in range anymore
|
||||
// Then, remove them from previousSentChunks (for stuff like grids out of range)
|
||||
// and also mark them as stale for networking.
|
||||
var toRemoveGrids = new RemQueue<GridId>();
|
||||
var toRemoveGrids = new RemQueue<EntityUid>();
|
||||
// Store the chunks for later to remove.
|
||||
|
||||
foreach (var (gridId, oldIndices) in _previousSentChunks[playerSession])
|
||||
@@ -455,7 +455,7 @@ namespace Content.Server.Decals
|
||||
_dirtyChunks.Clear();
|
||||
}
|
||||
|
||||
private void ReturnToPool(Dictionary<GridId, HashSet<Vector2i>> chunks)
|
||||
private void ReturnToPool(Dictionary<EntityUid, HashSet<Vector2i>> chunks)
|
||||
{
|
||||
foreach (var (_, previous) in chunks)
|
||||
{
|
||||
@@ -469,10 +469,10 @@ namespace Content.Server.Decals
|
||||
|
||||
private void SendChunkUpdates(
|
||||
IPlayerSession session,
|
||||
Dictionary<GridId, HashSet<Vector2i>> updatedChunks,
|
||||
Dictionary<GridId, HashSet<Vector2i>> staleChunks)
|
||||
Dictionary<EntityUid, HashSet<Vector2i>> updatedChunks,
|
||||
Dictionary<EntityUid, HashSet<Vector2i>> staleChunks)
|
||||
{
|
||||
var updatedDecals = new Dictionary<GridId, Dictionary<Vector2i, Dictionary<uint, Decal>>>();
|
||||
var updatedDecals = new Dictionary<EntityUid, Dictionary<Vector2i, Dictionary<uint, Decal>>>();
|
||||
foreach (var (gridId, chunks) in updatedChunks)
|
||||
{
|
||||
var gridChunks = new Dictionary<Vector2i, Dictionary<uint, Decal>>();
|
||||
@@ -505,7 +505,7 @@ namespace Content.Server.Decals
|
||||
return viewers;
|
||||
}
|
||||
|
||||
private Dictionary<GridId, HashSet<Vector2i>> GetChunksForSession(IPlayerSession session)
|
||||
private Dictionary<EntityUid, HashSet<Vector2i>> GetChunksForSession(IPlayerSession session)
|
||||
{
|
||||
var viewers = GetSessionViewers(session);
|
||||
var chunks = GetChunksForViewers(viewers);
|
||||
@@ -513,7 +513,7 @@ namespace Content.Server.Decals
|
||||
return chunks;
|
||||
}
|
||||
|
||||
private Dictionary<GridId, HashSet<Vector2i>> GetChunksForViewers(HashSet<EntityUid> viewers)
|
||||
private Dictionary<EntityUid, HashSet<Vector2i>> GetChunksForViewers(HashSet<EntityUid> viewers)
|
||||
{
|
||||
var chunks = _chunkViewerPool.Get();
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
@@ -524,14 +524,14 @@ namespace Content.Server.Decals
|
||||
|
||||
foreach (var grid in MapManager.FindGridsIntersecting(mapId, bounds))
|
||||
{
|
||||
if (!chunks.ContainsKey(grid.Index))
|
||||
chunks[grid.Index] = _chunkIndexPool.Get();
|
||||
if (!chunks.ContainsKey(grid.GridEntityId))
|
||||
chunks[grid.GridEntityId] = _chunkIndexPool.Get();
|
||||
|
||||
var enumerator = new ChunkIndicesEnumerator(_transform.GetInvWorldMatrix(grid.GridEntityId, xformQuery).TransformBox(bounds), ChunkSize);
|
||||
|
||||
while (enumerator.MoveNext(out var indices))
|
||||
{
|
||||
chunks[grid.Index].Add(indices.Value);
|
||||
chunks[grid.GridEntityId].Add(indices.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
/// </summary>
|
||||
private void OnBeforePacketSent(EntityUid uid, WiredNetworkComponent component, BeforePacketSentEvent args)
|
||||
{
|
||||
if (EntityManager.GetComponent<TransformComponent>(uid).GridID != args.SenderTransform.GridID)
|
||||
if (EntityManager.GetComponent<TransformComponent>(uid).GridEntityId != args.SenderTransform.GridEntityId)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Content.Server.Disposal.Tube
|
||||
return null;
|
||||
var oppositeDirection = nextDirection.GetOpposite();
|
||||
|
||||
var grid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(targetTube.Owner).GridID);
|
||||
var grid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(targetTube.Owner).GridEntityId);
|
||||
var position = EntityManager.GetComponent<TransformComponent>(targetTube.Owner).Coordinates;
|
||||
foreach (var entity in grid.GetInDir(position, nextDirection))
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
// *This is on purpose.*
|
||||
|
||||
DisposalUnitComponent? duc = null;
|
||||
if (_mapManager.TryGetGrid(holderTransform.GridID, out var grid))
|
||||
if (_mapManager.TryGetGrid(holderTransform.GridEntityId, out var grid))
|
||||
{
|
||||
foreach (var contentUid in grid.GetLocal(holderTransform.Coordinates))
|
||||
{
|
||||
|
||||
@@ -477,7 +477,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
var grid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(component.Owner).GridID);
|
||||
var grid = _mapManager.GetGrid(EntityManager.GetComponent<TransformComponent>(component.Owner).GridEntityId);
|
||||
var coords = EntityManager.GetComponent<TransformComponent>(component.Owner).Coordinates;
|
||||
var entry = grid.GetLocal(coords)
|
||||
.FirstOrDefault(entity => EntityManager.HasComponent<DisposalEntryComponent>(entity));
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.Engineering.EntitySystems
|
||||
return;
|
||||
if (string.IsNullOrEmpty(component.Prototype))
|
||||
return;
|
||||
if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridId(EntityManager), out var grid))
|
||||
if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridEntityId(EntityManager), out var grid))
|
||||
return;
|
||||
if (!grid.TryGetTileRef(args.ClickLocation, out var tileRef))
|
||||
return;
|
||||
|
||||
@@ -41,7 +41,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
||||
float intensityStepSize,
|
||||
int typeIndex,
|
||||
Dictionary<Vector2i, NeighborFlag> edgeTiles,
|
||||
GridId? referenceGrid,
|
||||
EntityUid? referenceGrid,
|
||||
Matrix3 spaceMatrix,
|
||||
Angle spaceAngle)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
||||
}
|
||||
}
|
||||
|
||||
if (referenceGrid == Grid.Index)
|
||||
if (referenceGrid == Grid.GridEntityId)
|
||||
return;
|
||||
|
||||
_needToTransform = true;
|
||||
|
||||
@@ -19,11 +19,11 @@ public sealed class ExplosionSpaceTileFlood : ExplosionTileFlood
|
||||
/// After every iteration, this data set will store all the grid-tiles that were reached as a result of the
|
||||
/// explosion expanding in space.
|
||||
/// </summary>
|
||||
public Dictionary<GridId, HashSet<Vector2i>> GridJump = new();
|
||||
public Dictionary<EntityUid, HashSet<Vector2i>> GridJump = new();
|
||||
|
||||
public ushort TileSize = ExplosionSystem.DefaultTileSize;
|
||||
|
||||
public ExplosionSpaceTileFlood(ExplosionSystem system, MapCoordinates epicentre, GridId? referenceGrid, List<GridId> localGrids, float maxDistance)
|
||||
public ExplosionSpaceTileFlood(ExplosionSystem system, MapCoordinates epicentre, EntityUid? referenceGrid, List<EntityUid> localGrids, float maxDistance)
|
||||
{
|
||||
(_gridBlockMap, TileSize) = system.TransformGridEdges(epicentre, referenceGrid, localGrids, maxDistance);
|
||||
system.GetUnblockedDirections(_gridBlockMap, TileSize);
|
||||
|
||||
@@ -39,9 +39,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
//
|
||||
// We then need this data for every tile on a grid. So this mess of a variable maps the Grid ID and Vector2i grid
|
||||
// indices to this tile-data struct.
|
||||
private Dictionary<GridId, Dictionary<Vector2i, TileData>> _airtightMap = new();
|
||||
private Dictionary<EntityUid, Dictionary<Vector2i, TileData>> _airtightMap = new();
|
||||
|
||||
public void UpdateAirtightMap(GridId gridId, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
|
||||
public void UpdateAirtightMap(EntityUid gridId, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
|
||||
{
|
||||
if (_mapManager.TryGetGrid(gridId, out var grid))
|
||||
UpdateAirtightMap(grid, tile, query);
|
||||
@@ -62,8 +62,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
var tolerance = new float[_explosionTypes.Count];
|
||||
var blockedDirections = AtmosDirection.Invalid;
|
||||
|
||||
if (!_airtightMap.ContainsKey(grid.Index))
|
||||
_airtightMap[grid.Index] = new();
|
||||
if (!_airtightMap.ContainsKey(grid.GridEntityId))
|
||||
_airtightMap[grid.GridEntityId] = new();
|
||||
|
||||
query ??= EntityManager.GetEntityQuery<AirtightComponent>();
|
||||
var damageQuery = EntityManager.GetEntityQuery<DamageableComponent>();
|
||||
@@ -83,9 +83,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
}
|
||||
|
||||
if (blockedDirections != AtmosDirection.Invalid)
|
||||
_airtightMap[grid.Index][tile] = new(tolerance, blockedDirections);
|
||||
_airtightMap[grid.GridEntityId][tile] = new(tolerance, blockedDirections);
|
||||
else
|
||||
_airtightMap[grid.Index].Remove(tile);
|
||||
_airtightMap[grid.GridEntityId].Remove(tile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -100,7 +100,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform) || !transform.Anchored)
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(transform.GridID, out var grid))
|
||||
if (!_mapManager.TryGetGrid(transform.GridEntityId, out var grid))
|
||||
return;
|
||||
|
||||
UpdateAirtightMap(grid, grid.CoordinatesToTile(transform.Coordinates));
|
||||
|
||||
@@ -11,7 +11,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Set of tiles of each grid that are directly adjacent to space, along with the directions that face space.
|
||||
/// </summary>
|
||||
private Dictionary<GridId, Dictionary<Vector2i, NeighborFlag>> _gridEdges = new();
|
||||
private Dictionary<EntityUid, Dictionary<Vector2i, NeighborFlag>> _gridEdges = new();
|
||||
|
||||
/// <summary>
|
||||
/// On grid startup, prepare a map of grid edges.
|
||||
@@ -42,8 +42,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
/// </summary>
|
||||
public (Dictionary<Vector2i, BlockedSpaceTile>, ushort) TransformGridEdges(
|
||||
MapCoordinates epicentre,
|
||||
GridId? referenceGrid,
|
||||
List<GridId> localGrids,
|
||||
EntityUid? referenceGrid,
|
||||
List<EntityUid> localGrids,
|
||||
float maxDistance)
|
||||
{
|
||||
Dictionary<Vector2i, BlockedSpaceTile> transformedEdges = new();
|
||||
@@ -230,10 +230,10 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
|
||||
var tileRef = ev.NewTile;
|
||||
|
||||
if (!_gridEdges.TryGetValue(tileRef.GridIndex, out var edges))
|
||||
if (!_gridEdges.TryGetValue(tileRef.GridUid, out var edges))
|
||||
{
|
||||
edges = new();
|
||||
_gridEdges[tileRef.GridIndex] = edges;
|
||||
_gridEdges[tileRef.GridUid] = edges;
|
||||
}
|
||||
|
||||
if (tileRef.Tile.IsEmpty)
|
||||
@@ -373,10 +373,10 @@ public sealed class BlockedSpaceTile
|
||||
public sealed class GridEdgeData
|
||||
{
|
||||
public Vector2i Tile;
|
||||
public GridId? Grid;
|
||||
public EntityUid? Grid;
|
||||
public Box2Rotated Box;
|
||||
|
||||
public GridEdgeData(Vector2i tile, GridId? grid, Vector2 center, Angle angle, float size)
|
||||
public GridEdgeData(Vector2i tile, EntityUid? grid, Vector2 center, Angle angle, float size)
|
||||
{
|
||||
Tile = tile;
|
||||
Grid = grid;
|
||||
|
||||
@@ -22,7 +22,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
/// <param name="maxIntensity">The maximum intensity that the explosion can have at any given tile. This
|
||||
/// effectively caps the damage that this explosion can do.</param>
|
||||
/// <returns>A list of tile-sets and a list of intensity values which describe the explosion.</returns>
|
||||
private (int, List<float>, ExplosionSpaceTileFlood?, Dictionary<GridId, ExplosionGridTileFlood>, Matrix3)? GetExplosionTiles(
|
||||
private (int, List<float>, ExplosionSpaceTileFlood?, Dictionary<EntityUid, ExplosionGridTileFlood>, Matrix3)? GetExplosionTiles(
|
||||
MapCoordinates epicenter,
|
||||
string typeID,
|
||||
float totalIntensity,
|
||||
@@ -39,7 +39,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
}
|
||||
|
||||
Vector2i initialTile;
|
||||
GridId? epicentreGrid = null;
|
||||
EntityUid? epicentreGrid = null;
|
||||
var (localGrids, referenceGrid, maxDistance) = GetLocalGrids(epicenter, totalIntensity, slope, maxIntensity);
|
||||
|
||||
// get the epicenter tile indices
|
||||
@@ -47,7 +47,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
candidateGrid.TryGetTileRef(candidateGrid.WorldToTile(epicenter.Position), out var tileRef) &&
|
||||
!tileRef.Tile.IsEmpty)
|
||||
{
|
||||
epicentreGrid = candidateGrid.Index;
|
||||
epicentreGrid = candidateGrid.GridEntityId;
|
||||
initialTile = tileRef.GridIndices;
|
||||
}
|
||||
else if (referenceGrid != null)
|
||||
@@ -64,7 +64,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
}
|
||||
|
||||
// Main data for the exploding tiles in space and on various grids
|
||||
Dictionary<GridId, ExplosionGridTileFlood> gridData = new();
|
||||
Dictionary<EntityUid, ExplosionGridTileFlood> gridData = new();
|
||||
ExplosionSpaceTileFlood? spaceData = null;
|
||||
|
||||
// The intensity slope is how much the intensity drop over a one-tile distance. The actual algorithm step-size is half of thhat.
|
||||
@@ -76,8 +76,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
HashSet<Vector2i> previousSpaceJump;
|
||||
|
||||
// As above, but for space-based explosion propagating from space onto grids.
|
||||
HashSet<GridId> encounteredGrids = new();
|
||||
Dictionary<GridId, HashSet<Vector2i>>? previousGridJump;
|
||||
HashSet<EntityUid> encounteredGrids = new();
|
||||
Dictionary<EntityUid, HashSet<Vector2i>>? previousGridJump;
|
||||
|
||||
// variables for transforming between grid and space-coordiantes
|
||||
var spaceMatrix = Matrix3.Identity;
|
||||
@@ -256,7 +256,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
/// match a separate grid. This is done so that if you have something like a tiny suicide-bomb shuttle exploding
|
||||
/// near a large station, the explosion will still orient to match the station, not the tiny shuttle.
|
||||
/// </remarks>
|
||||
public (List<GridId>, GridId?, float) GetLocalGrids(MapCoordinates epicenter, float totalIntensity, float slope, float maxIntensity)
|
||||
public (List<EntityUid>, EntityUid?, float) GetLocalGrids(MapCoordinates epicenter, float totalIntensity, float slope, float maxIntensity)
|
||||
{
|
||||
// Get the explosion radius (approx radius if it were in open-space). Note that if the explosion is confined in
|
||||
// some directions but not in others, the actual explosion may reach further than this distance from the
|
||||
@@ -266,7 +266,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
// to avoid a silly lookup for silly input numbers, cap the radius to half of the theoretical maximum (lookup area gets doubled later on).
|
||||
radius = Math.Min(radius, MaxIterations / 4);
|
||||
|
||||
GridId? referenceGrid = null;
|
||||
EntityUid? referenceGrid = null;
|
||||
float mass = 0;
|
||||
|
||||
// First attempt to find a grid that is relatively close to the explosion's center. Instead of looking in a
|
||||
@@ -278,7 +278,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
if (TryComp(grid.GridEntityId, out PhysicsComponent? physics) && physics.Mass > mass)
|
||||
{
|
||||
mass = physics.Mass;
|
||||
referenceGrid = grid.Index;
|
||||
referenceGrid = grid.GridEntityId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
radius *= 4;
|
||||
box = Box2.CenteredAround(epicenter.Position, (radius, radius));
|
||||
var mapGrids = _mapManager.FindGridsIntersecting(epicenter.MapId, box).ToList();
|
||||
var grids = mapGrids.Select(x => x.Index).ToList();
|
||||
var grids = mapGrids.Select(x => x.GridEntityId).ToList();
|
||||
|
||||
if (referenceGrid != null)
|
||||
return (grids, referenceGrid, radius);
|
||||
@@ -305,7 +305,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
if (TryComp(grid.GridEntityId, out PhysicsComponent? physics) && physics.Mass > mass)
|
||||
{
|
||||
mass = physics.Mass;
|
||||
referenceGrid = grid.Index;
|
||||
referenceGrid = grid.GridEntityId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -308,10 +308,10 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
{
|
||||
var spaceTiles = spaceData?.TileLists;
|
||||
|
||||
Dictionary<GridId, Dictionary<int, List<Vector2i>>> tileLists = new();
|
||||
Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tileLists = new();
|
||||
foreach (var grid in gridData)
|
||||
{
|
||||
tileLists.Add(grid.Grid.Index, grid.TileLists);
|
||||
tileLists.Add(grid.Grid.GridEntityId, grid.TileLists);
|
||||
}
|
||||
|
||||
return new ExplosionEvent(_explosionCounter, epicenter, id, iterationIntensity, spaceTiles, tileLists, spaceMatrix, spaceData?.TileSize ?? DefaultTileSize);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Fluids.Components;
|
||||
@@ -103,7 +103,7 @@ public sealed class FluidSpreaderSystem : EntitySystem
|
||||
var prototypeName = metadataOriginal.EntityPrototype!.ID;
|
||||
var visitedTiles = new HashSet<Vector2i>();
|
||||
|
||||
if (!_mapManager.TryGetGrid(transformOrig.GridID, out var mapGrid))
|
||||
if (!_mapManager.TryGetGrid(transformOrig.GridEntityId, out var mapGrid))
|
||||
return;
|
||||
|
||||
// skip origin puddle
|
||||
|
||||
@@ -76,7 +76,7 @@ public sealed class MoppingSystem : EntitySystem
|
||||
|
||||
private void ReleaseToFloor(EntityCoordinates clickLocation, AbsorbentComponent absorbent, Solution? absorbedSolution)
|
||||
{
|
||||
if ((_mapManager.TryGetGrid(clickLocation.GetGridId(EntityManager), out var mapGrid)) // needs valid grid
|
||||
if ((_mapManager.TryGetGrid(clickLocation.GetGridEntityId(EntityManager), out var mapGrid)) // needs valid grid
|
||||
&& absorbedSolution is not null) // needs a solution to place on the tile
|
||||
{
|
||||
TileRef tile = mapGrid.GetTileRef(clickLocation);
|
||||
|
||||
@@ -132,7 +132,7 @@ public sealed class SpillableSystem : EntitySystem
|
||||
if (solution.TotalVolume == 0) return null;
|
||||
|
||||
|
||||
if (!_mapManager.TryGetGrid(coordinates.GetGridId(EntityManager), out var mapGrid))
|
||||
if (!_mapManager.TryGetGrid(coordinates.GetGridEntityId(EntityManager), out var mapGrid))
|
||||
return null; // Let's not spill to space.
|
||||
|
||||
return SpillAt(mapGrid.GetTileRef(coordinates), solution, prototype, overflow, sound,
|
||||
@@ -162,7 +162,7 @@ public sealed class SpillableSystem : EntitySystem
|
||||
// If space return early, let that spill go out into the void
|
||||
if (tileRef.Tile.IsEmpty) return null;
|
||||
|
||||
var gridId = tileRef.GridIndex;
|
||||
var gridId = tileRef.GridUid;
|
||||
if (!_mapManager.TryGetGrid(gridId, out var mapGrid)) return null; // Let's not spill to invalid grids.
|
||||
|
||||
if (!noTileReact)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Cooldown;
|
||||
using Content.Server.Extinguisher;
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Vapor;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -58,7 +59,7 @@ public sealed class SpraySystem : EntitySystem
|
||||
|
||||
var playerPos = Transform(args.User).Coordinates;
|
||||
|
||||
if (args.ClickLocation.GetGridId(EntityManager) != playerPos.GetGridId(EntityManager))
|
||||
if (args.ClickLocation.GetGridEntityId(EntityManager) != playerPos.GetGridEntityId(EntityManager))
|
||||
return;
|
||||
|
||||
var direction = (args.ClickLocation.Position - playerPos.Position).Normalized;
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Content.Server.GameTicking
|
||||
/// <param name="loadOptions">Map loading options, includes offset.</param>
|
||||
/// <param name="stationName">Name to assign to the loaded station.</param>
|
||||
/// <returns>All loaded entities and grids.</returns>
|
||||
public (IReadOnlyList<EntityUid>, IReadOnlyList<GridId>) LoadGameMap(GameMapPrototype map, MapId targetMapId, MapLoadOptions? loadOptions, string? stationName = null)
|
||||
public (IReadOnlyList<EntityUid>, IReadOnlyList<EntityUid>) LoadGameMap(GameMapPrototype map, MapId targetMapId, MapLoadOptions? loadOptions, string? stationName = null)
|
||||
{
|
||||
var loadOpts = loadOptions ?? new MapLoadOptions();
|
||||
|
||||
@@ -121,10 +121,11 @@ namespace Content.Server.GameTicking
|
||||
|
||||
var (entities, gridIds) = _mapLoader.LoadMap(targetMapId, ev.GameMap.MapPath.ToString(), ev.Options);
|
||||
|
||||
RaiseLocalEvent(new PostGameMapLoad(map, targetMapId, entities, gridIds, stationName));
|
||||
var gridUids = gridIds.Select(g => (EntityUid)g).ToList();
|
||||
RaiseLocalEvent(new PostGameMapLoad(map, targetMapId, entities, gridUids, stationName));
|
||||
|
||||
_spawnPoint = _mapManager.GetGrid(gridIds[0]).ToCoordinates();
|
||||
return (entities, gridIds);
|
||||
return (entities, gridUids);
|
||||
}
|
||||
|
||||
public void StartRound(bool force = false)
|
||||
@@ -557,10 +558,10 @@ namespace Content.Server.GameTicking
|
||||
public readonly GameMapPrototype GameMap;
|
||||
public readonly MapId Map;
|
||||
public readonly IReadOnlyList<EntityUid> Entities;
|
||||
public readonly IReadOnlyList<GridId> Grids;
|
||||
public readonly IReadOnlyList<EntityUid> Grids;
|
||||
public readonly string? StationName;
|
||||
|
||||
public PostGameMapLoad(GameMapPrototype gameMap, MapId map, IReadOnlyList<EntityUid> entities, IReadOnlyList<GridId> grids, string? stationName)
|
||||
public PostGameMapLoad(GameMapPrototype gameMap, MapId map, IReadOnlyList<EntityUid> entities, IReadOnlyList<EntityUid> grids, string? stationName)
|
||||
{
|
||||
GameMap = gameMap;
|
||||
Map = map;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Audio;
|
||||
using Content.Server.Audio;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Gravity;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -187,8 +187,8 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
|
||||
private void UpdateGravityActive(GravityGeneratorComponent grav, bool shake)
|
||||
{
|
||||
var gridId = EntityManager.GetComponent<TransformComponent>(grav.Owner).GridID;
|
||||
if (gridId == GridId.Invalid)
|
||||
var gridId = EntityManager.GetComponent<TransformComponent>(grav.Owner).GridEntityId;
|
||||
if (gridId == EntityUid.Invalid)
|
||||
return;
|
||||
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
|
||||
[Dependency] private readonly CameraRecoilSystem _cameraRecoil = default!;
|
||||
|
||||
private Dictionary<GridId, uint> _gridsToShake = new();
|
||||
private Dictionary<EntityUid, uint> _gridsToShake = new();
|
||||
|
||||
private const float GravityKick = 100.0f;
|
||||
private const uint ShakeTimes = 10;
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
public void ShakeGrid(GridId gridId, GravityComponent comp)
|
||||
public void ShakeGrid(EntityUid gridId, GravityComponent comp)
|
||||
{
|
||||
_gridsToShake[gridId] = ShakeTimes;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
{
|
||||
// I have to copy this because C# doesn't allow changing collections while they're
|
||||
// getting enumerated.
|
||||
var gridsToShake = new Dictionary<GridId, uint>(_gridsToShake);
|
||||
var gridsToShake = new Dictionary<EntityUid, uint>(_gridsToShake);
|
||||
foreach (var gridId in _gridsToShake.Keys)
|
||||
{
|
||||
if (_gridsToShake[gridId] == 0)
|
||||
@@ -73,12 +73,12 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
_gridsToShake = gridsToShake;
|
||||
}
|
||||
|
||||
private void ShakeGrid(GridId gridId)
|
||||
private void ShakeGrid(EntityUid gridId)
|
||||
{
|
||||
foreach (var player in _playerManager.Sessions)
|
||||
{
|
||||
if (player.AttachedEntity is not {Valid: true} attached
|
||||
|| EntityManager.GetComponent<TransformComponent>(attached).GridID != gridId
|
||||
|| EntityManager.GetComponent<TransformComponent>(attached).GridEntityId != gridId
|
||||
|| !EntityManager.HasComponent<CameraRecoilComponent>(attached))
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -16,12 +16,12 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
private void HandleGravityInitialize(EntityUid uid, GravityComponent component, ComponentInit args)
|
||||
{
|
||||
// Incase there's already a generator on the grid we'll just set it now.
|
||||
var gridId = EntityManager.GetComponent<TransformComponent>(component.Owner).GridID;
|
||||
var gridId = EntityManager.GetComponent<TransformComponent>(component.Owner).GridEntityId;
|
||||
GravityChangedMessage message;
|
||||
|
||||
foreach (var generator in EntityManager.EntityQuery<GravityGeneratorComponent>())
|
||||
{
|
||||
if (EntityManager.GetComponent<TransformComponent>(generator.Owner).GridID == gridId && generator.GravityActive)
|
||||
if (EntityManager.GetComponent<TransformComponent>(generator.Owner).GridEntityId == gridId && generator.GravityActive)
|
||||
{
|
||||
component.Enabled = true;
|
||||
message = new GravityChangedMessage(gridId, true);
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
if (comp.Enabled) return;
|
||||
comp.Enabled = true;
|
||||
|
||||
var gridId = EntityManager.GetComponent<TransformComponent>(comp.Owner).GridID;
|
||||
var gridId = EntityManager.GetComponent<TransformComponent>(comp.Owner).GridEntityId;
|
||||
var message = new GravityChangedMessage(gridId, true);
|
||||
RaiseLocalEvent(message);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
if (!comp.Enabled) return;
|
||||
comp.Enabled = false;
|
||||
|
||||
var gridId = EntityManager.GetComponent<TransformComponent>(comp.Owner).GridID;
|
||||
var gridId = EntityManager.GetComponent<TransformComponent>(comp.Owner).GridEntityId;
|
||||
var message = new GravityChangedMessage(gridId, false);
|
||||
RaiseLocalEvent(message);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
|
||||
|
||||
private readonly Dictionary<GridId, List<AlertsComponent>> _alerts = new();
|
||||
private readonly Dictionary<EntityUid, List<AlertsComponent>> _alerts = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -34,11 +34,11 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
public void AddAlert(AlertsComponent status)
|
||||
{
|
||||
var xform = Transform(status.Owner);
|
||||
var alerts = _alerts.GetOrNew(xform.GridID);
|
||||
var alerts = _alerts.GetOrNew(xform.GridEntityId);
|
||||
|
||||
alerts.Add(status);
|
||||
|
||||
if (_mapManager.TryGetGrid(xform.GridID, out var grid))
|
||||
if (_mapManager.TryGetGrid(xform.GridEntityId, out var grid))
|
||||
{
|
||||
if (EntityManager.GetComponent<GravityComponent>(grid.GridEntityId).Enabled)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
|
||||
public void RemoveAlert(AlertsComponent status)
|
||||
{
|
||||
var grid = EntityManager.GetComponent<TransformComponent>(status.Owner).GridID;
|
||||
var grid = EntityManager.GetComponent<TransformComponent>(status.Owner).GridEntityId;
|
||||
if (!_alerts.TryGetValue(grid, out var statuses))
|
||||
{
|
||||
return;
|
||||
@@ -101,7 +101,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
if (ev.OldParent is {Valid: true} old &&
|
||||
EntityManager.TryGetComponent(old, out IMapGridComponent? mapGrid))
|
||||
{
|
||||
var oldGrid = mapGrid.GridIndex;
|
||||
var oldGrid = mapGrid.Owner;
|
||||
|
||||
if (_alerts.TryGetValue(oldGrid, out var oldStatuses))
|
||||
{
|
||||
@@ -109,7 +109,7 @@ namespace Content.Server.Gravity.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
var newGrid = ev.Transform.GridID;
|
||||
var newGrid = ev.Transform.GridEntityId;
|
||||
var newStatuses = _alerts.GetOrNew(newGrid);
|
||||
|
||||
newStatuses.Add(status);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.Server.Interaction
|
||||
}
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var playerGrid = _entities.GetComponent<TransformComponent>(attached).GridID;
|
||||
var playerGrid = _entities.GetComponent<TransformComponent>(attached).GridEntityId;
|
||||
var mapGrid = mapManager.GetGrid(playerGrid);
|
||||
var playerPosition = _entities.GetComponent<TransformComponent>(attached).Coordinates;
|
||||
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||
|
||||
@@ -44,7 +44,7 @@ public sealed class SpreaderSystem : EntitySystem
|
||||
if (!EntityManager.TryGetComponent<TransformComponent>(blocker, out var transform))
|
||||
return; // how did we get here?
|
||||
|
||||
if (!_mapManager.TryGetGrid(transform.GridID, out var grid)) return;
|
||||
if (!_mapManager.TryGetGrid(transform.GridEntityId, out var grid)) return;
|
||||
|
||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public sealed class SpreaderSystem : EntitySystem
|
||||
|
||||
if (spreader.Enabled == false) return false;
|
||||
|
||||
if (!_mapManager.TryGetGrid(transform.GridID, out var grid)) return false;
|
||||
if (!_mapManager.TryGetGrid(transform.GridEntityId, out var grid)) return false;
|
||||
|
||||
var didGrow = false;
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.Server.Medical.CrewMonitoring
|
||||
// should work well enough?
|
||||
if (TryComp(uid, out IMoverComponent? mover))
|
||||
worldRot = mover.LastGridAngle;
|
||||
else if (_mapManager.TryGetGrid(xform.GridID, out var grid))
|
||||
else if (_mapManager.TryGetGrid(xform.GridEntityId, out var grid))
|
||||
worldRot = grid.WorldRotation;
|
||||
|
||||
// update all sensors info
|
||||
|
||||
@@ -90,8 +90,8 @@ public sealed class MindSystem : EntitySystem
|
||||
return;
|
||||
|
||||
// Async this so that we don't throw if the grid we're on is being deleted.
|
||||
var gridId = spawnPosition.GetGridId(EntityManager);
|
||||
if (!spawnPosition.IsValid(EntityManager) || gridId == GridId.Invalid || !_mapManager.GridExists(gridId))
|
||||
var gridId = spawnPosition.GetGridEntityId(EntityManager);
|
||||
if (!spawnPosition.IsValid(EntityManager) || gridId == EntityUid.Invalid || !_mapManager.GridExists(gridId))
|
||||
{
|
||||
spawnPosition = _gameTicker.GetObserverSpawnPoint();
|
||||
}
|
||||
|
||||
@@ -335,7 +335,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.GridID, out var grid);
|
||||
_mapManager.TryGetGrid(xform.GridEntityId, out var grid);
|
||||
|
||||
if (!node.Connectable(EntityManager, xform))
|
||||
yield break;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Content.Server.NodeContainer.NodeGroups
|
||||
public bool Removed { get; set; } = false;
|
||||
|
||||
[ViewVariables]
|
||||
protected GridId GridId { get; private set; }
|
||||
protected EntityUid GridId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Network ID of this group for client-side debug visualization of nodes.
|
||||
@@ -75,7 +75,7 @@ namespace Content.Server.NodeContainer.NodeGroups
|
||||
public virtual void Initialize(Node sourceNode)
|
||||
{
|
||||
// TODO: Can we get rid of this GridId?
|
||||
GridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sourceNode.Owner).GridID;
|
||||
GridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sourceNode.Owner).GridEntityId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.NodeContainer.NodeGroups
|
||||
@@ -23,7 +22,7 @@ namespace Content.Server.NodeContainer.NodeGroups
|
||||
|
||||
[ViewVariables] private AtmosphereSystem? _atmosphereSystem;
|
||||
|
||||
public GridId Grid => GridId;
|
||||
public EntityUid Grid => GridId;
|
||||
|
||||
public override void Initialize(Node sourceNode)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user