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
|
||||
|
||||
Reference in New Issue
Block a user