Table of Contents

Class GridScanManager

Namespace
GridForge.Grids
Assembly
GridForge.dll

Provides efficient querying methods for retrieving occupants within a grid. Handles spatial lookups for voxels, filtering by occupant type, and fetching occupants using unique tickets.

public static class GridScanManager
Inheritance
GridScanManager
Inherited Members

Methods

GetConditionalOccupants(GridWorld, WorldVoxelIndex, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Retrieves occupants whose group Ids match a given condition at a world-scoped voxel identity in the supplied world.

public static IEnumerable<IVoxelOccupant> GetConditionalOccupants(GridWorld world, WorldVoxelIndex index, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

world GridWorld
index WorldVoxelIndex
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Returns

IEnumerable<IVoxelOccupant>

GetConditionalOccupants(VoxelGrid, Vector3d, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Retrieves occupants whose group Ids match a given condition.

public static IEnumerable<IVoxelOccupant> GetConditionalOccupants(this VoxelGrid grid, Vector3d position, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

grid VoxelGrid
position Vector3d
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Returns

IEnumerable<IVoxelOccupant>

GetConditionalOccupants(VoxelGrid, Voxel, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Retrieves occupants at a given voxel that match a specified group condition.

public static IEnumerable<IVoxelOccupant> GetConditionalOccupants(this VoxelGrid grid, Voxel targetVoxel, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

grid VoxelGrid
targetVoxel Voxel
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Returns

IEnumerable<IVoxelOccupant>

GetConditionalOccupants(VoxelGrid, VoxelIndex, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Retrieves occupants whose group Ids match a given condition.

public static IEnumerable<IVoxelOccupant> GetConditionalOccupants(this VoxelGrid grid, VoxelIndex index, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

grid VoxelGrid
index VoxelIndex
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Returns

IEnumerable<IVoxelOccupant>

GetOccupants(GridWorld, WorldVoxelIndex)

Retrieves all occupants at a given world-scoped voxel identity in the supplied world.

public static IEnumerable<IVoxelOccupant> GetOccupants(GridWorld world, WorldVoxelIndex index)

Parameters

world GridWorld
index WorldVoxelIndex

Returns

IEnumerable<IVoxelOccupant>

GetOccupants(VoxelGrid, Vector3d)

Retrieves all occupants at a given world position within the grid.

public static IEnumerable<IVoxelOccupant> GetOccupants(this VoxelGrid grid, Vector3d position)

Parameters

grid VoxelGrid
position Vector3d

Returns

IEnumerable<IVoxelOccupant>

GetOccupants(VoxelGrid, Voxel)

Retrieves all occupants at a given voxel.

public static IEnumerable<IVoxelOccupant> GetOccupants(this VoxelGrid grid, Voxel voxel)

Parameters

grid VoxelGrid
voxel Voxel

Returns

IEnumerable<IVoxelOccupant>

GetOccupants(VoxelGrid, VoxelIndex)

Retrieves all occupants at a given voxel coordinate within the grid.

public static IEnumerable<IVoxelOccupant> GetOccupants(this VoxelGrid grid, VoxelIndex index)

Parameters

grid VoxelGrid
index VoxelIndex

Returns

IEnumerable<IVoxelOccupant>

GetVoxelOccupantsByType<T>(GridWorld, WorldVoxelIndex)

Retrieves all occupants of a specific type at a given world-scoped voxel identity in the supplied world.

public static IEnumerable<T> GetVoxelOccupantsByType<T>(GridWorld world, WorldVoxelIndex index) where T : IVoxelOccupant

Parameters

world GridWorld
index WorldVoxelIndex

Returns

IEnumerable<T>

Type Parameters

T

GetVoxelOccupantsByType<T>(VoxelGrid, Vector3d)

Retrieves all occupants of a specific type at a given world position.

public static IEnumerable<T> GetVoxelOccupantsByType<T>(this VoxelGrid grid, Vector3d position) where T : IVoxelOccupant

Parameters

grid VoxelGrid
position Vector3d

Returns

IEnumerable<T>

Type Parameters

T

GetVoxelOccupantsByType<T>(VoxelGrid, Voxel)

Retrieves all occupants of a specific type at a given voxel.

public static IEnumerable<T> GetVoxelOccupantsByType<T>(this VoxelGrid grid, Voxel voxel) where T : IVoxelOccupant

Parameters

grid VoxelGrid
voxel Voxel

Returns

IEnumerable<T>

Type Parameters

T

GetVoxelOccupantsByType<T>(VoxelGrid, VoxelIndex)

Retrieves all occupants of a specific type at a given voxel coordinate.

public static IEnumerable<T> GetVoxelOccupantsByType<T>(this VoxelGrid grid, VoxelIndex index) where T : IVoxelOccupant

Parameters

grid VoxelGrid
index VoxelIndex

Returns

IEnumerable<T>

Type Parameters

T

ScanRadius(GridWorld, Vector2d, Fixed64, Fixed64, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Scans for occupants within a 2D XZ radius on the supplied world Y layer.

public static IEnumerable<IVoxelOccupant> ScanRadius(GridWorld world, Vector2d position, Fixed64 radius, Fixed64 layerY = default, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

world GridWorld
position Vector2d
radius Fixed64
layerY Fixed64
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Returns

IEnumerable<IVoxelOccupant>

ScanRadius(GridWorld, Vector3d, Fixed64, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Scans for occupants within a given radius from a specified position in the supplied world.

public static IEnumerable<IVoxelOccupant> ScanRadius(GridWorld world, Vector3d position, Fixed64 radius, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

world GridWorld
position Vector3d
radius Fixed64
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Returns

IEnumerable<IVoxelOccupant>

ScanRadiusInto(GridWorld, Vector2d, Fixed64, SwiftList<IVoxelOccupant>, Fixed64, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Clears and fills caller-owned storage with occupants within a 2D XZ radius on the supplied world Y layer.

public static void ScanRadiusInto(GridWorld world, Vector2d position, Fixed64 radius, SwiftList<IVoxelOccupant> results, Fixed64 layerY = default, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

world GridWorld
position Vector2d
radius Fixed64
results SwiftList<IVoxelOccupant>
layerY Fixed64
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

ScanRadiusInto(GridWorld, Vector2d, Fixed64, SwiftList<IVoxelOccupant>, GridScanScratch, Fixed64, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Clears and fills caller-owned storage using caller-owned scratch collections for a 2D XZ radius.

public static void ScanRadiusInto(GridWorld world, Vector2d position, Fixed64 radius, SwiftList<IVoxelOccupant> results, GridScanScratch scratch, Fixed64 layerY = default, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

world GridWorld
position Vector2d
radius Fixed64
results SwiftList<IVoxelOccupant>
scratch GridScanScratch
layerY Fixed64
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

ScanRadiusInto(GridWorld, Vector3d, Fixed64, SwiftList<IVoxelOccupant>, GridScanScratch, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Clears and fills caller-owned storage using caller-owned scratch collections.

public static void ScanRadiusInto(GridWorld world, Vector3d position, Fixed64 radius, SwiftList<IVoxelOccupant> results, GridScanScratch scratch, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

world GridWorld
position Vector3d
radius Fixed64
results SwiftList<IVoxelOccupant>
scratch GridScanScratch
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

ScanRadiusInto(GridWorld, Vector3d, Fixed64, SwiftList<IVoxelOccupant>, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Clears and fills caller-owned storage with occupants within the supplied radius.

public static void ScanRadiusInto(GridWorld world, Vector3d position, Fixed64 radius, SwiftList<IVoxelOccupant> results, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null)

Parameters

world GridWorld
position Vector3d
radius Fixed64
results SwiftList<IVoxelOccupant>
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

ScanRadiusInto<T>(GridWorld, Vector2d, Fixed64, SwiftList<T>, Fixed64, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Clears and fills caller-owned typed storage with occupants within a 2D XZ radius on the supplied world Y layer.

public static void ScanRadiusInto<T>(GridWorld world, Vector2d position, Fixed64 radius, SwiftList<T> results, Fixed64 layerY = default, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null) where T : IVoxelOccupant

Parameters

world GridWorld
position Vector2d
radius Fixed64
results SwiftList<T>
layerY Fixed64
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Type Parameters

T

ScanRadiusInto<T>(GridWorld, Vector2d, Fixed64, SwiftList<T>, GridScanScratch, Fixed64, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Clears and fills caller-owned typed storage using caller-owned scratch collections for a 2D XZ radius.

public static void ScanRadiusInto<T>(GridWorld world, Vector2d position, Fixed64 radius, SwiftList<T> results, GridScanScratch scratch, Fixed64 layerY = default, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null) where T : IVoxelOccupant

Parameters

world GridWorld
position Vector2d
radius Fixed64
results SwiftList<T>
scratch GridScanScratch
layerY Fixed64
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Type Parameters

T

ScanRadiusInto<T>(GridWorld, Vector3d, Fixed64, SwiftList<T>, GridScanScratch, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Clears and fills caller-owned typed storage using caller-owned scratch collections.

public static void ScanRadiusInto<T>(GridWorld world, Vector3d position, Fixed64 radius, SwiftList<T> results, GridScanScratch scratch, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null) where T : IVoxelOccupant

Parameters

world GridWorld
position Vector3d
radius Fixed64
results SwiftList<T>
scratch GridScanScratch
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Type Parameters

T

ScanRadiusInto<T>(GridWorld, Vector3d, Fixed64, SwiftList<T>, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Clears and fills caller-owned storage with typed occupants within the supplied radius.

public static void ScanRadiusInto<T>(GridWorld world, Vector3d position, Fixed64 radius, SwiftList<T> results, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null) where T : IVoxelOccupant

Parameters

world GridWorld
position Vector3d
radius Fixed64
results SwiftList<T>
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Type Parameters

T

ScanRadius<T>(GridWorld, Vector2d, Fixed64, Fixed64, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Scans for occupants of a specific type within a 2D XZ radius on the supplied world Y layer.

public static IEnumerable<T> ScanRadius<T>(GridWorld world, Vector2d position, Fixed64 radius, Fixed64 layerY = default, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null) where T : IVoxelOccupant

Parameters

world GridWorld
position Vector2d
radius Fixed64
layerY Fixed64
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Returns

IEnumerable<T>

Type Parameters

T

ScanRadius<T>(GridWorld, Vector3d, Fixed64, Func<IVoxelOccupant, bool>?, Func<byte, bool>?)

Scans for occupants of a specific type within a given radius in the supplied world.

public static IEnumerable<T> ScanRadius<T>(GridWorld world, Vector3d position, Fixed64 radius, Func<IVoxelOccupant, bool>? occupantCondition = null, Func<byte, bool>? groupCondition = null) where T : IVoxelOccupant

Parameters

world GridWorld
position Vector3d
radius Fixed64
occupantCondition Func<IVoxelOccupant, bool>
groupCondition Func<byte, bool>

Returns

IEnumerable<T>

Type Parameters

T

TryGetVoxelOccupant(GridWorld, WorldVoxelIndex, OccupantTicket, out IVoxelOccupant?)

Retrieves a specific occupant at a given world-scoped voxel identity using an occupant ticket in the supplied world.

public static bool TryGetVoxelOccupant(GridWorld world, WorldVoxelIndex index, OccupantTicket ticket, out IVoxelOccupant? occupant)

Parameters

world GridWorld
index WorldVoxelIndex
ticket OccupantTicket
occupant IVoxelOccupant

Returns

bool

TryGetVoxelOccupant(VoxelGrid, Vector3d, OccupantTicket, out IVoxelOccupant?)

Retrieves a specific occupant at a given world position using an occupant ticket.

public static bool TryGetVoxelOccupant(this VoxelGrid grid, Vector3d position, OccupantTicket ticket, out IVoxelOccupant? occupant)

Parameters

grid VoxelGrid
position Vector3d
ticket OccupantTicket
occupant IVoxelOccupant

Returns

bool

TryGetVoxelOccupant(VoxelGrid, Voxel, OccupantTicket, out IVoxelOccupant?)

Retrieves a specific occupant from a given voxel using an occupant ticket.

public static bool TryGetVoxelOccupant(this VoxelGrid grid, Voxel voxel, OccupantTicket ticket, out IVoxelOccupant? occupant)

Parameters

grid VoxelGrid
voxel Voxel
ticket OccupantTicket
occupant IVoxelOccupant

Returns

bool

TryGetVoxelOccupant(VoxelGrid, VoxelIndex, OccupantTicket, out IVoxelOccupant?)

Retrieves a specific occupant at a given voxel coordinate using an occupant ticket.

public static bool TryGetVoxelOccupant(this VoxelGrid grid, VoxelIndex index, OccupantTicket ticket, out IVoxelOccupant? occupant)

Parameters

grid VoxelGrid
index VoxelIndex
ticket OccupantTicket
occupant IVoxelOccupant

Returns

bool