Content changes for mapgrid kill (#12567)

This commit is contained in:
metalgearsloth
2022-11-22 13:12:04 +11:00
committed by GitHub
parent 9170e7ac9d
commit 6c76061887
75 changed files with 192 additions and 123 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Atmos;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using static Content.Server.Explosion.EntitySystems.ExplosionSystem;
namespace Content.Server.Explosion.EntitySystems;
@@ -9,7 +10,7 @@ namespace Content.Server.Explosion.EntitySystems;
/// </summary>
public sealed class ExplosionGridTileFlood : ExplosionTileFlood
{
public IMapGrid Grid;
public MapGridComponent Grid;
private bool _needToTransform = false;
private Matrix3 _matrix = Matrix3.Identity;
@@ -35,7 +36,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
private Dictionary<Vector2i, NeighborFlag> _edgeTiles;
public ExplosionGridTileFlood(
IMapGrid grid,
MapGridComponent grid,
Dictionary<Vector2i, TileData> airtightMap,
float maxIntensity,
float intensityStepSize,
@@ -179,7 +180,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
if (EnteredBlockedTiles.Contains(tile))
return;
// Did the explosion already attempt to enter this tile from some other direction?
// Did the explosion already attempt to enter this tile from some other direction?
if (!UnenteredBlockedTiles.Add(tile))
return;
@@ -203,7 +204,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
if (!EnteredBlockedTiles.Add(tile))
return;
// Did the explosion already attempt to enter this tile from some other direction?
// Did the explosion already attempt to enter this tile from some other direction?
if (UnenteredBlockedTiles.Contains(tile))
{
NewFreedTiles.Add(tile);

View File

@@ -5,6 +5,7 @@ using Content.Shared.Damage;
using Content.Shared.Explosion;
using Content.Shared.FixedPoint;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Explosion.EntitySystems;
@@ -57,7 +58,7 @@ public sealed partial class ExplosionSystem : EntitySystem
/// something like a normal and a reinforced windoor on the same tile. But given that this is a pretty rare
/// occurrence, I am fine with this.
/// </remarks>
public void UpdateAirtightMap(IMapGrid grid, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
public void UpdateAirtightMap(MapGridComponent grid, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
{
var tolerance = new float[_explosionTypes.Count];
var blockedDirections = AtmosDirection.Invalid;

View File

@@ -1,5 +1,7 @@
using Content.Shared.Atmos;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Explosion.EntitySystems;
// This partial part of the explosion system has all of the functions used to facilitate explosions moving across grids.
@@ -289,7 +291,7 @@ public sealed partial class ExplosionSystem : EntitySystem
/// Optionally ignore a specific Vector2i. Used by <see cref="OnTileChanged"/> when we already know that a
/// given tile is not space. This avoids unnecessary TryGetTileRef calls.
/// </remarks>
private bool IsEdge(IMapGrid grid, Vector2i index, out NeighborFlag spaceDirections)
private bool IsEdge(MapGridComponent grid, Vector2i index, out NeighborFlag spaceDirections)
{
spaceDirections = NeighborFlag.Invalid;
for (var i = 0; i < NeighbourVectors.Length; i++)

View File

@@ -4,6 +4,7 @@ using Content.Shared.Explosion;
using Content.Shared.Maps;
using Content.Shared.Physics;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
@@ -194,7 +195,7 @@ public sealed partial class ExplosionSystem : EntitySystem
/// </summary>
/// <returns>True if the underlying tile can be uprooted, false if the tile is blocked by a dense entity</returns>
internal bool ExplodeTile(BroadphaseComponent lookup,
IMapGrid grid,
MapGridComponent grid,
Vector2i tile,
float throwForce,
DamageSpecifier damage,
@@ -494,7 +495,7 @@ sealed class Explosion
/// <summary>
/// The actual grid that this corresponds to. If null, this implies space.
/// </summary>
public IMapGrid? MapGrid;
public MapGridComponent? MapGrid;
}
private readonly List<ExplosionData> _explosionData = new();
@@ -543,7 +544,7 @@ sealed class Explosion
// Variables used for enumerating over tiles, grids, etc
private DamageSpecifier _currentDamage = default!;
private BroadphaseComponent _currentLookup = default!;
private IMapGrid? _currentGrid;
private MapGridComponent? _currentGrid;
private float _currentIntensity;
private float _currentThrowForce;
private List<Vector2i>.Enumerator _currentEnumerator;
@@ -553,7 +554,7 @@ sealed class Explosion
/// The set of tiles that need to be updated when the explosion has finished processing. Used to avoid having
/// the explosion trigger chunk regeneration & shuttle-system processing every tick.
/// </summary>
private readonly Dictionary<IMapGrid, List<(Vector2i, Tile)>> _tileUpdateDict = new();
private readonly Dictionary<MapGridComponent, List<(Vector2i, Tile)>> _tileUpdateDict = new();
// Entity Queries
private readonly EntityQuery<TransformComponent> _xformQuery;
@@ -642,7 +643,7 @@ sealed class Explosion
_explosionData.Add(new()
{
TileLists = grid.TileLists,
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.GridEntityId),
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.Owner),
MapGrid = grid.Grid
});
}

View File

@@ -319,7 +319,7 @@ public sealed partial class ExplosionSystem : EntitySystem
Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tileLists = new();
foreach (var grid in gridData)
{
tileLists.Add(grid.Grid.GridEntityId, grid.TileLists);
tileLists.Add(grid.Grid.Owner, grid.TileLists);
}
return new ExplosionEvent(_explosionCounter, epicenter, id, iterationIntensity, spaceTiles, tileLists, spaceMatrix, spaceData?.TileSize ?? DefaultTileSize);