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