diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs index aa80aa6f74..7407e696cc 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs @@ -182,7 +182,8 @@ public sealed partial class ExplosionSystem : EntitySystem string id, EntityQuery xformQuery, EntityQuery damageQuery, - EntityQuery physicsQuery) + EntityQuery physicsQuery, + LookupFlags flags) { var gridBox = new Box2(tile * grid.TileSize, (tile + 1) * grid.TileSize); @@ -192,7 +193,8 @@ public sealed partial class ExplosionSystem : EntitySystem void AddIntersecting(List<(EntityUid, TransformComponent?)> listy) { - foreach (var uid in _entityLookup.GetLocalEntitiesIntersecting(lookup, ref gridBox, LookupFlags.None)) + // TODO directly query lookup.Tree + foreach (var uid in _entityLookup.GetLocalEntitiesIntersecting(lookup, ref gridBox, flags)) { if (processed.Contains(uid)) continue; @@ -272,7 +274,8 @@ public sealed partial class ExplosionSystem : EntitySystem string id, EntityQuery xformQuery, EntityQuery damageQuery, - EntityQuery physicsQuery) + EntityQuery physicsQuery, + LookupFlags flags) { var gridBox = new Box2(tile * DefaultTileSize, (DefaultTileSize, DefaultTileSize)); var worldBox = spaceMatrix.TransformBox(gridBox); @@ -280,7 +283,8 @@ public sealed partial class ExplosionSystem : EntitySystem void AddIntersecting(List<(EntityUid, TransformComponent)> listy) { - foreach (var uid in _entityLookup.GetEntitiesIntersecting(lookup, ref worldBox, LookupFlags.None)) + // TODO directly query lookup.Tree + foreach (var uid in _entityLookup.GetEntitiesIntersecting(lookup, ref worldBox, flags)) { if (processed.Contains(uid)) return; @@ -517,6 +521,8 @@ sealed class Explosion /// public readonly int Area; + private readonly LookupFlags _flags = LookupFlags.None; + /// /// factor used to scale the tile break chances. /// @@ -563,6 +569,11 @@ sealed class Explosion _canCreateVacuum = canCreateVacuum; _entMan = entMan; + // yeah this should be a cvar, but this is only temporary anyways + // see lookup todo + if (Area > 100) + _flags |= LookupFlags.Approximate; + _xformQuery = entMan.GetEntityQuery(); _physicsQuery = entMan.GetEntityQuery(); _damageQuery = entMan.GetEntityQuery(); @@ -705,7 +716,8 @@ sealed class Explosion ExplosionType.ID, _xformQuery, _damageQuery, - _physicsQuery); + _physicsQuery, + _flags); // If the floor is not blocked by some dense object, damage the floor tiles. if (canDamageFloor) @@ -725,7 +737,8 @@ sealed class Explosion ExplosionType.ID, _xformQuery, _damageQuery, - _physicsQuery); + _physicsQuery, + _flags); } if (!MoveNext())