mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02:00
Add GetLocalEntitiesIntersecting for griduid + tilesize (#4807)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Robust.Shared.GameObjects;
|
||||
@@ -9,6 +10,25 @@ public sealed partial class EntityLookupSystem
|
||||
* Local AABB / Box2Rotated queries for broadphase entities.
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Gets the entities intersecting the specified broadphase entity using a local AABB.
|
||||
/// </summary>
|
||||
public void GetLocalEntitiesIntersecting(EntityUid gridUid, Vector2i localTile, HashSet<EntityUid> intersecting,
|
||||
float enlargement = TileEnlargementRadius, LookupFlags flags = DefaultFlags, MapGridComponent? gridComp = null)
|
||||
{
|
||||
ushort tileSize = 1;
|
||||
|
||||
if (_gridQuery.Resolve(gridUid, ref gridComp))
|
||||
{
|
||||
tileSize = gridComp.TileSize;
|
||||
}
|
||||
|
||||
var localAABB = GetLocalBounds(localTile, tileSize);
|
||||
localAABB = localAABB.Enlarged(TileEnlargementRadius);
|
||||
AddLocalEntitiesIntersecting(gridUid, intersecting, localAABB, flags);
|
||||
AddContained(intersecting, flags);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the entities intersecting the specified broadphase entity using a local AABB.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user