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))
|
||||
continue;
|
||||
|
||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
||||
var gridXform = xformQuery.GetComponent(grid.Owner);
|
||||
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||
gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
|
||||
DrawText(handle, gridBounds, matrix, tileSets, grid.TileSize);
|
||||
@@ -134,7 +134,7 @@ public sealed class ExplosionDebugOverlay : Overlay
|
||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||
continue;
|
||||
|
||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
||||
var gridXform = xformQuery.GetComponent(grid.Owner);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
|
||||
handle.SetTransform(worldMatrix);
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
|
||||
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)
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
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);
|
||||
@@ -38,7 +38,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].GridEntityId;
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
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);
|
||||
@@ -53,7 +53,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].GridEntityId;
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Owner;
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
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);
|
||||
@@ -53,7 +53,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].GridEntityId;
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Owner;
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
|
||||
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)
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
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);
|
||||
@@ -38,7 +38,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].GridEntityId;
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
||||
IoCManager.Resolve<IClientConsoleHost>()
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public sealed partial class ObjectsTab : Control
|
||||
var entities = selection switch
|
||||
{
|
||||
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(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(selection), selection, null)
|
||||
};
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace Content.Client.Atmos.Overlays
|
||||
|
||||
foreach (var mapGrid in _mapManager.FindGridsIntersecting(mapId, worldBounds))
|
||||
{
|
||||
if (!_atmosDebugOverlaySystem.HasData(mapGrid.GridEntityId) ||
|
||||
!_entManager.TryGetComponent<TransformComponent>(mapGrid.GridEntityId, out var xform))
|
||||
if (!_atmosDebugOverlaySystem.HasData(mapGrid.Owner) ||
|
||||
!_entManager.TryGetComponent<TransformComponent>(mapGrid.Owner, out var xform))
|
||||
continue;
|
||||
|
||||
drawHandle.SetTransform(xform.WorldMatrix);
|
||||
@@ -52,7 +52,7 @@ namespace Content.Client.Atmos.Overlays
|
||||
{
|
||||
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)
|
||||
{
|
||||
var data = (SharedAtmosDebugOverlaySystem.AtmosDebugOverlayData) dataMaybeNull!;
|
||||
|
||||
@@ -142,8 +142,8 @@ namespace Content.Client.Atmos.Overlays
|
||||
|
||||
foreach (var mapGrid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds))
|
||||
{
|
||||
if (!TileData.TryGetValue(mapGrid.GridEntityId, out var gridData) ||
|
||||
!xformQuery.TryGetComponent(mapGrid.GridEntityId, out var gridXform))
|
||||
if (!TileData.TryGetValue(mapGrid.Owner, out var gridData) ||
|
||||
!xformQuery.TryGetComponent(mapGrid.Owner, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
|
||||
@@ -54,7 +54,7 @@ public sealed class ExplosionOverlay : Overlay
|
||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||
continue;
|
||||
|
||||
var xform = xforms.GetComponent(grid.GridEntityId);
|
||||
var xform = xforms.GetComponent(grid.Owner);
|
||||
var (_, _, worldMatrix, invWorldMatrix) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
@@ -91,7 +91,7 @@ public sealed class PuddleOverlay : Overlay
|
||||
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
|
||||
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;
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
if (!_mapManager.TryFindGridAt(mousePos, out var grid))
|
||||
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))
|
||||
|
||||
@@ -69,7 +69,7 @@ public sealed class JetpackSystem : SharedJetpackSystem
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace Content.Client.NPC
|
||||
|
||||
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;
|
||||
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
@@ -243,12 +243,12 @@ namespace Content.Client.NPC
|
||||
if ((_system.Modes & PathfindingDebugMode.Poly) != 0x0 &&
|
||||
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;
|
||||
|
||||
var found = false;
|
||||
|
||||
if (!_system.Polys.TryGetValue(grid.GridEntityId, out var data))
|
||||
if (!_system.Polys.TryGetValue(grid.Owner, out var data))
|
||||
return;
|
||||
|
||||
var tileRef = grid.GetTileRef(mouseWorldPos);
|
||||
@@ -324,8 +324,8 @@ namespace Content.Client.NPC
|
||||
{
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
|
||||
{
|
||||
if (!_system.Breadcrumbs.TryGetValue(grid.GridEntityId, out var crumbs) ||
|
||||
!xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
||||
if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) ||
|
||||
!xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
@@ -378,8 +378,8 @@ namespace Content.Client.NPC
|
||||
{
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
|
||||
{
|
||||
if (!_system.Polys.TryGetValue(grid.GridEntityId, out var data) ||
|
||||
!xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
||||
if (!_system.Polys.TryGetValue(grid.Owner, out var data) ||
|
||||
!xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
@@ -412,8 +412,8 @@ namespace Content.Client.NPC
|
||||
{
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
|
||||
{
|
||||
if (!_system.Polys.TryGetValue(grid.GridEntityId, out var data) ||
|
||||
!xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
||||
if (!_system.Polys.TryGetValue(grid.Owner, out var data) ||
|
||||
!xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
@@ -466,8 +466,8 @@ namespace Content.Client.NPC
|
||||
{
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds))
|
||||
{
|
||||
if (!_system.Breadcrumbs.TryGetValue(grid.GridEntityId, out var crumbs) ||
|
||||
!xformQuery.TryGetComponent(grid.GridEntityId, out var gridXform))
|
||||
if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) ||
|
||||
!xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||
continue;
|
||||
|
||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
||||
|
||||
@@ -113,12 +113,12 @@ namespace Content.Client.NodeContainer
|
||||
|
||||
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))
|
||||
continue;
|
||||
|
||||
var gridDict = _gridIndex.GetOrNew(grid.GridEntityId);
|
||||
var gridDict = _gridIndex.GetOrNew(grid.Owner);
|
||||
var coords = xformQuery.GetComponent(entity).Coordinates;
|
||||
|
||||
// TODO: This probably shouldn't be capable of returning NaN...
|
||||
@@ -140,7 +140,7 @@ namespace Content.Client.NodeContainer
|
||||
foreach (var (gridId, gridDict) in _gridIndex)
|
||||
{
|
||||
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);
|
||||
foreach (var (pos, list) in gridDict)
|
||||
|
||||
@@ -141,14 +141,14 @@ public class DockingControl : Control
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(gridXform.MapID,
|
||||
new Box2(worldPos - _range, worldPos + _range)))
|
||||
{
|
||||
if (grid.GridEntityId == GridEntity)
|
||||
if (grid.Owner == GridEntity)
|
||||
continue;
|
||||
|
||||
// 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;
|
||||
|
||||
var gridMatrix = xformQuery.GetComponent(grid.GridEntityId).WorldMatrix;
|
||||
var gridMatrix = xformQuery.GetComponent(grid.Owner).WorldMatrix;
|
||||
|
||||
Matrix3.Multiply(in gridMatrix, in invMatrix, out var matty);
|
||||
|
||||
@@ -195,7 +195,7 @@ public class DockingControl : Control
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
||||
@@ -202,17 +202,17 @@ public sealed class RadarControl : Control
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(mapPosition.MapId,
|
||||
new Box2(mapPosition.Position - MaxRadarRange, mapPosition.Position + MaxRadarRange)))
|
||||
{
|
||||
if (grid.GridEntityId == ourGridId)
|
||||
if (grid.Owner == ourGridId)
|
||||
continue;
|
||||
|
||||
var gridBody = bodyQuery.GetComponent(grid.GridEntityId);
|
||||
var gridBody = bodyQuery.GetComponent(grid.Owner);
|
||||
if (gridBody.Mass < 10f)
|
||||
{
|
||||
ClearLabel(grid.GridEntityId);
|
||||
ClearLabel(grid.Owner);
|
||||
continue;
|
||||
}
|
||||
|
||||
_entManager.TryGetComponent<IFFComponent>(grid.GridEntityId, out var iff);
|
||||
_entManager.TryGetComponent<IFFComponent>(grid.Owner, out var iff);
|
||||
|
||||
// Hide it entirely.
|
||||
if (iff != null &&
|
||||
@@ -221,14 +221,14 @@ public sealed class RadarControl : Control
|
||||
continue;
|
||||
}
|
||||
|
||||
shown.Add(grid.GridEntityId);
|
||||
var name = metaQuery.GetComponent(grid.GridEntityId).EntityName;
|
||||
shown.Add(grid.Owner);
|
||||
var name = metaQuery.GetComponent(grid.Owner).EntityName;
|
||||
|
||||
if (name == string.Empty)
|
||||
name = Loc.GetString("shuttle-console-unknown");
|
||||
|
||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
||||
var gridFixtures = fixturesQuery.GetComponent(grid.GridEntityId);
|
||||
var gridXform = xformQuery.GetComponent(grid.Owner);
|
||||
var gridFixtures = fixturesQuery.GetComponent(grid.Owner);
|
||||
var gridMatrix = gridXform.WorldMatrix;
|
||||
Matrix3.Multiply(in gridMatrix, in offsetMatrix, out var matty);
|
||||
var color = iff?.Color ?? IFFComponent.IFFColor;
|
||||
@@ -240,14 +240,14 @@ public sealed class RadarControl : Control
|
||||
var gridBounds = grid.LocalAABB;
|
||||
Label label;
|
||||
|
||||
if (!_iffControls.TryGetValue(grid.GridEntityId, out var control))
|
||||
if (!_iffControls.TryGetValue(grid.Owner, out var control))
|
||||
{
|
||||
label = new Label()
|
||||
{
|
||||
HorizontalAlignment = HAlignment.Left,
|
||||
};
|
||||
|
||||
_iffControls[grid.GridEntityId] = label;
|
||||
_iffControls[grid.Owner] = label;
|
||||
AddChild(label);
|
||||
}
|
||||
else
|
||||
@@ -277,13 +277,13 @@ public sealed class RadarControl : Control
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearLabel(grid.GridEntityId);
|
||||
ClearLabel(grid.Owner);
|
||||
}
|
||||
|
||||
// Detailed view
|
||||
DrawGrid(handle, matty, gridFixtures, color);
|
||||
|
||||
DrawDocks(handle, grid.GridEntityId, matty);
|
||||
DrawDocks(handle, grid.Owner, matty);
|
||||
}
|
||||
|
||||
foreach (var (ent, _) in _iffControls)
|
||||
|
||||
@@ -103,7 +103,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
|
||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||
{
|
||||
coordinates = EntityCoordinates.FromMap(grid.GridEntityId, mousePos, EntityManager);
|
||||
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, EntityManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -138,7 +138,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||
{
|
||||
coordinates = EntityCoordinates.FromMap(grid.GridEntityId, mousePos, EntityManager);
|
||||
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, EntityManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -179,7 +179,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||
{
|
||||
coordinates = EntityCoordinates.FromMap(grid.GridEntityId, mousePos, EntityManager);
|
||||
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, EntityManager);
|
||||
}
|
||||
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>();
|
||||
mapData.MapId = mapManager.CreateMap();
|
||||
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 plating = tileDefinitionManager["Plating"];
|
||||
var platingTile = new Tile(plating.TileId);
|
||||
|
||||
@@ -58,7 +58,7 @@ public sealed class CargoTest
|
||||
{
|
||||
var mapId = mapManager.CreateMap();
|
||||
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>()
|
||||
.Where(p=>!p.Abstract)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
var mapId = mapManager.CreateMap();
|
||||
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);
|
||||
}
|
||||
});
|
||||
@@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests
|
||||
.ToList();
|
||||
var mapId = mapManager.CreateMap();
|
||||
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)
|
||||
{
|
||||
entityMan.SpawnEntity(protoId, coord);
|
||||
|
||||
@@ -58,7 +58,7 @@ public sealed class FluidSpill
|
||||
{
|
||||
mapId = mapManager.CreateMap();
|
||||
var grid = mapManager.CreateGrid(mapId);
|
||||
gridId = grid.GridEntityId;
|
||||
gridId = grid.Owner;
|
||||
|
||||
for (var x = 0; x < 3; x++)
|
||||
{
|
||||
@@ -125,7 +125,7 @@ public sealed class FluidSpill
|
||||
{
|
||||
mapId = mapManager.CreateMap();
|
||||
var grid = mapManager.CreateGrid(mapId);
|
||||
gridId = grid.GridEntityId;
|
||||
gridId = grid.Owner;
|
||||
|
||||
for (var x = 0; x < 3; x++)
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
sMapId = sMapManager.CreateMap();
|
||||
sMapManager.SetMapPaused(sMapId, true);
|
||||
sGrid = sMapManager.CreateGrid(sMapId);
|
||||
sGridId = sGrid.GridEntityId;
|
||||
sGridId = sGrid.Owner;
|
||||
metaSystem.SetEntityPaused(sGridId, true); // See https://github.com/space-wizards/RobustToolbox/issues/1444
|
||||
|
||||
var tileDefinition = sTileDefinitionManager["UnderPlating"];
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
Assert.That(generatorComponent.GravityActive, Is.True);
|
||||
|
||||
var grid1Entity = grid1.GridEntityId;
|
||||
var grid2Entity = grid2.GridEntityId;
|
||||
var grid1Entity = grid1.Owner;
|
||||
var grid2Entity = grid2.Owner;
|
||||
|
||||
Assert.That(!entityMan.GetComponent<GravityComponent>(grid1Entity).EnabledVV);
|
||||
Assert.That(entityMan.GetComponent<GravityComponent>(grid2Entity).EnabledVV);
|
||||
@@ -87,7 +87,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
Assert.That(generatorComponent.GravityActive, Is.False);
|
||||
|
||||
var grid2Entity = grid2.GridEntityId;
|
||||
var grid2Entity = grid2.Owner;
|
||||
|
||||
Assert.That(entityMan.GetComponent<GravityComponent>(grid2Entity).EnabledVV, Is.False);
|
||||
});
|
||||
|
||||
@@ -202,11 +202,11 @@ namespace Content.IntegrationTests.Tests
|
||||
var memberQuery = entManager.GetEntityQuery<StationMemberComponent>();
|
||||
|
||||
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)
|
||||
{
|
||||
if (!memberQuery.HasComponent(grid.GridEntityId))
|
||||
if (!memberQuery.HasComponent(grid.Owner))
|
||||
continue;
|
||||
|
||||
var area = grid.LocalAABB.Width * grid.LocalAABB.Height;
|
||||
@@ -214,7 +214,7 @@ namespace Content.IntegrationTests.Tests
|
||||
if (area > largest)
|
||||
{
|
||||
largest = area;
|
||||
targetGrid = grid.GridEntityId;
|
||||
targetGrid = grid.Owner;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
{
|
||||
var mapGrid = mapManager.CreateGrid(mapId);
|
||||
var mapGridEnt = mapGrid.GridEntityId;
|
||||
var mapGridEnt = mapGrid.Owner;
|
||||
sEntities.GetComponent<TransformComponent>(mapGridEnt).WorldPosition = new Vector2(10, 10);
|
||||
mapGrid.SetTile(new Vector2i(0,0), new Tile(1, (TileRenderFlag)1, 255));
|
||||
}
|
||||
{
|
||||
var mapGrid = mapManager.CreateGrid(mapId);
|
||||
var mapGridEnt = mapGrid.GridEntityId;
|
||||
var mapGridEnt = mapGrid.Owner;
|
||||
sEntities.GetComponent<TransformComponent>(mapGridEnt).WorldPosition = new Vector2(-8, -8);
|
||||
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) ||
|
||||
!sEntities.TryGetComponent<TransformComponent>(mapGrid.GridEntityId, out var gridXform))
|
||||
!sEntities.TryGetComponent<TransformComponent>(mapGrid.Owner, out var gridXform))
|
||||
{
|
||||
Assert.Fail();
|
||||
return;
|
||||
@@ -73,7 +73,7 @@ namespace Content.IntegrationTests.Tests
|
||||
}
|
||||
{
|
||||
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();
|
||||
return;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.IntegrationTests.Tests
|
||||
var mapId0 = mapManager.CreateMap();
|
||||
// TODO: Properly find the "main" station grid.
|
||||
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 grid1 = mapLoader.LoadGrid(mapId1, "save load save 1.yml", new MapLoadOptions() {LoadMap = false});
|
||||
mapLoader.Save(grid1!.Value, "save load save 2.yml");
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
var mapId = mapMan.CreateMap();
|
||||
var grid = mapMan.CreateGrid(mapId);
|
||||
gridEnt = grid.GridEntityId;
|
||||
gridEnt = grid.Owner;
|
||||
|
||||
Assert.That(sEntities.HasComponent<ShuttleComponent>(gridEnt));
|
||||
Assert.That(sEntities.TryGetComponent<PhysicsComponent>(gridEnt, out var physicsComponent));
|
||||
|
||||
@@ -49,19 +49,19 @@ namespace Content.MapRenderer.Painters
|
||||
var stopwatch = new Stopwatch();
|
||||
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;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
_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()
|
||||
@@ -120,14 +120,14 @@ namespace Content.MapRenderer.Painters
|
||||
// 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
|
||||
// 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 (_, decal) in list)
|
||||
{
|
||||
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)
|
||||
{
|
||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
||||
var gridXform = xformQuery.GetComponent(grid.Owner);
|
||||
gridXform.WorldRotation = Angle.Zero;
|
||||
}
|
||||
});
|
||||
@@ -90,7 +90,7 @@ namespace Content.MapRenderer.Painters
|
||||
// Skip empty grids
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ namespace Content.MapRenderer.Painters
|
||||
|
||||
var renderedImage = new RenderedGridImage<Rgba32>(gridCanvas)
|
||||
{
|
||||
GridUid = grid.GridEntityId,
|
||||
Offset = xformQuery.GetComponent(grid.GridEntityId).WorldPosition
|
||||
GridUid = grid.Owner,
|
||||
Offset = xformQuery.GetComponent(grid.Owner).WorldPosition
|
||||
};
|
||||
|
||||
yield return renderedImage;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Content.MapRenderer.Painters
|
||||
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(
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Content.Server.AME
|
||||
if (_entMan.TryGetComponent(nodeOwner, out AMEShieldComponent? shield))
|
||||
{
|
||||
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;
|
||||
|
||||
if (grid == null)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Commands
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.Atmos.Commands
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
var tiles = 0;
|
||||
foreach (var tile in atmosphereSystem.GetAllMixtures(gridComp.GridEntityId, true))
|
||||
foreach (var tile in atmosphereSystem.GetAllMixtures(gridComp.Owner, true))
|
||||
{
|
||||
tiles++;
|
||||
tile.Temperature = temperature;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Atmos.Commands
|
||||
var atmospheres = _entities.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
// If the grid is deleting no point updating atmos.
|
||||
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);
|
||||
@@ -114,7 +114,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!_mapManager.TryGetGrid(gridId, out var grid))
|
||||
return;
|
||||
|
||||
var gridUid = grid.GridEntityId;
|
||||
var gridUid = grid.Owner;
|
||||
|
||||
var query = EntityManager.GetEntityQuery<AirtightComponent>();
|
||||
_explosionSystem.UpdateAirtightMap(gridId, pos, query);
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds))
|
||||
{
|
||||
var uid = grid.GridEntityId;
|
||||
var uid = grid.Owner;
|
||||
|
||||
if (!Exists(uid))
|
||||
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)
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
@@ -65,7 +65,7 @@ public sealed partial class AtmosphereSystem
|
||||
if (!_mapManager.TryGetGrid(newGrid, out var mapGrid))
|
||||
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 (!TryComp(entity, out GridAtmosphereComponent? newGridAtmos))
|
||||
@@ -555,7 +555,7 @@ public sealed partial class AtmosphereSystem
|
||||
{
|
||||
var ev = new UpdateAdjacentMethodEvent(uid, position);
|
||||
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 gridPhysics = Comp<PhysicsComponent>(mapGrid.GridEntityId);
|
||||
var gridPhysics = Comp<PhysicsComponent>(mapGrid.Owner);
|
||||
|
||||
// TODO ATMOS: Come up with better values for these.
|
||||
gridPhysics.ApplyLinearImpulse(direction * totalMolesRemoved * gridPhysics.Mass);
|
||||
@@ -522,10 +522,10 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!reconsiderAdjacent)
|
||||
return;
|
||||
|
||||
var tileEv = new UpdateAdjacentMethodEvent(mapGrid.GridEntityId, tile.GridIndices);
|
||||
var otherEv = new UpdateAdjacentMethodEvent(mapGrid.GridEntityId, other.GridIndices);
|
||||
GridUpdateAdjacent(mapGrid.GridEntityId, gridAtmosphere, ref tileEv);
|
||||
GridUpdateAdjacent(mapGrid.GridEntityId, gridAtmosphere, ref otherEv);
|
||||
var tileEv = new UpdateAdjacentMethodEvent(mapGrid.Owner, tile.GridIndices);
|
||||
var otherEv = new UpdateAdjacentMethodEvent(mapGrid.Owner, other.GridIndices);
|
||||
GridUpdateAdjacent(mapGrid.Owner, gridAtmosphere, ref tileEv);
|
||||
GridUpdateAdjacent(mapGrid.Owner, gridAtmosphere, ref otherEv);
|
||||
InvalidateVisuals(tile.GridIndex, tile.GridIndices);
|
||||
InvalidateVisuals(other.GridIndex, other.GridIndices);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!TryComp(uid, out MapGridComponent? mapGridComp))
|
||||
return true;
|
||||
|
||||
var mapUid = _mapManager.GetMapEntityIdOrThrow(Transform(mapGridComp.Owner).MapID);
|
||||
var mapUid = _mapManager.GetMapEntityIdOrThrow(Transform(((Component) mapGridComp).Owner).MapID);
|
||||
|
||||
var volume = GetVolumeForTiles(mapGridComp, 1);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
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 });
|
||||
atmosphere.Tiles[indices] = tile;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
tile.ThermalConductivity = tileDef?.ThermalConductivity ?? 0.5f;
|
||||
tile.HeatCapacity = tileDef?.HeatCapacity ?? float.PositiveInfinity;
|
||||
InvalidateVisuals(mapGridComp.GridEntityId, indices);
|
||||
InvalidateVisuals(mapGridComp.Owner, indices);
|
||||
|
||||
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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public sealed class PricingSystem : EntitySystem
|
||||
|
||||
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.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))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Content.Server.Construction.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.EntityExists(grid.GridEntityId))
|
||||
if (!entityManager.EntityExists(grid.Owner))
|
||||
{
|
||||
shell.WriteError($"Grid {gridId} doesn't have an associated grid entity.");
|
||||
return;
|
||||
@@ -65,7 +65,7 @@ namespace Content.Server.Construction.Commands
|
||||
var changed = 0;
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ sealed class TileReplaceCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.EntityExists(grid.GridEntityId))
|
||||
if (!entityManager.EntityExists(grid.Owner))
|
||||
{
|
||||
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
||||
return;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Content.Server.Construction.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entityManager.EntityExists(grid.GridEntityId))
|
||||
if (!entityManager.EntityExists(grid.Owner))
|
||||
{
|
||||
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
||||
return;
|
||||
@@ -68,7 +68,7 @@ namespace Content.Server.Construction.Commands
|
||||
var underplating = tileDefinitionManager[TilePrototypeId];
|
||||
var underplatingTile = new Tile(underplating.TileId);
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Content.Server.Decals.Commands
|
||||
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())
|
||||
{
|
||||
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;
|
||||
|
||||
_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;
|
||||
|
||||
_matrix.R0C2 = size / 2;
|
||||
|
||||
@@ -63,8 +63,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
var tolerance = new float[_explosionTypes.Count];
|
||||
var blockedDirections = AtmosDirection.Invalid;
|
||||
|
||||
if (!_airtightMap.ContainsKey(grid.GridEntityId))
|
||||
_airtightMap[grid.GridEntityId] = new();
|
||||
if (!_airtightMap.ContainsKey(grid.Owner))
|
||||
_airtightMap[grid.Owner] = new();
|
||||
|
||||
query ??= EntityManager.GetEntityQuery<AirtightComponent>();
|
||||
var damageQuery = EntityManager.GetEntityQuery<DamageableComponent>();
|
||||
@@ -84,9 +84,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
}
|
||||
|
||||
if (blockedDirections != AtmosDirection.Invalid)
|
||||
_airtightMap[grid.GridEntityId][tile] = new(tolerance, blockedDirections);
|
||||
_airtightMap[grid.Owner][tile] = new(tolerance, blockedDirections);
|
||||
else
|
||||
_airtightMap[grid.GridEntityId].Remove(tile);
|
||||
_airtightMap[grid.Owner].Remove(tile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
if (referenceGrid != null)
|
||||
{
|
||||
var targetGrid = _mapManager.GetGrid(referenceGrid.Value);
|
||||
var xform = Transform(targetGrid.GridEntityId);
|
||||
var xform = Transform(targetGrid.Owner);
|
||||
targetAngle = xform.WorldRotation;
|
||||
targetMatrix = xform.InvWorldMatrix;
|
||||
tileSize = targetGrid.TileSize;
|
||||
@@ -93,7 +93,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
}
|
||||
|
||||
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 localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position);
|
||||
|
||||
@@ -637,7 +637,7 @@ sealed class Explosion
|
||||
_explosionData.Add(new()
|
||||
{
|
||||
TileLists = grid.TileLists,
|
||||
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.Owner),
|
||||
Lookup = entMan.GetComponent<BroadphaseComponent>(((Component) grid.Grid).Owner),
|
||||
MapGrid = grid.Grid
|
||||
});
|
||||
}
|
||||
@@ -678,7 +678,7 @@ sealed class Explosion
|
||||
_currentDataIndex++;
|
||||
|
||||
// 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;
|
||||
|
||||
return true;
|
||||
@@ -799,7 +799,7 @@ sealed class Explosion
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
candidateGrid.TryGetTileRef(candidateGrid.WorldToTile(epicenter.Position), out var tileRef) &&
|
||||
!tileRef.Tile.IsEmpty)
|
||||
{
|
||||
epicentreGrid = candidateGrid.GridEntityId;
|
||||
epicentreGrid = candidateGrid.Owner;
|
||||
initialTile = tileRef.GridIndices;
|
||||
}
|
||||
else if (referenceGrid != null)
|
||||
@@ -85,7 +85,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
var spaceAngle = Angle.Zero;
|
||||
if (referenceGrid != null)
|
||||
{
|
||||
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).GridEntityId);
|
||||
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner);
|
||||
spaceMatrix = xform.WorldMatrix;
|
||||
spaceAngle = xform.WorldRotation;
|
||||
}
|
||||
@@ -276,10 +276,10 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
|
||||
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;
|
||||
referenceGrid = grid.GridEntityId;
|
||||
referenceGrid = grid.Owner;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
radius *= 4;
|
||||
box = Box2.CenteredAround(epicenter.Position, (radius, radius));
|
||||
var mapGrids = _mapManager.FindGridsIntersecting(epicenter.MapId, box).ToList();
|
||||
var grids = mapGrids.Select(x => x.GridEntityId).ToList();
|
||||
var grids = mapGrids.Select(x => x.Owner).ToList();
|
||||
|
||||
if (referenceGrid != null)
|
||||
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
|
||||
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;
|
||||
referenceGrid = grid.GridEntityId;
|
||||
referenceGrid = grid.Owner;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(transform.MapID, worldBounds))
|
||||
{
|
||||
var data = new List<PuddleDebugOverlayData>();
|
||||
var gridUid = grid.GridEntityId;
|
||||
var gridUid = grid.Owner;
|
||||
|
||||
if (!Exists(gridUid))
|
||||
continue;
|
||||
|
||||
@@ -312,13 +312,13 @@ namespace Content.Server.GameTicking
|
||||
{
|
||||
foreach (var grid in _mapManager.GetAllGrids())
|
||||
{
|
||||
if (!metaQuery.TryGetComponent(grid.GridEntityId, out var meta) ||
|
||||
if (!metaQuery.TryGetComponent(grid.Owner, out var meta) ||
|
||||
meta.EntityPaused)
|
||||
{
|
||||
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))
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -596,13 +596,13 @@ public sealed partial class PathfindingSystem
|
||||
var polyData = points[x * SubStep + poly.Left, y * SubStep + poly.Bottom].Data;
|
||||
|
||||
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");
|
||||
SendBreadcrumbs(chunk, grid.GridEntityId);
|
||||
SendBreadcrumbs(chunk, grid.Owner);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -147,7 +147,7 @@ public sealed partial class NPCCombatSystem
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace Content.Server.Physics.Controllers
|
||||
foreach (var entity in comp.Intersecting)
|
||||
{
|
||||
if (!xformQuery.TryGetComponent(entity, out var entityXform) ||
|
||||
entityXform.ParentUid != grid.GridEntityId)
|
||||
entityXform.ParentUid != grid.Owner)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace Content.Server.Physics.Controllers
|
||||
var gridId = xform.GridUid;
|
||||
// This tries to see if the grid is a shuttle and if the console should work.
|
||||
if (!_mapManager.TryGetGrid(gridId, out var grid) ||
|
||||
!EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttleComponent) ||
|
||||
!EntityManager.TryGetComponent(grid.Owner, out ShuttleComponent? shuttleComponent) ||
|
||||
!shuttleComponent.Enabled) continue;
|
||||
|
||||
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 (_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);
|
||||
|
||||
@@ -139,12 +139,12 @@ namespace Content.Server.RCD.Systems
|
||||
case RcdMode.Walls:
|
||||
var ent = EntityManager.SpawnEntity("WallSolid", mapGrid.GridTileToLocal(snapPos));
|
||||
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;
|
||||
case RcdMode.Airlock:
|
||||
var airlock = EntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos));
|
||||
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;
|
||||
default:
|
||||
args.Handled = true;
|
||||
|
||||
@@ -60,7 +60,7 @@ public partial class RadiationSystem
|
||||
|
||||
foreach (var grid in _mapManager.GetAllGrids())
|
||||
{
|
||||
var gridUid = grid.GridEntityId;
|
||||
var gridUid = grid.Owner;
|
||||
if (!query.TryGetComponent(gridUid, out var resistance))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public partial class RadiationSystem
|
||||
// the ray will be updated with each grid that has some blockers
|
||||
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
|
||||
// we can return right now
|
||||
@@ -156,7 +156,7 @@ public partial class RadiationSystem
|
||||
var blockers = new List<(Vector2i, float)>();
|
||||
|
||||
// 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))
|
||||
return ray;
|
||||
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
|
||||
// inverse world matrices.
|
||||
|
||||
Vector2 srcLocal = sourceTrs.ParentUid == grid.GridEntityId
|
||||
Vector2 srcLocal = sourceTrs.ParentUid == grid.Owner
|
||||
? sourceTrs.LocalPosition
|
||||
: gridTrs.InvLocalMatrix.Transform(ray.Source);
|
||||
|
||||
Vector2 dstLocal = destTrs.ParentUid == grid.GridEntityId
|
||||
Vector2 dstLocal = destTrs.ParentUid == grid.Owner
|
||||
? destTrs.LocalPosition
|
||||
: gridTrs.InvLocalMatrix.Transform(ray.Destination);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ sealed class SalvageRulerCommand : IConsoleCommand
|
||||
var first = true;
|
||||
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)
|
||||
{
|
||||
total = aabb;
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace Content.Server.Salvage
|
||||
var tsc = Transform(component.Owner);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Content.Server.Shuttles.Systems
|
||||
// Assume the docking port itself (and its body) is valid
|
||||
|
||||
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 dockingFixture = _fixtureSystem.GetFixtureOrNull(body, DockingFixture);
|
||||
@@ -92,7 +92,7 @@ namespace Content.Server.Shuttles.Systems
|
||||
// Get any docking ports in range on other grids.
|
||||
foreach (var otherGrid in _mapManager.FindGridsIntersecting(dockingXform.MapID, enlargedAABB))
|
||||
{
|
||||
if (otherGrid.GridEntityId == dockingXform.GridUid)
|
||||
if (otherGrid.Owner == dockingXform.GridUid)
|
||||
continue;
|
||||
|
||||
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).
|
||||
if (_mapManager.FindGridsIntersecting(targetGridXform.MapID,
|
||||
dockedBounds).Any(o => o.GridEntityId != targetGrid))
|
||||
dockedBounds).Any(o => o.Owner != targetGrid))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -101,8 +101,8 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
foreach (var other in _mapManager.FindGridsIntersecting(xform.MapID, bounds))
|
||||
{
|
||||
if (grid.Owner == other.GridEntityId ||
|
||||
!bodyQuery.TryGetComponent(other.GridEntityId, out var body) ||
|
||||
if (((Component) grid).Owner == other.Owner ||
|
||||
!bodyQuery.TryGetComponent(other.Owner, out var body) ||
|
||||
body.Mass < ShuttleFTLMassThreshold) continue;
|
||||
|
||||
reason = Loc.GetString("shuttle-console-proximity");
|
||||
@@ -485,10 +485,10 @@ public sealed partial class ShuttleSystem
|
||||
{
|
||||
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)
|
||||
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
|
||||
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.Owner, xformQuery)
|
||||
.TransformBox(Comp<MapGridComponent>(grid.Owner).LocalAABB));
|
||||
}
|
||||
|
||||
// Can do proximity
|
||||
@@ -508,10 +508,10 @@ public sealed partial class ShuttleSystem
|
||||
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.
|
||||
if (nearbyGrids.Contains(grid.GridEntityId)) continue;
|
||||
if (nearbyGrids.Contains(grid.Owner)) continue;
|
||||
|
||||
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
|
||||
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
|
||||
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.Owner, xformQuery)
|
||||
.TransformBox(Comp<MapGridComponent>(grid.Owner).LocalAABB));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Content.Server.Shuttles.Systems
|
||||
component.Type != ThrusterType.Linear ||
|
||||
!EntityManager.TryGetComponent(uid, out TransformComponent? xform) ||
|
||||
!_mapManager.TryGetGrid(xform.GridUid, out var grid) ||
|
||||
!EntityManager.TryGetComponent(grid.GridEntityId, out ShuttleComponent? shuttleComponent))
|
||||
!EntityManager.TryGetComponent(grid.Owner, out ShuttleComponent? shuttleComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -246,7 +246,7 @@ namespace Content.Server.Shuttles.Systems
|
||||
|
||||
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}");
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace Content.Server.Shuttles.Systems
|
||||
|
||||
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}");
|
||||
|
||||
|
||||
@@ -398,11 +398,11 @@ public sealed class StationSystem : EntitySystem
|
||||
|
||||
var stationMember = AddComp<StationMemberComponent>(mapGrid);
|
||||
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>
|
||||
@@ -421,10 +421,10 @@ public sealed class StationSystem : EntitySystem
|
||||
throw new ArgumentException("Tried to use a non-station entity as a station!", nameof(station));
|
||||
|
||||
RemComp<StationMemberComponent>(mapGrid);
|
||||
stationData.Grids.Remove(gridComponent.Owner);
|
||||
stationData.Grids.Remove(((Component) gridComponent).Owner);
|
||||
|
||||
RaiseLocalEvent(station, new StationGridRemovedEvent(gridComponent.Owner), true);
|
||||
_sawmill.Info($"Removing grid {mapGrid}:{gridComponent.Owner} from station {Name(station)} ({station})");
|
||||
RaiseLocalEvent(station, new StationGridRemovedEvent(((Component) gridComponent).Owner), true);
|
||||
_sawmill.Info($"Removing grid {mapGrid}:{((Component) gridComponent).Owner} from station {Name(station)} ({station})");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Content.Server.StationEvents.Events
|
||||
|
||||
foreach (var grid in MapManager.GetAllMapGrids(mapId))
|
||||
{
|
||||
if (!TryComp<PhysicsComponent>(grid.GridEntityId, out var gridBody))
|
||||
if (!TryComp<PhysicsComponent>(grid.Owner, out var gridBody))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -159,9 +159,9 @@ namespace Content.Server.StationEvents.Events
|
||||
var randomY = RobustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
|
||||
|
||||
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)
|
||||
|| _atmosphere.IsTileAirBlocked(gridComp.GridEntityId, tile, mapGridComp: gridComp))
|
||||
|| _atmosphere.IsTileAirBlocked(gridComp.Owner, tile, mapGridComp: gridComp))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ namespace Content.Server.Tiles
|
||||
else if (HasBaseTurf(currentTileDefinition, ContentTileDefinition.SpaceID))
|
||||
{
|
||||
mapGrid = _mapManager.CreateGrid(locationMap.MapId);
|
||||
var gridXform = Transform(mapGrid.GridEntityId);
|
||||
var gridXform = Transform(mapGrid.Owner);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,17 +22,17 @@ namespace Content.Shared.Coordinates
|
||||
|
||||
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)
|
||||
{
|
||||
return ToCoordinates(grid.GridEntityId, x, y);
|
||||
return ToCoordinates(grid.Owner, x, y);
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
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.
|
||||
var tileBox = Box2.UnitCentered.Scale(0.9f);
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Content.Shared.Movement.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!entityManager.GetComponent<GravityComponent>(grid.GridEntityId).EnabledVV)
|
||||
if (!entityManager.GetComponent<GravityComponent>(grid.Owner).EnabledVV)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user