Replace GridEntityId with Owner (#12743)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user