Deprecate entitylookupcomponent (#12159)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Shared.Physics;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -188,7 +189,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
/// Find entities on a grid tile using the EntityLookupComponent and apply explosion effects.
|
||||
/// </summary>
|
||||
/// <returns>True if the underlying tile can be uprooted, false if the tile is blocked by a dense entity</returns>
|
||||
internal bool ExplodeTile(EntityLookupComponent lookup,
|
||||
internal bool ExplodeTile(BroadphaseComponent lookup,
|
||||
IMapGrid grid,
|
||||
Vector2i tile,
|
||||
float throwForce,
|
||||
@@ -209,7 +210,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
var state = (list, processed, xformQuery);
|
||||
|
||||
// get entities:
|
||||
lookup.Tree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
lookup.DynamicTree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
lookup.StaticTree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
lookup.SundriesTree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
|
||||
// process those entities
|
||||
foreach (var xform in list)
|
||||
@@ -250,7 +253,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
return !tileBlocked;
|
||||
|
||||
list.Clear();
|
||||
lookup.Tree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
lookup.DynamicTree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
lookup.StaticTree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
lookup.SundriesTree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
|
||||
foreach (var xform in list)
|
||||
{
|
||||
@@ -272,10 +277,18 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool GridQueryCallback(
|
||||
ref (List<TransformComponent> List, HashSet<EntityUid> Processed, EntityQuery<TransformComponent> XformQuery) state,
|
||||
in FixtureProxy proxy)
|
||||
{
|
||||
var owner = proxy.Fixture.Body.Owner;
|
||||
return GridQueryCallback(ref state, in owner);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Same as <see cref="ExplodeTile"/>, but for SPAAAAAAACE.
|
||||
/// </summary>
|
||||
internal void ExplodeSpace(EntityLookupComponent lookup,
|
||||
internal void ExplodeSpace(BroadphaseComponent lookup,
|
||||
Matrix3 spaceMatrix,
|
||||
Matrix3 invSpaceMatrix,
|
||||
Vector2i tile,
|
||||
@@ -295,7 +308,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
var state = (list, processed, invSpaceMatrix, lookup.Owner, xformQuery, gridBox);
|
||||
|
||||
// get entities:
|
||||
lookup.Tree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
lookup.DynamicTree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
lookup.StaticTree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
lookup.SundriesTree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
|
||||
foreach (var xform in state.Item1)
|
||||
{
|
||||
@@ -309,7 +324,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
// Also, throw any entities that were spawned as shrapnel. Compared to entity spawning & destruction, this extra
|
||||
// lookup is relatively minor computational cost, and throwing is disabled for nukes anyways.
|
||||
list.Clear();
|
||||
lookup.Tree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
lookup.DynamicTree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
lookup.StaticTree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
lookup.SundriesTree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
|
||||
foreach (var xform in list)
|
||||
{
|
||||
@@ -342,6 +359,14 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool SpaceQueryCallback(
|
||||
ref (List<TransformComponent> List, HashSet<EntityUid> Processed, Matrix3 InvSpaceMatrix, EntityUid LookupOwner, EntityQuery<TransformComponent> XformQuery, Box2 GridBox) state,
|
||||
in FixtureProxy proxy)
|
||||
{
|
||||
var owner = proxy.Fixture.Body.Owner;
|
||||
return SpaceQueryCallback(ref state, in owner);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function actually applies the explosion affects to an entity.
|
||||
/// </summary>
|
||||
@@ -460,7 +485,7 @@ sealed class Explosion
|
||||
/// <summary>
|
||||
/// Lookup component for this grid (or space/map).
|
||||
/// </summary>
|
||||
public EntityLookupComponent Lookup;
|
||||
public BroadphaseComponent Lookup;
|
||||
|
||||
/// <summary>
|
||||
/// The actual grid that this corresponds to. If null, this implies space.
|
||||
@@ -513,7 +538,7 @@ sealed class Explosion
|
||||
|
||||
// Variables used for enumerating over tiles, grids, etc
|
||||
private DamageSpecifier _currentDamage = default!;
|
||||
private EntityLookupComponent _currentLookup = default!;
|
||||
private BroadphaseComponent _currentLookup = default!;
|
||||
private IMapGrid? _currentGrid;
|
||||
private float _currentIntensity;
|
||||
private float _currentThrowForce;
|
||||
@@ -600,7 +625,7 @@ sealed class Explosion
|
||||
_explosionData.Add(new()
|
||||
{
|
||||
TileLists = spaceData.TileLists,
|
||||
Lookup = entMan.GetComponent<EntityLookupComponent>(mapUid),
|
||||
Lookup = entMan.GetComponent<BroadphaseComponent>(mapUid),
|
||||
MapGrid = null
|
||||
});
|
||||
|
||||
@@ -613,7 +638,7 @@ sealed class Explosion
|
||||
_explosionData.Add(new()
|
||||
{
|
||||
TileLists = grid.TileLists,
|
||||
Lookup = entMan.GetComponent<EntityLookupComponent>(grid.Grid.GridEntityId),
|
||||
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.GridEntityId),
|
||||
MapGrid = grid.Grid
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user