Replace GridEntityId with Owner (#12743)
This commit is contained in:
@@ -66,7 +66,7 @@ public sealed class ExplosionDebugOverlay : Overlay
|
|||||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
var gridXform = xformQuery.GetComponent(grid.Owner);
|
||||||
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||||
gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
|
gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
|
||||||
DrawText(handle, gridBounds, matrix, tileSets, grid.TileSize);
|
DrawText(handle, gridBounds, matrix, tileSets, grid.TileSize);
|
||||||
@@ -134,7 +134,7 @@ public sealed class ExplosionDebugOverlay : Overlay
|
|||||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
var gridXform = xformQuery.GetComponent(grid.Owner);
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||||
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
|
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
|
||||||
handle.SetTransform(worldMatrix);
|
handle.SetTransform(worldMatrix);
|
||||||
|
|||||||
@@ -21,12 +21,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.GridEntityId != 0);
|
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 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)?.GridUid;
|
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||||
GridOptions.AddItem($"{grid.GridEntityId} {(playerGrid == grid.GridEntityId ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||||
@@ -38,7 +38,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].GridEntityId;
|
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
||||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,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.GridEntityId != 0);
|
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 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)?.GridUid;
|
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||||
GridOptions.AddItem($"{grid.GridEntityId} {(playerGrid == grid.GridEntityId ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||||
@@ -53,7 +53,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var gridList = _gridData.ToList();
|
var gridList = _gridData.ToList();
|
||||||
var gridIndex = gridList[GridOptions.SelectedId].GridEntityId;
|
var gridIndex = gridList[GridOptions.SelectedId].Owner;
|
||||||
|
|
||||||
var gasList = _gasData.ToList();
|
var gasList = _gasData.ToList();
|
||||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||||
|
|||||||
@@ -25,12 +25,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.GridEntityId != 0);
|
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 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)?.GridUid;
|
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||||
GridOptions.AddItem($"{grid.GridEntityId} {(playerGrid == grid.GridEntityId ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||||
@@ -53,7 +53,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var gridList = _gridData.ToList();
|
var gridList = _gridData.ToList();
|
||||||
var gridIndex = gridList[GridOptions.SelectedId].GridEntityId;
|
var gridIndex = gridList[GridOptions.SelectedId].Owner;
|
||||||
|
|
||||||
var gasList = _gasData.ToList();
|
var gasList = _gasData.ToList();
|
||||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||||
|
|||||||
@@ -21,12 +21,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.GridEntityId != 0);
|
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 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)?.GridUid;
|
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||||
GridOptions.AddItem($"{grid.GridEntityId} {(playerGrid == grid.GridEntityId ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||||
@@ -38,7 +38,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].GridEntityId;
|
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
||||||
IoCManager.Resolve<IClientConsoleHost>()
|
IoCManager.Resolve<IClientConsoleHost>()
|
||||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public sealed partial class ObjectsTab : Control
|
|||||||
var entities = selection switch
|
var entities = selection switch
|
||||||
{
|
{
|
||||||
ObjectsTabSelection.Stations => _entityManager.EntitySysManager.GetEntitySystem<StationSystem>().Stations.ToList(),
|
ObjectsTabSelection.Stations => _entityManager.EntitySysManager.GetEntitySystem<StationSystem>().Stations.ToList(),
|
||||||
ObjectsTabSelection.Grids => _entityManager.EntityQuery<MapGridComponent>(true).Select(x => x.Owner).ToList(),
|
ObjectsTabSelection.Grids => _entityManager.EntityQuery<MapGridComponent>(true).Select(x => ((Component) x).Owner).ToList(),
|
||||||
ObjectsTabSelection.Maps => _entityManager.EntityQuery<MapComponent>(true).Select(x => x.Owner).ToList(),
|
ObjectsTabSelection.Maps => _entityManager.EntityQuery<MapComponent>(true).Select(x => x.Owner).ToList(),
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(selection), selection, null)
|
_ => throw new ArgumentOutOfRangeException(nameof(selection), selection, null)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ 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.GridEntityId) ||
|
if (!_atmosDebugOverlaySystem.HasData(mapGrid.Owner) ||
|
||||||
!_entManager.TryGetComponent<TransformComponent>(mapGrid.GridEntityId, out var xform))
|
!_entManager.TryGetComponent<TransformComponent>(mapGrid.Owner, out var xform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
drawHandle.SetTransform(xform.WorldMatrix);
|
drawHandle.SetTransform(xform.WorldMatrix);
|
||||||
@@ -52,7 +52,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.GridEntityId, tile.GridIndices);
|
var dataMaybeNull = _atmosDebugOverlaySystem.GetData(mapGrid.Owner, tile.GridIndices);
|
||||||
if (dataMaybeNull != null)
|
if (dataMaybeNull != null)
|
||||||
{
|
{
|
||||||
var data = (SharedAtmosDebugOverlaySystem.AtmosDebugOverlayData) dataMaybeNull!;
|
var data = (SharedAtmosDebugOverlaySystem.AtmosDebugOverlayData) dataMaybeNull!;
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ namespace Content.Client.Atmos.Overlays
|
|||||||
|
|
||||||
foreach (var mapGrid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds))
|
foreach (var mapGrid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds))
|
||||||
{
|
{
|
||||||
if (!TileData.TryGetValue(mapGrid.GridEntityId, out var gridData) ||
|
if (!TileData.TryGetValue(mapGrid.Owner, out var gridData) ||
|
||||||
!xformQuery.TryGetComponent(mapGrid.GridEntityId, out var gridXform))
|
!xformQuery.TryGetComponent(mapGrid.Owner, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public sealed class ExplosionOverlay : Overlay
|
|||||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var xform = xforms.GetComponent(grid.GridEntityId);
|
var xform = xforms.GetComponent(grid.Owner);
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
var (_, _, worldMatrix, invWorldMatrix) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
||||||
|
|
||||||
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
|
gridBounds = invWorldMatrix.TransformBox(worldBounds).Enlarged(grid.TileSize * 2);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public sealed class PuddleOverlay : Overlay
|
|||||||
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||||
drawHandle.SetTransform(worldMatrix);
|
drawHandle.SetTransform(worldMatrix);
|
||||||
|
|
||||||
foreach (var debugOverlayData in _debugOverlaySystem.GetData(mapGrid.GridEntityId))
|
foreach (var debugOverlayData in _debugOverlaySystem.GetData(mapGrid.Owner))
|
||||||
{
|
{
|
||||||
var centre = ((Vector2) debugOverlayData.Pos + 0.5f) * mapGrid.TileSize;
|
var centre = ((Vector2) debugOverlayData.Pos + 0.5f) * mapGrid.TileSize;
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ public sealed class PuddleOverlay : Overlay
|
|||||||
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||||
var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
var gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(mapGrid.TileSize * 2);
|
||||||
|
|
||||||
foreach (var debugOverlayData in _debugOverlaySystem.GetData(mapGrid.GridEntityId))
|
foreach (var debugOverlayData in _debugOverlaySystem.GetData(mapGrid.Owner))
|
||||||
{
|
{
|
||||||
var centre = ((Vector2) debugOverlayData.Pos + 0.5f) * mapGrid.TileSize;
|
var centre = ((Vector2) debugOverlayData.Pos + 0.5f) * mapGrid.TileSize;
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
if (!_mapManager.TryFindGridAt(mousePos, out var grid))
|
if (!_mapManager.TryFindGridAt(mousePos, out var grid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StartDragging(grid.GridEntityId, Transform(grid.GridEntityId).InvWorldMatrix.Transform(mousePos.Position));
|
StartDragging(grid.Owner, Transform(grid.Owner).InvWorldMatrix.Transform(mousePos.Position));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TryComp<TransformComponent>(_dragging, out var xform))
|
if (!TryComp<TransformComponent>(_dragging, out var xform))
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public sealed class JetpackSystem : SharedJetpackSystem
|
|||||||
|
|
||||||
if (_mapManager.TryGetGrid(gridUid, out var grid))
|
if (_mapManager.TryGetGrid(gridUid, out var grid))
|
||||||
{
|
{
|
||||||
coordinates = new EntityCoordinates(grid.GridEntityId, grid.WorldToLocal(coordinates.ToMapPos(EntityManager)));
|
coordinates = new EntityCoordinates(grid.Owner, grid.WorldToLocal(coordinates.ToMapPos(EntityManager)));
|
||||||
}
|
}
|
||||||
else if (uidXform.MapUid != null)
|
else if (uidXform.MapUid != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ namespace Content.Client.NPC
|
|||||||
|
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
|
foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
|
||||||
{
|
{
|
||||||
if (found || !_system.Breadcrumbs.TryGetValue(grid.GridEntityId, out var crumbs) || !xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
if (found || !_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||||
@@ -243,12 +243,12 @@ namespace Content.Client.NPC
|
|||||||
if ((_system.Modes & PathfindingDebugMode.Poly) != 0x0 &&
|
if ((_system.Modes & PathfindingDebugMode.Poly) != 0x0 &&
|
||||||
mouseWorldPos.MapId == args.MapId)
|
mouseWorldPos.MapId == args.MapId)
|
||||||
{
|
{
|
||||||
if (!_mapManager.TryFindGridAt(mouseWorldPos, out var grid) || !xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
if (!_mapManager.TryFindGridAt(mouseWorldPos, out var grid) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var found = false;
|
var found = false;
|
||||||
|
|
||||||
if (!_system.Polys.TryGetValue(grid.GridEntityId, out var data))
|
if (!_system.Polys.TryGetValue(grid.Owner, out var data))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tileRef = grid.GetTileRef(mouseWorldPos);
|
var tileRef = grid.GetTileRef(mouseWorldPos);
|
||||||
@@ -324,8 +324,8 @@ namespace Content.Client.NPC
|
|||||||
{
|
{
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
|
foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
|
||||||
{
|
{
|
||||||
if (!_system.Breadcrumbs.TryGetValue(grid.GridEntityId, out var crumbs) ||
|
if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) ||
|
||||||
!xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
!xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||||
@@ -378,8 +378,8 @@ namespace Content.Client.NPC
|
|||||||
{
|
{
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
|
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
|
||||||
{
|
{
|
||||||
if (!_system.Polys.TryGetValue(grid.GridEntityId, out var data) ||
|
if (!_system.Polys.TryGetValue(grid.Owner, out var data) ||
|
||||||
!xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
!xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||||
@@ -412,8 +412,8 @@ namespace Content.Client.NPC
|
|||||||
{
|
{
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
|
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
|
||||||
{
|
{
|
||||||
if (!_system.Polys.TryGetValue(grid.GridEntityId, out var data) ||
|
if (!_system.Polys.TryGetValue(grid.Owner, out var data) ||
|
||||||
!xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
!xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||||
@@ -466,8 +466,8 @@ namespace Content.Client.NPC
|
|||||||
{
|
{
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds))
|
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds))
|
||||||
{
|
{
|
||||||
if (!_system.Breadcrumbs.TryGetValue(grid.GridEntityId, out var crumbs) ||
|
if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) ||
|
||||||
!xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
!xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||||
|
|||||||
@@ -113,12 +113,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.GridEntityId, worldAABB))
|
foreach (var entity in _lookup.GetEntitiesIntersecting(grid.Owner, worldAABB))
|
||||||
{
|
{
|
||||||
if (!_system.Entities.TryGetValue(entity, out var nodeData))
|
if (!_system.Entities.TryGetValue(entity, out var nodeData))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var gridDict = _gridIndex.GetOrNew(grid.GridEntityId);
|
var gridDict = _gridIndex.GetOrNew(grid.Owner);
|
||||||
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...
|
||||||
@@ -140,7 +140,7 @@ namespace Content.Client.NodeContainer
|
|||||||
foreach (var (gridId, gridDict) in _gridIndex)
|
foreach (var (gridId, gridDict) in _gridIndex)
|
||||||
{
|
{
|
||||||
var grid = _mapManager.GetGrid(gridId);
|
var grid = _mapManager.GetGrid(gridId);
|
||||||
var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(grid.GridEntityId).GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invMatrix) = _entityManager.GetComponent<TransformComponent>(grid.Owner).GetWorldPositionRotationMatrixWithInv();
|
||||||
|
|
||||||
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
var lCursorBox = invMatrix.TransformBox(cursorBox);
|
||||||
foreach (var (pos, list) in gridDict)
|
foreach (var (pos, list) in gridDict)
|
||||||
|
|||||||
@@ -141,14 +141,14 @@ public class DockingControl : Control
|
|||||||
foreach (var grid in _mapManager.FindGridsIntersecting(gridXform.MapID,
|
foreach (var grid in _mapManager.FindGridsIntersecting(gridXform.MapID,
|
||||||
new Box2(worldPos - _range, worldPos + _range)))
|
new Box2(worldPos - _range, worldPos + _range)))
|
||||||
{
|
{
|
||||||
if (grid.GridEntityId == GridEntity)
|
if (grid.Owner == GridEntity)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw the fixtures before drawing any docks in range.
|
// Draw the fixtures before drawing any docks in range.
|
||||||
if (!_entManager.TryGetComponent<FixturesComponent>(grid.GridEntityId, out var gridFixtures))
|
if (!_entManager.TryGetComponent<FixturesComponent>(grid.Owner, out var gridFixtures))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var gridMatrix = xformQuery.GetComponent(grid.GridEntityId).WorldMatrix;
|
var gridMatrix = xformQuery.GetComponent(grid.Owner).WorldMatrix;
|
||||||
|
|
||||||
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);
|
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ public class DockingControl : Control
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw any docks on that grid
|
// Draw any docks on that grid
|
||||||
if (Docks.TryGetValue(grid.GridEntityId, out var gridDocks))
|
if (Docks.TryGetValue(grid.Owner, out var gridDocks))
|
||||||
{
|
{
|
||||||
foreach (var dock in gridDocks)
|
foreach (var dock in gridDocks)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -202,17 +202,17 @@ public sealed class RadarControl : Control
|
|||||||
foreach (var grid in _mapManager.FindGridsIntersecting(mapPosition.MapId,
|
foreach (var grid in _mapManager.FindGridsIntersecting(mapPosition.MapId,
|
||||||
new Box2(mapPosition.Position - MaxRadarRange, mapPosition.Position + MaxRadarRange)))
|
new Box2(mapPosition.Position - MaxRadarRange, mapPosition.Position + MaxRadarRange)))
|
||||||
{
|
{
|
||||||
if (grid.GridEntityId == ourGridId)
|
if (grid.Owner == ourGridId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var gridBody = bodyQuery.GetComponent(grid.GridEntityId);
|
var gridBody = bodyQuery.GetComponent(grid.Owner);
|
||||||
if (gridBody.Mass < 10f)
|
if (gridBody.Mass < 10f)
|
||||||
{
|
{
|
||||||
ClearLabel(grid.GridEntityId);
|
ClearLabel(grid.Owner);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_entManager.TryGetComponent<IFFComponent>(grid.GridEntityId, out var iff);
|
_entManager.TryGetComponent<IFFComponent>(grid.Owner, out var iff);
|
||||||
|
|
||||||
// Hide it entirely.
|
// Hide it entirely.
|
||||||
if (iff != null &&
|
if (iff != null &&
|
||||||
@@ -221,14 +221,14 @@ public sealed class RadarControl : Control
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
shown.Add(grid.GridEntityId);
|
shown.Add(grid.Owner);
|
||||||
var name = metaQuery.GetComponent(grid.GridEntityId).EntityName;
|
var name = metaQuery.GetComponent(grid.Owner).EntityName;
|
||||||
|
|
||||||
if (name == string.Empty)
|
if (name == string.Empty)
|
||||||
name = Loc.GetString("shuttle-console-unknown");
|
name = Loc.GetString("shuttle-console-unknown");
|
||||||
|
|
||||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
var gridXform = xformQuery.GetComponent(grid.Owner);
|
||||||
var gridFixtures = fixturesQuery.GetComponent(grid.GridEntityId);
|
var gridFixtures = fixturesQuery.GetComponent(grid.Owner);
|
||||||
var gridMatrix = gridXform.WorldMatrix;
|
var gridMatrix = gridXform.WorldMatrix;
|
||||||
Matrix3.Multiply(in gridMatrix, in offsetMatrix, out var matty);
|
Matrix3.Multiply(in gridMatrix, in offsetMatrix, out var matty);
|
||||||
var color = iff?.Color ?? IFFComponent.IFFColor;
|
var color = iff?.Color ?? IFFComponent.IFFColor;
|
||||||
@@ -240,14 +240,14 @@ public sealed class RadarControl : Control
|
|||||||
var gridBounds = grid.LocalAABB;
|
var gridBounds = grid.LocalAABB;
|
||||||
Label label;
|
Label label;
|
||||||
|
|
||||||
if (!_iffControls.TryGetValue(grid.GridEntityId, out var control))
|
if (!_iffControls.TryGetValue(grid.Owner, out var control))
|
||||||
{
|
{
|
||||||
label = new Label()
|
label = new Label()
|
||||||
{
|
{
|
||||||
HorizontalAlignment = HAlignment.Left,
|
HorizontalAlignment = HAlignment.Left,
|
||||||
};
|
};
|
||||||
|
|
||||||
_iffControls[grid.GridEntityId] = label;
|
_iffControls[grid.Owner] = label;
|
||||||
AddChild(label);
|
AddChild(label);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -277,13 +277,13 @@ public sealed class RadarControl : Control
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClearLabel(grid.GridEntityId);
|
ClearLabel(grid.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detailed view
|
// Detailed view
|
||||||
DrawGrid(handle, matty, gridFixtures, color);
|
DrawGrid(handle, matty, gridFixtures, color);
|
||||||
|
|
||||||
DrawDocks(handle, grid.GridEntityId, matty);
|
DrawDocks(handle, grid.Owner, matty);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (ent, _) in _iffControls)
|
foreach (var (ent, _) in _iffControls)
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
|
|
||||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||||
{
|
{
|
||||||
coordinates = EntityCoordinates.FromMap(grid.GridEntityId, mousePos, EntityManager);
|
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, EntityManager);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -138,7 +138,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
||||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||||
{
|
{
|
||||||
coordinates = EntityCoordinates.FromMap(grid.GridEntityId, mousePos, EntityManager);
|
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, EntityManager);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -179,7 +179,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
||||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||||
{
|
{
|
||||||
coordinates = EntityCoordinates.FromMap(grid.GridEntityId, mousePos, EntityManager);
|
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, EntityManager);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ we are just going to end this here to save a lot of time. This is the exception
|
|||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
mapData.MapId = mapManager.CreateMap();
|
mapData.MapId = mapManager.CreateMap();
|
||||||
mapData.MapGrid = mapManager.CreateGrid(mapData.MapId);
|
mapData.MapGrid = mapManager.CreateGrid(mapData.MapId);
|
||||||
mapData.GridCoords = new EntityCoordinates(mapData.MapGrid.GridEntityId, 0, 0);
|
mapData.GridCoords = new EntityCoordinates(mapData.MapGrid.Owner, 0, 0);
|
||||||
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||||
var plating = tileDefinitionManager["Plating"];
|
var plating = tileDefinitionManager["Plating"];
|
||||||
var platingTile = new Tile(plating.TileId);
|
var platingTile = new Tile(plating.TileId);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public sealed class CargoTest
|
|||||||
{
|
{
|
||||||
var mapId = mapManager.CreateMap();
|
var mapId = mapManager.CreateMap();
|
||||||
var grid = mapManager.CreateGrid(mapId);
|
var grid = mapManager.CreateGrid(mapId);
|
||||||
var coord = new EntityCoordinates(grid.GridEntityId, 0, 0);
|
var coord = new EntityCoordinates(grid.Owner, 0, 0);
|
||||||
|
|
||||||
var protoIds = protoManager.EnumeratePrototypes<EntityPrototype>()
|
var protoIds = protoManager.EnumeratePrototypes<EntityPrototype>()
|
||||||
.Where(p=>!p.Abstract)
|
.Where(p=>!p.Abstract)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
{
|
{
|
||||||
var mapId = mapManager.CreateMap();
|
var mapId = mapManager.CreateMap();
|
||||||
var grid = mapManager.CreateGrid(mapId);
|
var grid = mapManager.CreateGrid(mapId);
|
||||||
var coord = new EntityCoordinates(grid.GridEntityId, 0, 0);
|
var coord = new EntityCoordinates(grid.Owner, 0, 0);
|
||||||
entityMan.SpawnEntity(protoId, coord);
|
entityMan.SpawnEntity(protoId, coord);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
.ToList();
|
.ToList();
|
||||||
var mapId = mapManager.CreateMap();
|
var mapId = mapManager.CreateMap();
|
||||||
var grid = mapManager.CreateGrid(mapId);
|
var grid = mapManager.CreateGrid(mapId);
|
||||||
var coord = new EntityCoordinates(grid.GridEntityId, 0, 0);
|
var coord = new EntityCoordinates(grid.Owner, 0, 0);
|
||||||
foreach (var protoId in protoIds)
|
foreach (var protoId in protoIds)
|
||||||
{
|
{
|
||||||
entityMan.SpawnEntity(protoId, coord);
|
entityMan.SpawnEntity(protoId, coord);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public sealed class FluidSpill
|
|||||||
{
|
{
|
||||||
mapId = mapManager.CreateMap();
|
mapId = mapManager.CreateMap();
|
||||||
var grid = mapManager.CreateGrid(mapId);
|
var grid = mapManager.CreateGrid(mapId);
|
||||||
gridId = grid.GridEntityId;
|
gridId = grid.Owner;
|
||||||
|
|
||||||
for (var x = 0; x < 3; x++)
|
for (var x = 0; x < 3; x++)
|
||||||
{
|
{
|
||||||
@@ -125,7 +125,7 @@ public sealed class FluidSpill
|
|||||||
{
|
{
|
||||||
mapId = mapManager.CreateMap();
|
mapId = mapManager.CreateMap();
|
||||||
var grid = mapManager.CreateGrid(mapId);
|
var grid = mapManager.CreateGrid(mapId);
|
||||||
gridId = grid.GridEntityId;
|
gridId = grid.Owner;
|
||||||
|
|
||||||
for (var x = 0; x < 3; x++)
|
for (var x = 0; x < 3; x++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ 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.GridEntityId;
|
sGridId = sGrid.Owner;
|
||||||
metaSystem.SetEntityPaused(sGridId, true); // See https://github.com/space-wizards/RobustToolbox/issues/1444
|
metaSystem.SetEntityPaused(sGridId, true); // See https://github.com/space-wizards/RobustToolbox/issues/1444
|
||||||
|
|
||||||
var tileDefinition = sTileDefinitionManager["UnderPlating"];
|
var tileDefinition = sTileDefinitionManager["UnderPlating"];
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
Assert.That(generatorComponent.GravityActive, Is.True);
|
Assert.That(generatorComponent.GravityActive, Is.True);
|
||||||
|
|
||||||
var grid1Entity = grid1.GridEntityId;
|
var grid1Entity = grid1.Owner;
|
||||||
var grid2Entity = grid2.GridEntityId;
|
var grid2Entity = grid2.Owner;
|
||||||
|
|
||||||
Assert.That(!entityMan.GetComponent<GravityComponent>(grid1Entity).EnabledVV);
|
Assert.That(!entityMan.GetComponent<GravityComponent>(grid1Entity).EnabledVV);
|
||||||
Assert.That(entityMan.GetComponent<GravityComponent>(grid2Entity).EnabledVV);
|
Assert.That(entityMan.GetComponent<GravityComponent>(grid2Entity).EnabledVV);
|
||||||
@@ -87,7 +87,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
Assert.That(generatorComponent.GravityActive, Is.False);
|
Assert.That(generatorComponent.GravityActive, Is.False);
|
||||||
|
|
||||||
var grid2Entity = grid2.GridEntityId;
|
var grid2Entity = grid2.Owner;
|
||||||
|
|
||||||
Assert.That(entityMan.GetComponent<GravityComponent>(grid2Entity).EnabledVV, Is.False);
|
Assert.That(entityMan.GetComponent<GravityComponent>(grid2Entity).EnabledVV, Is.False);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -202,11 +202,11 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var memberQuery = entManager.GetEntityQuery<StationMemberComponent>();
|
var memberQuery = entManager.GetEntityQuery<StationMemberComponent>();
|
||||||
|
|
||||||
var grids = mapManager.GetAllMapGrids(mapId).ToList();
|
var grids = mapManager.GetAllMapGrids(mapId).ToList();
|
||||||
var gridUids = grids.Select(o => o.GridEntityId).ToList();
|
var gridUids = grids.Select(o => o.Owner).ToList();
|
||||||
|
|
||||||
foreach (var grid in grids)
|
foreach (var grid in grids)
|
||||||
{
|
{
|
||||||
if (!memberQuery.HasComponent(grid.GridEntityId))
|
if (!memberQuery.HasComponent(grid.Owner))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var area = grid.LocalAABB.Width * grid.LocalAABB.Height;
|
var area = grid.LocalAABB.Width * grid.LocalAABB.Height;
|
||||||
@@ -214,7 +214,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
if (area > largest)
|
if (area > largest)
|
||||||
{
|
{
|
||||||
largest = area;
|
largest = area;
|
||||||
targetGrid = grid.GridEntityId;
|
targetGrid = grid.Owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
{
|
{
|
||||||
var mapGrid = mapManager.CreateGrid(mapId);
|
var mapGrid = mapManager.CreateGrid(mapId);
|
||||||
var mapGridEnt = mapGrid.GridEntityId;
|
var mapGridEnt = mapGrid.Owner;
|
||||||
sEntities.GetComponent<TransformComponent>(mapGridEnt).WorldPosition = new Vector2(10, 10);
|
sEntities.GetComponent<TransformComponent>(mapGridEnt).WorldPosition = new Vector2(10, 10);
|
||||||
mapGrid.SetTile(new Vector2i(0,0), new Tile(1, (TileRenderFlag)1, 255));
|
mapGrid.SetTile(new Vector2i(0,0), new Tile(1, (TileRenderFlag)1, 255));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var mapGrid = mapManager.CreateGrid(mapId);
|
var mapGrid = mapManager.CreateGrid(mapId);
|
||||||
var mapGridEnt = mapGrid.GridEntityId;
|
var mapGridEnt = mapGrid.Owner;
|
||||||
sEntities.GetComponent<TransformComponent>(mapGridEnt).WorldPosition = new Vector2(-8, -8);
|
sEntities.GetComponent<TransformComponent>(mapGridEnt).WorldPosition = new Vector2(-8, -8);
|
||||||
mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, (TileRenderFlag)1, 254));
|
mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, (TileRenderFlag)1, 254));
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(10, 10), out var mapGrid) ||
|
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(10, 10), out var mapGrid) ||
|
||||||
!sEntities.TryGetComponent<TransformComponent>(mapGrid.GridEntityId, out var gridXform))
|
!sEntities.TryGetComponent<TransformComponent>(mapGrid.Owner, out var gridXform))
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
Assert.Fail();
|
||||||
return;
|
return;
|
||||||
@@ -73,7 +73,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(-8, -8), out var mapGrid) ||
|
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(-8, -8), out var mapGrid) ||
|
||||||
!sEntities.TryGetComponent<TransformComponent>(mapGrid.GridEntityId, out var gridXform))
|
!sEntities.TryGetComponent<TransformComponent>(mapGrid.Owner, out var gridXform))
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
Assert.Fail();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var mapId0 = mapManager.CreateMap();
|
var mapId0 = mapManager.CreateMap();
|
||||||
// TODO: Properly find the "main" station grid.
|
// TODO: Properly find the "main" station grid.
|
||||||
var grid0 = mapManager.CreateGrid(mapId0);
|
var grid0 = mapManager.CreateGrid(mapId0);
|
||||||
mapLoader.Save(grid0.GridEntityId, "save load save 1.yml");
|
mapLoader.Save(grid0.Owner, "save load save 1.yml");
|
||||||
var mapId1 = mapManager.CreateMap();
|
var mapId1 = mapManager.CreateMap();
|
||||||
var grid1 = mapLoader.LoadGrid(mapId1, "save load save 1.yml", new MapLoadOptions() {LoadMap = false});
|
var grid1 = mapLoader.LoadGrid(mapId1, "save load save 1.yml", new MapLoadOptions() {LoadMap = false});
|
||||||
mapLoader.Save(grid1!.Value, "save load save 2.yml");
|
mapLoader.Save(grid1!.Value, "save load save 2.yml");
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
{
|
{
|
||||||
var mapId = mapMan.CreateMap();
|
var mapId = mapMan.CreateMap();
|
||||||
var grid = mapMan.CreateGrid(mapId);
|
var grid = mapMan.CreateGrid(mapId);
|
||||||
gridEnt = grid.GridEntityId;
|
gridEnt = grid.Owner;
|
||||||
|
|
||||||
Assert.That(sEntities.HasComponent<ShuttleComponent>(gridEnt));
|
Assert.That(sEntities.HasComponent<ShuttleComponent>(gridEnt));
|
||||||
Assert.That(sEntities.TryGetComponent<PhysicsComponent>(gridEnt, out var physicsComponent));
|
Assert.That(sEntities.TryGetComponent<PhysicsComponent>(gridEnt, out var physicsComponent));
|
||||||
|
|||||||
@@ -49,19 +49,19 @@ namespace Content.MapRenderer.Painters
|
|||||||
var stopwatch = new Stopwatch();
|
var stopwatch = new Stopwatch();
|
||||||
stopwatch.Start();
|
stopwatch.Start();
|
||||||
|
|
||||||
if (!_entities.TryGetValue(grid.GridEntityId, out var entities))
|
if (!_entities.TryGetValue(grid.Owner, out var entities))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"No entities found on grid {grid.GridEntityId}");
|
Console.WriteLine($"No entities found on grid {grid.Owner}");
|
||||||
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.GridEntityId, out var decals))
|
if (_decals.TryGetValue(grid.Owner, 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.GridEntityId} in {(int) stopwatch.Elapsed.TotalMilliseconds} ms");
|
Console.WriteLine($"{nameof(GridPainter)} painted grid {grid.Owner} in {(int) stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConcurrentDictionary<EntityUid, List<EntityData>> GetEntities()
|
private ConcurrentDictionary<EntityUid, List<EntityData>> GetEntities()
|
||||||
@@ -120,14 +120,14 @@ namespace Content.MapRenderer.Painters
|
|||||||
// actually has the correct z-indices for decals for some reason when the server doesn't,
|
// actually has the correct z-indices for decals for some reason when the server doesn't,
|
||||||
// BUT can't do that yet because the client hasn't actually received everything yet
|
// BUT can't do that yet because the client hasn't actually received everything yet
|
||||||
// for some reason decal moment i guess.
|
// for some reason decal moment i guess.
|
||||||
if (_sEntityManager.TryGetComponent<DecalGridComponent>(grid.GridEntityId, out var comp))
|
if (_sEntityManager.TryGetComponent<DecalGridComponent>(grid.Owner, out var comp))
|
||||||
{
|
{
|
||||||
foreach (var (_, list) in comp.ChunkCollection.ChunkCollection)
|
foreach (var (_, list) in comp.ChunkCollection.ChunkCollection)
|
||||||
{
|
{
|
||||||
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.GridEntityId).Add(new DecalData(decal, x, y));
|
decals.GetOrNew(grid.Owner).Add(new DecalData(decal, x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
|
|
||||||
foreach (var grid in grids)
|
foreach (var grid in grids)
|
||||||
{
|
{
|
||||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
var gridXform = xformQuery.GetComponent(grid.Owner);
|
||||||
gridXform.WorldRotation = Angle.Zero;
|
gridXform.WorldRotation = Angle.Zero;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -90,7 +90,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
// Skip empty grids
|
// Skip empty grids
|
||||||
if (grid.LocalAABB.IsEmpty())
|
if (grid.LocalAABB.IsEmpty())
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Warning: Grid {grid.GridEntityId} was empty. Skipping image rendering.");
|
Console.WriteLine($"Warning: Grid {grid.Owner} was empty. Skipping image rendering.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,8 +119,8 @@ namespace Content.MapRenderer.Painters
|
|||||||
|
|
||||||
var renderedImage = new RenderedGridImage<Rgba32>(gridCanvas)
|
var renderedImage = new RenderedGridImage<Rgba32>(gridCanvas)
|
||||||
{
|
{
|
||||||
GridUid = grid.GridEntityId,
|
GridUid = grid.Owner,
|
||||||
Offset = xformQuery.GetComponent(grid.GridEntityId).WorldPosition
|
Offset = xformQuery.GetComponent(grid.Owner).WorldPosition
|
||||||
};
|
};
|
||||||
|
|
||||||
yield return renderedImage;
|
yield return renderedImage;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
i++;
|
i++;
|
||||||
});
|
});
|
||||||
|
|
||||||
Console.WriteLine($"{nameof(TilePainter)} painted {i} tiles on grid {grid.GridEntityId} in {(int) stopwatch.Elapsed.TotalMilliseconds} ms");
|
Console.WriteLine($"{nameof(TilePainter)} painted {i} tiles on grid {grid.Owner} in {(int) stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, List<Image>> GetTileImages(
|
private Dictionary<string, List<Image>> GetTileImages(
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Server.AME
|
|||||||
if (_entMan.TryGetComponent(nodeOwner, out AMEShieldComponent? shield))
|
if (_entMan.TryGetComponent(nodeOwner, out AMEShieldComponent? shield))
|
||||||
{
|
{
|
||||||
var xform = _entMan.GetComponent<TransformComponent>(nodeOwner);
|
var xform = _entMan.GetComponent<TransformComponent>(nodeOwner);
|
||||||
if (xform.GridUid != grid?.GridEntityId && !mapManager.TryGetGrid(xform.GridUid, out grid))
|
if (xform.GridUid != grid?.Owner && !mapManager.TryGetGrid(xform.GridUid, out grid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (grid == null)
|
if (grid == null)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Commands
|
|||||||
|
|
||||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
foreach (var tile in atmosphereSystem.GetAllMixtures(grid.GridEntityId, true))
|
foreach (var tile in atmosphereSystem.GetAllMixtures(grid.Owner, true))
|
||||||
{
|
{
|
||||||
tile.AdjustMoles(gasId, moles);
|
tile.AdjustMoles(gasId, moles);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Content.Server.Atmos.Commands
|
|||||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
var tiles = 0;
|
var tiles = 0;
|
||||||
foreach (var tile in atmosphereSystem.GetAllMixtures(gridComp.GridEntityId, true))
|
foreach (var tile in atmosphereSystem.GetAllMixtures(gridComp.Owner, true))
|
||||||
{
|
{
|
||||||
tiles++;
|
tiles++;
|
||||||
tile.Temperature = temperature;
|
tile.Temperature = temperature;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Content.Server.Atmos.Commands
|
|||||||
var atmospheres = _entities.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
|
var atmospheres = _entities.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
|
||||||
var indices = new Vector2i(x, y);
|
var indices = new Vector2i(x, y);
|
||||||
|
|
||||||
var tile = atmospheres.GetTileMixture(grid.GridEntityId, null, indices, true);
|
var tile = atmospheres.GetTileMixture(grid.Owner, null, indices, true);
|
||||||
|
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
// If the grid is deleting no point updating atmos.
|
// If the grid is deleting no point updating atmos.
|
||||||
if (_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
if (_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||||
{
|
{
|
||||||
if (MetaData(grid.GridEntityId).EntityLifeStage > EntityLifeStage.MapInitialized) return;
|
if (MetaData(grid.Owner).EntityLifeStage > EntityLifeStage.MapInitialized) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAirblocked(airtight, false, xform);
|
SetAirblocked(airtight, false, xform);
|
||||||
@@ -114,7 +114,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var gridUid = grid.GridEntityId;
|
var gridUid = grid.Owner;
|
||||||
|
|
||||||
var query = EntityManager.GetEntityQuery<AirtightComponent>();
|
var query = EntityManager.GetEntityQuery<AirtightComponent>();
|
||||||
_explosionSystem.UpdateAirtightMap(gridId, pos, query);
|
_explosionSystem.UpdateAirtightMap(gridId, pos, query);
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds))
|
foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds))
|
||||||
{
|
{
|
||||||
var uid = grid.GridEntityId;
|
var uid = grid.Owner;
|
||||||
|
|
||||||
if (!Exists(uid))
|
if (!Exists(uid))
|
||||||
continue;
|
continue;
|
||||||
@@ -160,7 +160,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RaiseNetworkEvent(new AtmosDebugOverlayMessage(grid.GridEntityId, baseTile, debugOverlayContent), session.ConnectedClient);
|
RaiseNetworkEvent(new AtmosDebugOverlayMessage(grid.Owner, baseTile, debugOverlayContent), session.ConnectedClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,12 +128,12 @@ public sealed partial class AtmosphereSystem
|
|||||||
if (playerMap == null)
|
if (playerMap == null)
|
||||||
return CompletionResult.FromOptions(options);
|
return CompletionResult.FromOptions(options);
|
||||||
|
|
||||||
foreach (var grid in _mapManager.GetAllMapGrids(playerMap.Value).OrderBy(o => o.GridEntityId))
|
foreach (var grid in _mapManager.GetAllMapGrids(playerMap.Value).OrderBy(o => o.Owner))
|
||||||
{
|
{
|
||||||
if (!TryComp<TransformComponent>(grid.GridEntityId, out var gridXform))
|
if (!TryComp<TransformComponent>(grid.Owner, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
options.Add(new CompletionOption(grid.GridEntityId.ToString(), $"{MetaData(grid.GridEntityId).EntityName} - Map {gridXform.MapID}"));
|
options.Add(new CompletionOption(grid.Owner.ToString(), $"{MetaData(grid.Owner).EntityName} - Map {gridXform.MapID}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompletionResult.FromOptions(options);
|
return CompletionResult.FromOptions(options);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
if (!_mapManager.TryGetGrid(newGrid, out var mapGrid))
|
if (!_mapManager.TryGetGrid(newGrid, out var mapGrid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var entity = mapGrid.GridEntityId;
|
var entity = mapGrid.Owner;
|
||||||
|
|
||||||
// If the new split grid has an atmosphere already somehow, use that. Otherwise, add a new one.
|
// If the new split grid has an atmosphere already somehow, use that. Otherwise, add a new one.
|
||||||
if (!TryComp(entity, out GridAtmosphereComponent? newGridAtmos))
|
if (!TryComp(entity, out GridAtmosphereComponent? newGridAtmos))
|
||||||
@@ -555,7 +555,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
{
|
{
|
||||||
var ev = new UpdateAdjacentMethodEvent(uid, position);
|
var ev = new UpdateAdjacentMethodEvent(uid, position);
|
||||||
GridUpdateAdjacent(uid, gridAtmosphere, ref ev);
|
GridUpdateAdjacent(uid, gridAtmosphere, ref ev);
|
||||||
InvalidateVisuals(mapGrid.GridEntityId, position);
|
InvalidateVisuals(mapGrid.Owner, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
var direction = ((Vector2)_depressurizeTiles[tileCount - 1].GridIndices - tile.GridIndices).Normalized;
|
var direction = ((Vector2)_depressurizeTiles[tileCount - 1].GridIndices - tile.GridIndices).Normalized;
|
||||||
|
|
||||||
var gridPhysics = Comp<PhysicsComponent>(mapGrid.GridEntityId);
|
var gridPhysics = Comp<PhysicsComponent>(mapGrid.Owner);
|
||||||
|
|
||||||
// TODO ATMOS: Come up with better values for these.
|
// TODO ATMOS: Come up with better values for these.
|
||||||
gridPhysics.ApplyLinearImpulse(direction * totalMolesRemoved * gridPhysics.Mass);
|
gridPhysics.ApplyLinearImpulse(direction * totalMolesRemoved * gridPhysics.Mass);
|
||||||
@@ -522,10 +522,10 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!reconsiderAdjacent)
|
if (!reconsiderAdjacent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tileEv = new UpdateAdjacentMethodEvent(mapGrid.GridEntityId, tile.GridIndices);
|
var tileEv = new UpdateAdjacentMethodEvent(mapGrid.Owner, tile.GridIndices);
|
||||||
var otherEv = new UpdateAdjacentMethodEvent(mapGrid.GridEntityId, other.GridIndices);
|
var otherEv = new UpdateAdjacentMethodEvent(mapGrid.Owner, other.GridIndices);
|
||||||
GridUpdateAdjacent(mapGrid.GridEntityId, gridAtmosphere, ref tileEv);
|
GridUpdateAdjacent(mapGrid.Owner, gridAtmosphere, ref tileEv);
|
||||||
GridUpdateAdjacent(mapGrid.GridEntityId, gridAtmosphere, ref otherEv);
|
GridUpdateAdjacent(mapGrid.Owner, gridAtmosphere, ref otherEv);
|
||||||
InvalidateVisuals(tile.GridIndex, tile.GridIndices);
|
InvalidateVisuals(tile.GridIndex, tile.GridIndices);
|
||||||
InvalidateVisuals(other.GridIndex, other.GridIndices);
|
InvalidateVisuals(other.GridIndex, other.GridIndices);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!TryComp(uid, out MapGridComponent? mapGridComp))
|
if (!TryComp(uid, out MapGridComponent? mapGridComp))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var mapUid = _mapManager.GetMapEntityIdOrThrow(Transform(mapGridComp.Owner).MapID);
|
var mapUid = _mapManager.GetMapEntityIdOrThrow(Transform(((Component) mapGridComp).Owner).MapID);
|
||||||
|
|
||||||
var volume = GetVolumeForTiles(mapGridComp, 1);
|
var volume = GetVolumeForTiles(mapGridComp, 1);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
if (!atmosphere.Tiles.TryGetValue(indices, out var tile))
|
if (!atmosphere.Tiles.TryGetValue(indices, out var tile))
|
||||||
{
|
{
|
||||||
tile = new TileAtmosphere(mapGridComp.GridEntityId, indices,
|
tile = new TileAtmosphere(mapGridComp.Owner, indices,
|
||||||
new GasMixture(volume) { Temperature = Atmospherics.T20C });
|
new GasMixture(volume) { Temperature = Atmospherics.T20C });
|
||||||
atmosphere.Tiles[indices] = tile;
|
atmosphere.Tiles[indices] = tile;
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
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(mapGridComp.GridEntityId, indices);
|
InvalidateVisuals(mapGridComp.Owner, indices);
|
||||||
|
|
||||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ public sealed partial class CargoSystem
|
|||||||
|
|
||||||
foreach (var grid in _mapManager.GetAllMapGrids(xform.MapID))
|
foreach (var grid in _mapManager.GetAllMapGrids(xform.MapID))
|
||||||
{
|
{
|
||||||
var worldAABB = xformQuery.GetComponent(grid.GridEntityId).WorldMatrix.TransformBox(grid.LocalAABB);
|
var worldAABB = xformQuery.GetComponent(grid.Owner).WorldMatrix.TransformBox(grid.LocalAABB);
|
||||||
aabb = aabb?.Union(worldAABB) ?? worldAABB;
|
aabb = aabb?.Union(worldAABB) ?? worldAABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public sealed class PricingSystem : EntitySystem
|
|||||||
|
|
||||||
List<(double, EntityUid)> mostValuable = new();
|
List<(double, EntityUid)> mostValuable = new();
|
||||||
|
|
||||||
var value = AppraiseGrid(mapGrid.GridEntityId, null, (uid, price) =>
|
var value = AppraiseGrid(mapGrid.Owner, null, (uid, price) =>
|
||||||
{
|
{
|
||||||
mostValuable.Add((price, uid));
|
mostValuable.Add((price, uid));
|
||||||
mostValuable.Sort((i1, i2) => i2.Item1.CompareTo(i1.Item1));
|
mostValuable.Sort((i1, i2) => i2.Item1.CompareTo(i1.Item1));
|
||||||
|
|||||||
@@ -89,13 +89,13 @@ public sealed class ChunkingSystem : EntitySystem
|
|||||||
|
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(xform.MapID, bounds, true))
|
foreach (var grid in _mapManager.FindGridsIntersecting(xform.MapID, bounds, true))
|
||||||
{
|
{
|
||||||
if (!chunks.TryGetValue(grid.GridEntityId, out var set))
|
if (!chunks.TryGetValue(grid.Owner, out var set))
|
||||||
{
|
{
|
||||||
chunks[grid.GridEntityId] = set = indexPool.Get();
|
chunks[grid.Owner] = set = indexPool.Get();
|
||||||
DebugTools.Assert(set.Count == 0);
|
DebugTools.Assert(set.Count == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var enumerator = new ChunkIndicesEnumerator(_transform.GetInvWorldMatrix(grid.GridEntityId, xformQuery).TransformBox(bounds), chunkSize);
|
var enumerator = new ChunkIndicesEnumerator(_transform.GetInvWorldMatrix(grid.Owner, xformQuery).TransformBox(bounds), chunkSize);
|
||||||
|
|
||||||
while (enumerator.MoveNext(out var indices))
|
while (enumerator.MoveNext(out var indices))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entityManager.EntityExists(grid.GridEntityId))
|
if (!entityManager.EntityExists(grid.Owner))
|
||||||
{
|
{
|
||||||
shell.WriteError($"Grid {gridId} doesn't have an associated grid entity.");
|
shell.WriteError($"Grid {gridId} doesn't have an associated grid entity.");
|
||||||
return;
|
return;
|
||||||
@@ -65,7 +65,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
var changed = 0;
|
var changed = 0;
|
||||||
var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
||||||
|
|
||||||
foreach (var child in xformQuery.GetComponent(grid.GridEntityId).ChildEntities)
|
foreach (var child in xformQuery.GetComponent(grid.Owner).ChildEntities)
|
||||||
{
|
{
|
||||||
if (!entityManager.EntityExists(child))
|
if (!entityManager.EntityExists(child))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ sealed class TileReplaceCommand : IConsoleCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entityManager.EntityExists(grid.GridEntityId))
|
if (!entityManager.EntityExists(grid.Owner))
|
||||||
{
|
{
|
||||||
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entityManager.EntityExists(grid.GridEntityId))
|
if (!entityManager.EntityExists(grid.Owner))
|
||||||
{
|
{
|
||||||
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
||||||
return;
|
return;
|
||||||
@@ -68,7 +68,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
var underplating = tileDefinitionManager[TilePrototypeId];
|
var underplating = tileDefinitionManager[TilePrototypeId];
|
||||||
var underplatingTile = new Tile(underplating.TileId);
|
var underplatingTile = new Tile(underplating.TileId);
|
||||||
var changed = 0;
|
var changed = 0;
|
||||||
foreach (var child in entityManager.GetComponent<TransformComponent>(grid.GridEntityId).ChildEntities)
|
foreach (var child in entityManager.GetComponent<TransformComponent>(grid.Owner).ChildEntities)
|
||||||
{
|
{
|
||||||
if (!entityManager.EntityExists(child))
|
if (!entityManager.EntityExists(child))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Server.Decals.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var coordinates = new EntityCoordinates(grid.GridEntityId, new Vector2(x, y));
|
var coordinates = new EntityCoordinates(grid.Owner, new Vector2(x, y));
|
||||||
if (grid.GetTileRef(coordinates).IsSpace())
|
if (grid.GetTileRef(coordinates).IsSpace())
|
||||||
{
|
{
|
||||||
shell.WriteError($"Cannot create decal on space tile at {coordinates}.");
|
shell.WriteError($"Cannot create decal on space tile at {coordinates}.");
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (referenceGrid == Grid.GridEntityId)
|
if (referenceGrid == Grid.Owner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_needToTransform = true;
|
_needToTransform = true;
|
||||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Grid.GridEntityId);
|
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Grid.Owner);
|
||||||
var size = (float) Grid.TileSize;
|
var size = (float) Grid.TileSize;
|
||||||
|
|
||||||
_matrix.R0C2 = size / 2;
|
_matrix.R0C2 = size / 2;
|
||||||
|
|||||||
@@ -63,8 +63,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.GridEntityId))
|
if (!_airtightMap.ContainsKey(grid.Owner))
|
||||||
_airtightMap[grid.GridEntityId] = new();
|
_airtightMap[grid.Owner] = new();
|
||||||
|
|
||||||
query ??= EntityManager.GetEntityQuery<AirtightComponent>();
|
query ??= EntityManager.GetEntityQuery<AirtightComponent>();
|
||||||
var damageQuery = EntityManager.GetEntityQuery<DamageableComponent>();
|
var damageQuery = EntityManager.GetEntityQuery<DamageableComponent>();
|
||||||
@@ -84,9 +84,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (blockedDirections != AtmosDirection.Invalid)
|
if (blockedDirections != AtmosDirection.Invalid)
|
||||||
_airtightMap[grid.GridEntityId][tile] = new(tolerance, blockedDirections);
|
_airtightMap[grid.Owner][tile] = new(tolerance, blockedDirections);
|
||||||
else
|
else
|
||||||
_airtightMap[grid.GridEntityId].Remove(tile);
|
_airtightMap[grid.Owner].Remove(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
if (referenceGrid != null)
|
if (referenceGrid != null)
|
||||||
{
|
{
|
||||||
var targetGrid = _mapManager.GetGrid(referenceGrid.Value);
|
var targetGrid = _mapManager.GetGrid(referenceGrid.Value);
|
||||||
var xform = Transform(targetGrid.GridEntityId);
|
var xform = Transform(targetGrid.Owner);
|
||||||
targetAngle = xform.WorldRotation;
|
targetAngle = xform.WorldRotation;
|
||||||
targetMatrix = xform.InvWorldMatrix;
|
targetMatrix = xform.InvWorldMatrix;
|
||||||
tileSize = targetGrid.TileSize;
|
tileSize = targetGrid.TileSize;
|
||||||
@@ -93,7 +93,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
|
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
|
||||||
var xform = xforms.GetComponent(grid.GridEntityId);
|
var xform = xforms.GetComponent(grid.Owner);
|
||||||
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
||||||
|
|
||||||
var localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position);
|
var localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position);
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ sealed class Explosion
|
|||||||
_explosionData.Add(new()
|
_explosionData.Add(new()
|
||||||
{
|
{
|
||||||
TileLists = grid.TileLists,
|
TileLists = grid.TileLists,
|
||||||
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.Owner),
|
Lookup = entMan.GetComponent<BroadphaseComponent>(((Component) grid.Grid).Owner),
|
||||||
MapGrid = grid.Grid
|
MapGrid = grid.Grid
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -678,7 +678,7 @@ sealed class Explosion
|
|||||||
_currentDataIndex++;
|
_currentDataIndex++;
|
||||||
|
|
||||||
// sanity checks, in case something changed while the explosion was being processed over several ticks.
|
// sanity checks, in case something changed while the explosion was being processed over several ticks.
|
||||||
if (_currentLookup.Deleted || _currentGrid != null && !_entMan.EntityExists(_currentGrid.GridEntityId))
|
if (_currentLookup.Deleted || _currentGrid != null && !_entMan.EntityExists(_currentGrid.Owner))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -799,7 +799,7 @@ sealed class Explosion
|
|||||||
|
|
||||||
foreach (var (grid, list) in _tileUpdateDict)
|
foreach (var (grid, list) in _tileUpdateDict)
|
||||||
{
|
{
|
||||||
if (list.Count > 0 && _entMan.EntityExists(grid.GridEntityId))
|
if (list.Count > 0 && _entMan.EntityExists(grid.Owner))
|
||||||
{
|
{
|
||||||
grid.SetTiles(list);
|
grid.SetTiles(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,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.GridEntityId;
|
epicentreGrid = candidateGrid.Owner;
|
||||||
initialTile = tileRef.GridIndices;
|
initialTile = tileRef.GridIndices;
|
||||||
}
|
}
|
||||||
else if (referenceGrid != null)
|
else if (referenceGrid != null)
|
||||||
@@ -85,7 +85,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
var spaceAngle = Angle.Zero;
|
var spaceAngle = Angle.Zero;
|
||||||
if (referenceGrid != null)
|
if (referenceGrid != null)
|
||||||
{
|
{
|
||||||
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).GridEntityId);
|
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner);
|
||||||
spaceMatrix = xform.WorldMatrix;
|
spaceMatrix = xform.WorldMatrix;
|
||||||
spaceAngle = xform.WorldRotation;
|
spaceAngle = xform.WorldRotation;
|
||||||
}
|
}
|
||||||
@@ -276,10 +276,10 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
|
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(epicenter.MapId, box))
|
foreach (var grid in _mapManager.FindGridsIntersecting(epicenter.MapId, box))
|
||||||
{
|
{
|
||||||
if (TryComp(grid.GridEntityId, out PhysicsComponent? physics) && physics.Mass > mass)
|
if (TryComp(grid.Owner, out PhysicsComponent? physics) && physics.Mass > mass)
|
||||||
{
|
{
|
||||||
mass = physics.Mass;
|
mass = physics.Mass;
|
||||||
referenceGrid = grid.GridEntityId;
|
referenceGrid = grid.Owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +295,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.GridEntityId).ToList();
|
var grids = mapGrids.Select(x => x.Owner).ToList();
|
||||||
|
|
||||||
if (referenceGrid != null)
|
if (referenceGrid != null)
|
||||||
return (grids, referenceGrid, radius);
|
return (grids, referenceGrid, radius);
|
||||||
@@ -303,10 +303,10 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
// We still don't have are reference grid. So lets also look in the enlarged region
|
// We still don't have are reference grid. So lets also look in the enlarged region
|
||||||
foreach (var grid in mapGrids)
|
foreach (var grid in mapGrids)
|
||||||
{
|
{
|
||||||
if (TryComp(grid.GridEntityId, out PhysicsComponent? physics) && physics.Mass > mass)
|
if (TryComp(grid.Owner, out PhysicsComponent? physics) && physics.Mass > mass)
|
||||||
{
|
{
|
||||||
mass = physics.Mass;
|
mass = physics.Mass;
|
||||||
referenceGrid = grid.GridEntityId;
|
referenceGrid = grid.Owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
|
|||||||
foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds))
|
foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds))
|
||||||
{
|
{
|
||||||
var data = new List<PuddleDebugOverlayData>();
|
var data = new List<PuddleDebugOverlayData>();
|
||||||
var gridUid = grid.GridEntityId;
|
var gridUid = grid.Owner;
|
||||||
|
|
||||||
if (!Exists(gridUid))
|
if (!Exists(gridUid))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -312,13 +312,13 @@ namespace Content.Server.GameTicking
|
|||||||
{
|
{
|
||||||
foreach (var grid in _mapManager.GetAllGrids())
|
foreach (var grid in _mapManager.GetAllGrids())
|
||||||
{
|
{
|
||||||
if (!metaQuery.TryGetComponent(grid.GridEntityId, out var meta) ||
|
if (!metaQuery.TryGetComponent(grid.Owner, out var meta) ||
|
||||||
meta.EntityPaused)
|
meta.EntityPaused)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_possiblePositions.Add(new EntityCoordinates(grid.GridEntityId, Vector2.Zero));
|
_possiblePositions.Add(new EntityCoordinates(grid.Owner, Vector2.Zero));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,9 +332,9 @@ namespace Content.Server.GameTicking
|
|||||||
|
|
||||||
if (_mapManager.TryFindGridAt(toMap, out var foundGrid))
|
if (_mapManager.TryFindGridAt(toMap, out var foundGrid))
|
||||||
{
|
{
|
||||||
var gridXform = Transform(foundGrid.GridEntityId);
|
var gridXform = Transform(foundGrid.Owner);
|
||||||
|
|
||||||
return new EntityCoordinates(foundGrid.GridEntityId,
|
return new EntityCoordinates(foundGrid.Owner,
|
||||||
gridXform.InvWorldMatrix.Transform(toMap.Position));
|
gridXform.InvWorldMatrix.Transform(toMap.Position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -596,13 +596,13 @@ public sealed partial class PathfindingSystem
|
|||||||
var polyData = points[x * SubStep + poly.Left, y * SubStep + poly.Bottom].Data;
|
var polyData = points[x * SubStep + poly.Left, y * SubStep + poly.Bottom].Data;
|
||||||
|
|
||||||
var neighbors = new HashSet<PathPoly>();
|
var neighbors = new HashSet<PathPoly>();
|
||||||
tilePoly.Add(new PathPoly(grid.GridEntityId, chunk.Origin, GetIndex(x, y), box, polyData, neighbors));
|
tilePoly.Add(new PathPoly(grid.Owner, chunk.Origin, GetIndex(x, y), box, polyData, neighbors));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// _sawmill.Debug($"Built breadcrumbs in {sw.Elapsed.TotalMilliseconds}ms");
|
// _sawmill.Debug($"Built breadcrumbs in {sw.Elapsed.TotalMilliseconds}ms");
|
||||||
SendBreadcrumbs(chunk, grid.GridEntityId);
|
SendBreadcrumbs(chunk, grid.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public sealed partial class NPCCombatSystem
|
|||||||
|
|
||||||
if (_mapManager.TryFindGridAt(xform.MapID, targetPos, out var mapGrid))
|
if (_mapManager.TryFindGridAt(xform.MapID, targetPos, out var mapGrid))
|
||||||
{
|
{
|
||||||
targetCordinates = new EntityCoordinates(mapGrid.GridEntityId, mapGrid.WorldToLocal(targetSpot));
|
targetCordinates = new EntityCoordinates(mapGrid.Owner, mapGrid.WorldToLocal(targetSpot));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ namespace Content.Server.Physics.Controllers
|
|||||||
foreach (var entity in comp.Intersecting)
|
foreach (var entity in comp.Intersecting)
|
||||||
{
|
{
|
||||||
if (!xformQuery.TryGetComponent(entity, out var entityXform) ||
|
if (!xformQuery.TryGetComponent(entity, out var entityXform) ||
|
||||||
entityXform.ParentUid != grid.GridEntityId)
|
entityXform.ParentUid != grid.Owner)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ namespace Content.Server.Physics.Controllers
|
|||||||
var gridId = xform.GridUid;
|
var gridId = xform.GridUid;
|
||||||
// This tries to see if the grid is a shuttle and if the console should work.
|
// This tries to see if the grid is a shuttle and if the console should work.
|
||||||
if (!_mapManager.TryGetGrid(gridId, out var grid) ||
|
if (!_mapManager.TryGetGrid(gridId, out var grid) ||
|
||||||
!EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttleComponent) ||
|
!EntityManager.TryGetComponent(grid.Owner, out ShuttleComponent? shuttleComponent) ||
|
||||||
!shuttleComponent.Enabled) continue;
|
!shuttleComponent.Enabled) continue;
|
||||||
|
|
||||||
if (!newPilots.TryGetValue(shuttleComponent, out var pilots))
|
if (!newPilots.TryGetValue(shuttleComponent, out var pilots))
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Content.Server.Power.EntitySystems
|
|||||||
// If grid deleting no need to update power.
|
// If grid deleting no need to update power.
|
||||||
if (_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
if (_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||||
{
|
{
|
||||||
if (MetaData(grid.GridEntityId).EntityLifeStage > EntityLifeStage.MapInitialized) return;
|
if (MetaData(grid.Owner).EntityLifeStage > EntityLifeStage.MapInitialized) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Disconnect(uid, provider);
|
Disconnect(uid, provider);
|
||||||
|
|||||||
@@ -139,12 +139,12 @@ namespace Content.Server.RCD.Systems
|
|||||||
case RcdMode.Walls:
|
case RcdMode.Walls:
|
||||||
var ent = EntityManager.SpawnEntity("WallSolid", mapGrid.GridTileToLocal(snapPos));
|
var ent = EntityManager.SpawnEntity("WallSolid", mapGrid.GridTileToLocal(snapPos));
|
||||||
Transform(ent).LocalRotation = Angle.Zero; // Walls always need to point south.
|
Transform(ent).LocalRotation = Angle.Zero; // Walls always need to point south.
|
||||||
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(ent)} at {snapPos} on grid {mapGrid.GridEntityId}");
|
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(ent)} at {snapPos} on grid {mapGrid.Owner}");
|
||||||
break;
|
break;
|
||||||
case RcdMode.Airlock:
|
case RcdMode.Airlock:
|
||||||
var airlock = EntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos));
|
var airlock = EntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos));
|
||||||
Transform(airlock).LocalRotation = Transform(rcd.Owner).LocalRotation; //Now apply icon smoothing.
|
Transform(airlock).LocalRotation = Transform(rcd.Owner).LocalRotation; //Now apply icon smoothing.
|
||||||
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(airlock)} at {snapPos} on grid {mapGrid.GridEntityId}");
|
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(airlock)} at {snapPos} on grid {mapGrid.Owner}");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public partial class RadiationSystem
|
|||||||
|
|
||||||
foreach (var grid in _mapManager.GetAllGrids())
|
foreach (var grid in _mapManager.GetAllGrids())
|
||||||
{
|
{
|
||||||
var gridUid = grid.GridEntityId;
|
var gridUid = grid.Owner;
|
||||||
if (!query.TryGetComponent(gridUid, out var resistance))
|
if (!query.TryGetComponent(gridUid, out var resistance))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public partial class RadiationSystem
|
|||||||
// the ray will be updated with each grid that has some blockers
|
// the ray will be updated with each grid that has some blockers
|
||||||
foreach (var grid in grids)
|
foreach (var grid in grids)
|
||||||
{
|
{
|
||||||
ray = Gridcast(grid, ray, saveVisitedTiles, resistanceQuery, sourceTrs, destTrs, transformQuery.GetComponent(grid.GridEntityId));
|
ray = Gridcast(grid, ray, saveVisitedTiles, resistanceQuery, sourceTrs, destTrs, transformQuery.GetComponent(grid.Owner));
|
||||||
|
|
||||||
// looks like last grid blocked all radiation
|
// looks like last grid blocked all radiation
|
||||||
// we can return right now
|
// we can return right now
|
||||||
@@ -156,7 +156,7 @@ public partial class RadiationSystem
|
|||||||
var blockers = new List<(Vector2i, float)>();
|
var blockers = new List<(Vector2i, float)>();
|
||||||
|
|
||||||
// if grid doesn't have resistance map just apply distance penalty
|
// if grid doesn't have resistance map just apply distance penalty
|
||||||
var gridUid = grid.GridEntityId;
|
var gridUid = grid.Owner;
|
||||||
if (!resistanceQuery.TryGetComponent(gridUid, out var resistance))
|
if (!resistanceQuery.TryGetComponent(gridUid, out var resistance))
|
||||||
return ray;
|
return ray;
|
||||||
var resistanceMap = resistance.ResistancePerTile;
|
var resistanceMap = resistance.ResistancePerTile;
|
||||||
@@ -167,11 +167,11 @@ public partial class RadiationSystem
|
|||||||
// If ever grids are allowed to overlap, this might no longer be true. In that case, this should precompute and cache
|
// If ever grids are allowed to overlap, this might no longer be true. In that case, this should precompute and cache
|
||||||
// inverse world matrices.
|
// inverse world matrices.
|
||||||
|
|
||||||
Vector2 srcLocal = sourceTrs.ParentUid == grid.GridEntityId
|
Vector2 srcLocal = sourceTrs.ParentUid == grid.Owner
|
||||||
? sourceTrs.LocalPosition
|
? sourceTrs.LocalPosition
|
||||||
: gridTrs.InvLocalMatrix.Transform(ray.Source);
|
: gridTrs.InvLocalMatrix.Transform(ray.Source);
|
||||||
|
|
||||||
Vector2 dstLocal = destTrs.ParentUid == grid.GridEntityId
|
Vector2 dstLocal = destTrs.ParentUid == grid.Owner
|
||||||
? destTrs.LocalPosition
|
? destTrs.LocalPosition
|
||||||
: gridTrs.InvLocalMatrix.Transform(ray.Destination);
|
: gridTrs.InvLocalMatrix.Transform(ray.Destination);
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ sealed class SalvageRulerCommand : IConsoleCommand
|
|||||||
var first = true;
|
var first = true;
|
||||||
foreach (var mapGrid in _maps.GetAllMapGrids(entityTransform.MapID))
|
foreach (var mapGrid in _maps.GetAllMapGrids(entityTransform.MapID))
|
||||||
{
|
{
|
||||||
var aabb = _entities.GetComponent<TransformComponent>(mapGrid.GridEntityId).WorldMatrix.TransformBox(mapGrid.LocalAABB);
|
var aabb = _entities.GetComponent<TransformComponent>(mapGrid.Owner).WorldMatrix.TransformBox(mapGrid.LocalAABB);
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
total = aabb;
|
total = aabb;
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ namespace Content.Server.Salvage
|
|||||||
var tsc = Transform(component.Owner);
|
var tsc = Transform(component.Owner);
|
||||||
coords = new EntityCoordinates(component.Owner, component.Offset).ToMap(EntityManager);
|
coords = new EntityCoordinates(component.Owner, component.Offset).ToMap(EntityManager);
|
||||||
|
|
||||||
if (_mapManager.TryGetGrid(tsc.GridUid, out var magnetGrid) && TryComp<TransformComponent>(magnetGrid.GridEntityId, out var gridXform))
|
if (_mapManager.TryGetGrid(tsc.GridUid, out var magnetGrid) && TryComp<TransformComponent>(magnetGrid.Owner, out var gridXform))
|
||||||
{
|
{
|
||||||
angle = gridXform.WorldRotation;
|
angle = gridXform.WorldRotation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace Content.Server.Shuttles.Systems
|
|||||||
// Assume the docking port itself (and its body) is valid
|
// Assume the docking port itself (and its body) is valid
|
||||||
|
|
||||||
if (!_mapManager.TryGetGrid(dockingXform.GridUid, out var grid) ||
|
if (!_mapManager.TryGetGrid(dockingXform.GridUid, out var grid) ||
|
||||||
!HasComp<ShuttleComponent>(grid.GridEntityId)) return null;
|
!HasComp<ShuttleComponent>(grid.Owner)) return null;
|
||||||
|
|
||||||
var transform = body.GetTransform();
|
var transform = body.GetTransform();
|
||||||
var dockingFixture = _fixtureSystem.GetFixtureOrNull(body, DockingFixture);
|
var dockingFixture = _fixtureSystem.GetFixtureOrNull(body, DockingFixture);
|
||||||
@@ -92,7 +92,7 @@ namespace Content.Server.Shuttles.Systems
|
|||||||
// Get any docking ports in range on other grids.
|
// Get any docking ports in range on other grids.
|
||||||
foreach (var otherGrid in _mapManager.FindGridsIntersecting(dockingXform.MapID, enlargedAABB))
|
foreach (var otherGrid in _mapManager.FindGridsIntersecting(dockingXform.MapID, enlargedAABB))
|
||||||
{
|
{
|
||||||
if (otherGrid.GridEntityId == dockingXform.GridUid)
|
if (otherGrid.Owner == dockingXform.GridUid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach (var ent in otherGrid.GetAnchoredEntities(enlargedAABB))
|
foreach (var ent in otherGrid.GetAnchoredEntities(enlargedAABB))
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public sealed partial class ShuttleSystem
|
|||||||
|
|
||||||
// Check if there's no intersecting grids (AKA oh god it's docking at cargo).
|
// Check if there's no intersecting grids (AKA oh god it's docking at cargo).
|
||||||
if (_mapManager.FindGridsIntersecting(targetGridXform.MapID,
|
if (_mapManager.FindGridsIntersecting(targetGridXform.MapID,
|
||||||
dockedBounds).Any(o => o.GridEntityId != targetGrid))
|
dockedBounds).Any(o => o.Owner != targetGrid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ public sealed partial class ShuttleSystem
|
|||||||
|
|
||||||
foreach (var other in _mapManager.FindGridsIntersecting(xform.MapID, bounds))
|
foreach (var other in _mapManager.FindGridsIntersecting(xform.MapID, bounds))
|
||||||
{
|
{
|
||||||
if (grid.Owner == other.GridEntityId ||
|
if (((Component) grid).Owner == other.Owner ||
|
||||||
!bodyQuery.TryGetComponent(other.GridEntityId, out var body) ||
|
!bodyQuery.TryGetComponent(other.Owner, out var body) ||
|
||||||
body.Mass < ShuttleFTLMassThreshold) continue;
|
body.Mass < ShuttleFTLMassThreshold) continue;
|
||||||
|
|
||||||
reason = Loc.GetString("shuttle-console-proximity");
|
reason = Loc.GetString("shuttle-console-proximity");
|
||||||
@@ -485,10 +485,10 @@ public sealed partial class ShuttleSystem
|
|||||||
{
|
{
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(mapId, targetAABB))
|
foreach (var grid in _mapManager.FindGridsIntersecting(mapId, targetAABB))
|
||||||
{
|
{
|
||||||
if (!nearbyGrids.Add(grid.GridEntityId)) continue;
|
if (!nearbyGrids.Add(grid.Owner)) continue;
|
||||||
|
|
||||||
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
|
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.Owner, xformQuery)
|
||||||
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
|
.TransformBox(Comp<MapGridComponent>(grid.Owner).LocalAABB));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can do proximity
|
// Can do proximity
|
||||||
@@ -508,10 +508,10 @@ public sealed partial class ShuttleSystem
|
|||||||
foreach (var grid in _mapManager.GetAllGrids())
|
foreach (var grid in _mapManager.GetAllGrids())
|
||||||
{
|
{
|
||||||
// Don't add anymore as it is irrelevant, but that doesn't mean we need to re-do existing work.
|
// Don't add anymore as it is irrelevant, but that doesn't mean we need to re-do existing work.
|
||||||
if (nearbyGrids.Contains(grid.GridEntityId)) continue;
|
if (nearbyGrids.Contains(grid.Owner)) continue;
|
||||||
|
|
||||||
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
|
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.Owner, xformQuery)
|
||||||
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
|
.TransformBox(Comp<MapGridComponent>(grid.Owner).LocalAABB));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ namespace Content.Server.Shuttles.Systems
|
|||||||
component.Type != ThrusterType.Linear ||
|
component.Type != ThrusterType.Linear ||
|
||||||
!EntityManager.TryGetComponent(uid, out TransformComponent? xform) ||
|
!EntityManager.TryGetComponent(uid, out TransformComponent? xform) ||
|
||||||
!_mapManager.TryGetGrid(xform.GridUid, out var grid) ||
|
!_mapManager.TryGetGrid(xform.GridUid, out var grid) ||
|
||||||
!EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttleComponent))
|
!EntityManager.TryGetComponent(grid.Owner, out ShuttleComponent? shuttleComponent))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,7 @@ namespace Content.Server.Shuttles.Systems
|
|||||||
|
|
||||||
component.IsOn = true;
|
component.IsOn = true;
|
||||||
|
|
||||||
if (!EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttleComponent)) return;
|
if (!EntityManager.TryGetComponent(grid.Owner, out ShuttleComponent? shuttleComponent)) return;
|
||||||
|
|
||||||
// Logger.DebugS("thruster", $"Enabled thruster {uid}");
|
// Logger.DebugS("thruster", $"Enabled thruster {uid}");
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ namespace Content.Server.Shuttles.Systems
|
|||||||
|
|
||||||
component.IsOn = false;
|
component.IsOn = false;
|
||||||
|
|
||||||
if (!EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttleComponent)) return;
|
if (!EntityManager.TryGetComponent(grid.Owner, out ShuttleComponent? shuttleComponent)) return;
|
||||||
|
|
||||||
// Logger.DebugS("thruster", $"Disabled thruster {uid}");
|
// Logger.DebugS("thruster", $"Disabled thruster {uid}");
|
||||||
|
|
||||||
|
|||||||
@@ -398,11 +398,11 @@ public sealed class StationSystem : EntitySystem
|
|||||||
|
|
||||||
var stationMember = AddComp<StationMemberComponent>(mapGrid);
|
var stationMember = AddComp<StationMemberComponent>(mapGrid);
|
||||||
stationMember.Station = station;
|
stationMember.Station = station;
|
||||||
stationData.Grids.Add(gridComponent.Owner);
|
stationData.Grids.Add(((Component) gridComponent).Owner);
|
||||||
|
|
||||||
RaiseLocalEvent(station, new StationGridAddedEvent(gridComponent.Owner, false), true);
|
RaiseLocalEvent(station, new StationGridAddedEvent(((Component) gridComponent).Owner, false), true);
|
||||||
|
|
||||||
_sawmill.Info($"Adding grid {mapGrid}:{gridComponent.Owner} to station {Name(station)} ({station})");
|
_sawmill.Info($"Adding grid {mapGrid}:{((Component) gridComponent).Owner} to station {Name(station)} ({station})");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -421,10 +421,10 @@ public sealed class StationSystem : EntitySystem
|
|||||||
throw new ArgumentException("Tried to use a non-station entity as a station!", nameof(station));
|
throw new ArgumentException("Tried to use a non-station entity as a station!", nameof(station));
|
||||||
|
|
||||||
RemComp<StationMemberComponent>(mapGrid);
|
RemComp<StationMemberComponent>(mapGrid);
|
||||||
stationData.Grids.Remove(gridComponent.Owner);
|
stationData.Grids.Remove(((Component) gridComponent).Owner);
|
||||||
|
|
||||||
RaiseLocalEvent(station, new StationGridRemovedEvent(gridComponent.Owner), true);
|
RaiseLocalEvent(station, new StationGridRemovedEvent(((Component) gridComponent).Owner), true);
|
||||||
_sawmill.Info($"Removing grid {mapGrid}:{gridComponent.Owner} from station {Name(station)} ({station})");
|
_sawmill.Info($"Removing grid {mapGrid}:{((Component) gridComponent).Owner} from station {Name(station)} ({station})");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace Content.Server.StationEvents.Events
|
|||||||
|
|
||||||
foreach (var grid in MapManager.GetAllMapGrids(mapId))
|
foreach (var grid in MapManager.GetAllMapGrids(mapId))
|
||||||
{
|
{
|
||||||
if (!TryComp<PhysicsComponent>(grid.GridEntityId, out var gridBody))
|
if (!TryComp<PhysicsComponent>(grid.Owner, out var gridBody))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,9 +159,9 @@ namespace Content.Server.StationEvents.Events
|
|||||||
var randomY = RobustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
|
var randomY = RobustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
|
||||||
|
|
||||||
tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y);
|
tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y);
|
||||||
if (_atmosphere.IsTileSpace(gridComp.GridEntityId, Transform(targetGrid).MapUid, tile,
|
if (_atmosphere.IsTileSpace(gridComp.Owner, Transform(targetGrid).MapUid, tile,
|
||||||
mapGridComp: gridComp)
|
mapGridComp: gridComp)
|
||||||
|| _atmosphere.IsTileAirBlocked(gridComp.GridEntityId, tile, mapGridComp: gridComp))
|
|| _atmosphere.IsTileAirBlocked(gridComp.Owner, tile, mapGridComp: gridComp))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,9 +76,9 @@ namespace Content.Server.Tiles
|
|||||||
else if (HasBaseTurf(currentTileDefinition, ContentTileDefinition.SpaceID))
|
else if (HasBaseTurf(currentTileDefinition, ContentTileDefinition.SpaceID))
|
||||||
{
|
{
|
||||||
mapGrid = _mapManager.CreateGrid(locationMap.MapId);
|
mapGrid = _mapManager.CreateGrid(locationMap.MapId);
|
||||||
var gridXform = Transform(mapGrid.GridEntityId);
|
var gridXform = Transform(mapGrid.Owner);
|
||||||
gridXform.WorldPosition = locationMap.Position;
|
gridXform.WorldPosition = locationMap.Position;
|
||||||
location = new EntityCoordinates(mapGrid.GridEntityId, Vector2.Zero);
|
location = new EntityCoordinates(mapGrid.Owner, Vector2.Zero);
|
||||||
PlaceAt(mapGrid, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, mapGrid.TileSize / 2f);
|
PlaceAt(mapGrid, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, mapGrid.TileSize / 2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,17 +22,17 @@ namespace Content.Shared.Coordinates
|
|||||||
|
|
||||||
public static EntityCoordinates ToCoordinates(this MapGridComponent grid, Vector2 offset)
|
public static EntityCoordinates ToCoordinates(this MapGridComponent grid, Vector2 offset)
|
||||||
{
|
{
|
||||||
return ToCoordinates(grid.GridEntityId, offset);
|
return ToCoordinates(grid.Owner, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityCoordinates ToCoordinates(this MapGridComponent grid, float x, float y)
|
public static EntityCoordinates ToCoordinates(this MapGridComponent grid, float x, float y)
|
||||||
{
|
{
|
||||||
return ToCoordinates(grid.GridEntityId, x, y);
|
return ToCoordinates(grid.Owner, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityCoordinates ToCoordinates(this MapGridComponent grid)
|
public static EntityCoordinates ToCoordinates(this MapGridComponent grid)
|
||||||
{
|
{
|
||||||
return ToCoordinates(grid.GridEntityId, Vector2.Zero);
|
return ToCoordinates(grid.Owner, Vector2.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ namespace Content.Shared.Maps
|
|||||||
|
|
||||||
if (map.TryGetGrid(turf.GridUid, out var tileGrid))
|
if (map.TryGetGrid(turf.GridUid, out var tileGrid))
|
||||||
{
|
{
|
||||||
var gridRot = entManager.GetComponent<TransformComponent>(tileGrid.GridEntityId).WorldRotation;
|
var gridRot = entManager.GetComponent<TransformComponent>(tileGrid.Owner).WorldRotation;
|
||||||
|
|
||||||
// This is scaled to 90 % so it doesn't encompass walls on other tiles.
|
// This is scaled to 90 % so it doesn't encompass walls on other tiles.
|
||||||
var tileBox = Box2.UnitCentered.Scale(0.9f);
|
var tileBox = Box2.UnitCentered.Scale(0.9f);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace Content.Shared.Movement.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entityManager.GetComponent<GravityComponent>(grid.GridEntityId).EnabledVV)
|
if (!entityManager.GetComponent<GravityComponent>(grid.Owner).EnabledVV)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user