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