Atmos device performance improvements (#26493)
* Atmos device performance improvements * AtmosDirection perf improvements * Fix errors * Add GasTileOverlayComponent arguments * Make excite no longer invalidate a tile
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.Reactions;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -160,7 +159,7 @@ public sealed partial class AtmosphereSystem
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update array of adjacent tiles and the adjacency flags. Optionally activates all tiles with modified adjacencies.
|
||||
/// Update array of adjacent tiles and the adjacency flags.
|
||||
/// </summary>
|
||||
private void UpdateAdjacentTiles(
|
||||
Entity<GridAtmosphereComponent, GasTileOverlayComponent, MapGridComponent, TransformComponent> ent,
|
||||
@@ -195,14 +194,16 @@ public sealed partial class AtmosphereSystem
|
||||
if (activate)
|
||||
AddActiveTile(atmos, adjacent);
|
||||
|
||||
var oppositeDirection = direction.GetOpposite();
|
||||
var oppositeIndex = i.ToOppositeIndex();
|
||||
var oppositeDirection = (AtmosDirection) (1 << oppositeIndex);
|
||||
|
||||
if (adjBlockDirs.IsFlagSet(oppositeDirection) || blockedDirs.IsFlagSet(direction))
|
||||
{
|
||||
// Adjacency is blocked by some airtight entity.
|
||||
tile.AdjacentBits &= ~direction;
|
||||
adjacent.AdjacentBits &= ~oppositeDirection;
|
||||
tile.AdjacentTiles[i] = null;
|
||||
adjacent.AdjacentTiles[oppositeDirection.ToIndex()] = null;
|
||||
adjacent.AdjacentTiles[oppositeIndex] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -210,7 +211,7 @@ public sealed partial class AtmosphereSystem
|
||||
tile.AdjacentBits |= direction;
|
||||
adjacent.AdjacentBits |= oppositeDirection;
|
||||
tile.AdjacentTiles[i] = adjacent;
|
||||
adjacent.AdjacentTiles[oppositeDirection.ToIndex()] = tile;
|
||||
adjacent.AdjacentTiles[oppositeIndex] = tile;
|
||||
}
|
||||
|
||||
DebugTools.Assert(!(tile.AdjacentBits.IsFlagSet(direction) ^
|
||||
|
||||
Reference in New Issue
Block a user