@@ -370,7 +370,7 @@ namespace Content.Client.DragDrop
|
||||
// TODO: Duplicated in SpriteSystem
|
||||
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition).Position;
|
||||
var bounds = new Box2(mousePos - 1.5f, mousePos + 1.5f);
|
||||
var pvsEntities = IoCManager.Resolve<IEntityLookup>().GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, true);
|
||||
var pvsEntities = IoCManager.Resolve<IEntityLookup>().GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.IncludeAnchored);
|
||||
foreach (var pvsEntity in pvsEntities)
|
||||
{
|
||||
if (!pvsEntity.TryGetComponent(out ISpriteComponent? inRangeSprite) ||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.Actions.Actions
|
||||
if (!args.Performer.TryGetComponent<SharedActionsComponent>(out var actions)) return;
|
||||
|
||||
// find all IGhostBooAffected nearby and do boo on them
|
||||
var ents = IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(args.Performer, _radius, false);
|
||||
var ents = IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(args.Performer, _radius);
|
||||
|
||||
var booCounter = 0;
|
||||
foreach (var ent in ents)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Content.Server.Chat.Commands
|
||||
}
|
||||
}
|
||||
// Get all entities in range of the suicider
|
||||
var entities = IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(owner, 1, true).ToArray();
|
||||
var entities = IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(owner, 1, LookupFlags.Approximate | LookupFlags.IncludeAnchored).ToArray();
|
||||
|
||||
if (entities.Length > 0)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Construction.Conditions
|
||||
var type = _componentFactory.GetRegistration(Component).Type;
|
||||
|
||||
var indices = entity.Transform.Coordinates.ToVector2i(entity.EntityManager, _mapManager);
|
||||
var entities = indices.GetEntitiesInTile(entity.Transform.GridID, true, IoCManager.Resolve<IEntityLookup>());
|
||||
var entities = indices.GetEntitiesInTile(entity.Transform.GridID, LookupFlags.Approximate | LookupFlags.IncludeAnchored, IoCManager.Resolve<IEntityLookup>());
|
||||
|
||||
foreach (var ent in entities)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Content.Server.Construction
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var near in IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(user!, 2f, true))
|
||||
foreach (var near in IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(user!, 2f, LookupFlags.Approximate | LookupFlags.IncludeAnchored))
|
||||
{
|
||||
yield return near;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.Physics.Controllers
|
||||
return;
|
||||
}
|
||||
|
||||
var intersecting = IoCManager.Resolve<IEntityLookup>().GetEntitiesIntersecting(comp.Owner, true);
|
||||
var intersecting = IoCManager.Resolve<IEntityLookup>().GetEntitiesIntersecting(comp.Owner, LookupFlags.Approximate | LookupFlags.IncludeAnchored);
|
||||
var direction = comp.GetAngle().ToVec();
|
||||
Vector2? ownerPos = null;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Shared.Construction.Conditions
|
||||
{
|
||||
var lowWall = false;
|
||||
|
||||
foreach (var entity in location.GetEntitiesInTile(true))
|
||||
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.IncludeAnchored))
|
||||
{
|
||||
if (entity.HasComponent<SharedCanBuildWindowOnTopComponent>())
|
||||
lowWall = true;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Shared.Construction.Conditions
|
||||
{
|
||||
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
|
||||
{
|
||||
foreach (var entity in location.GetEntitiesInTile(true))
|
||||
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.IncludeAnchored))
|
||||
{
|
||||
if (entity.HasComponent<SharedWindowComponent>())
|
||||
return false;
|
||||
|
||||
@@ -148,32 +148,32 @@ namespace Content.Shared.Maps
|
||||
/// Helper that returns all entities in a turf.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static IEnumerable<IEntity> GetEntitiesInTile(this TileRef turf, bool approximate = false, IEntityLookup? lookupSystem = null)
|
||||
public static IEnumerable<IEntity> GetEntitiesInTile(this TileRef turf, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
|
||||
{
|
||||
lookupSystem ??= IoCManager.Resolve<IEntityLookup>();
|
||||
|
||||
return lookupSystem.GetEntitiesIntersecting(turf.MapIndex, GetWorldTileBox(turf), approximate);
|
||||
return lookupSystem.GetEntitiesIntersecting(turf.MapIndex, GetWorldTileBox(turf), flags);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper that returns all entities in a turf.
|
||||
/// </summary>
|
||||
public static IEnumerable<IEntity> GetEntitiesInTile(this EntityCoordinates coordinates, bool approximate = false, IEntityLookup? lookupSystem = null)
|
||||
public static IEnumerable<IEntity> GetEntitiesInTile(this EntityCoordinates coordinates, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
|
||||
{
|
||||
var turf = coordinates.GetTileRef();
|
||||
|
||||
if (turf == null)
|
||||
return Enumerable.Empty<IEntity>();
|
||||
|
||||
return GetEntitiesInTile(turf.Value, approximate, lookupSystem);
|
||||
return GetEntitiesInTile(turf.Value, flags, lookupSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper that returns all entities in a turf.
|
||||
/// </summary>
|
||||
public static IEnumerable<IEntity> GetEntitiesInTile(this Vector2i indices, GridId gridId, bool approximate = false, IEntityLookup? lookupSystem = null)
|
||||
public static IEnumerable<IEntity> GetEntitiesInTile(this Vector2i indices, GridId gridId, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
|
||||
{
|
||||
return GetEntitiesInTile(indices.GetTileRef(gridId), approximate, lookupSystem);
|
||||
return GetEntitiesInTile(indices.GetTileRef(gridId), flags, lookupSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user