Table of Contents

Class StructureUtility

Namespace
Uncreated.Warfare.Util
Assembly
Uncreated.Warfare.dll

Helper functions for structures.

public static class StructureUtility
Inheritance
StructureUtility
Inherited Members

Methods

Count the number of structures in the given radius matching an asset.

[Pure]
public static int CountStructures(IAssetLink<ItemStructureAsset> asset, int max = -1)

Parameters

asset IAssetLink<ItemStructureAsset>
max int

Returns

int

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

CountStructuresInRange(Vector3, float, int, bool)

Count the number of structures in the given radius.

[Pure]
public static int CountStructuresInRange(Vector3 position, float radius, int max = -1, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
max int
horizontalDistanceOnly bool

Returns

int

Exceptions

GameThreadException

Not on main thread.

Count the number of structures in the given radius matching an asset.

[Pure]
public static int CountStructuresInRange(Vector3 position, float radius, IAssetLink<ItemStructureAsset> asset, int max = -1, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
asset IAssetLink<ItemStructureAsset>
max int
horizontalDistanceOnly bool

Returns

int

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

CountStructuresWhere(Predicate<StructureDrop>, int)

Count the number of structures in the given radius matching a predicate.

[Pure]
public static int CountStructuresWhere(Predicate<StructureDrop> structureSelector, int max = -1)

Parameters

structureSelector Predicate<StructureDrop>
max int

Returns

int

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

CountStructuresWhere(Vector3, float, Predicate<StructureDrop>, int, bool)

Count the number of structures in the given radius matching a predicate.

[Pure]
public static int CountStructuresWhere(Vector3 position, float radius, Predicate<StructureDrop> structureSelector, int max = -1, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
structureSelector Predicate<StructureDrop>
max int
horizontalDistanceOnly bool

Returns

int

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

EnumerateStructures()

Enumerate through all structures around the center of the level.

[Pure]
public static StructureIterator EnumerateStructures()

Returns

StructureIterator

Exceptions

GameThreadException

Not on main thread.

EnumerateStructures(RegionCoord)

Enumerate through all structures around region.

[Pure]
public static StructureIterator EnumerateStructures(RegionCoord region)

Parameters

region RegionCoord

Returns

StructureIterator

Exceptions

GameThreadException

Not on main thread.

EnumerateStructures(byte, byte)

Enumerate through all structures around region x, y.

[Pure]
public static StructureIterator EnumerateStructures(byte x, byte y)

Parameters

x byte
y byte

Returns

StructureIterator

Exceptions

GameThreadException

Not on main thread.

EnumerateStructures(Vector3)

Enumerate through all structures around center.

[Pure]
public static StructureIterator EnumerateStructures(Vector3 center)

Parameters

center Vector3

Returns

StructureIterator

Exceptions

GameThreadException

Not on main thread.

FindStructure(uint)

Find a structure by it's instance ID.

[Pure]
public static StructureInfo FindStructure(uint instanceId)

Parameters

instanceId uint

Returns

StructureInfo

Exceptions

GameThreadException

Not on main thread.

FindStructure(uint, byte, byte)

Find a structure by it's instance ID, with help from an expected region to prevent having to search every region.

[Pure]
public static StructureInfo FindStructure(uint instanceId, byte expectedRegionX, byte expectedRegionY)

Parameters

instanceId uint
expectedRegionX byte
expectedRegionY byte

Returns

StructureInfo

Remarks

All regions will be searched if it's not found in the expected region.

Exceptions

GameThreadException

Not on main thread.

Find a structure by it's instance ID, with help from an expected region to prevent having to search every region.

[Pure]
public static StructureInfo FindStructure(uint instanceId, IAssetLink<ItemStructureAsset> expectedAsset, Vector3 expectedPosition)

Parameters

instanceId uint
expectedAsset IAssetLink<ItemStructureAsset>
expectedPosition Vector3

Returns

StructureInfo

All regions will be searched if it's not found in the expected region. Only instance ID is checked on planted structures.

Exceptions

GameThreadException

Not on main thread.

FindStructure(uint, Vector3)

Find a structure by it's instance ID, with help from a position to prevent having to search every region.

[Pure]
public static StructureInfo FindStructure(uint instanceId, Vector3 expectedPosition)

Parameters

instanceId uint
expectedPosition Vector3

Returns

StructureInfo

Remarks

All regions will be searched if it's not found near the expected position.

Exceptions

GameThreadException

Not on main thread.

GetClosestStructure(Vector3, bool)

Find the closest structure to position.

[Pure]
public static StructureInfo GetClosestStructure(Vector3 position, bool horizontalDistanceOnly = false)

Parameters

position Vector3
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

GameThreadException

Not on main thread.

GetClosestStructure(Vector3, ulong, bool)

Find the closest structure to position with the given group.

[Pure]
public static StructureInfo GetClosestStructure(Vector3 position, ulong group, bool horizontalDistanceOnly = false)

Parameters

position Vector3
group ulong
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

GameThreadException

Not on main thread.

Find the closest structure with the given asset to position with the given group.

[Pure]
public static StructureInfo GetClosestStructure(Vector3 position, ulong group, IAssetLink<ItemStructureAsset> asset, bool horizontalDistanceOnly = false)

Parameters

position Vector3
group ulong
asset IAssetLink<ItemStructureAsset>
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

Find the closest structure with the given asset to position.

[Pure]
public static StructureInfo GetClosestStructure(Vector3 position, IAssetLink<ItemStructureAsset> asset, bool horizontalDistanceOnly = false)

Parameters

position Vector3
asset IAssetLink<ItemStructureAsset>
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

GetClosestStructureInRange(Vector3, float, bool)

Find the closest structure to position within the given radius.

[Pure]
public static StructureInfo GetClosestStructureInRange(Vector3 position, float radius, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

GameThreadException

Not on main thread.

GetClosestStructureInRange(Vector3, float, ulong, bool)

Find the closest structure to position within the given radius and group.

[Pure]
public static StructureInfo GetClosestStructureInRange(Vector3 position, float radius, ulong group, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
group ulong
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

GameThreadException

Not on main thread.

Find the closest structure with the given asset to position within the given radius and group.

[Pure]
public static StructureInfo GetClosestStructureInRange(Vector3 position, float radius, ulong group, IAssetLink<ItemStructureAsset> asset, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
group ulong
asset IAssetLink<ItemStructureAsset>
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

Find the closest structure with the given asset to position within the given radius.

[Pure]
public static StructureInfo GetClosestStructureInRange(Vector3 position, float radius, IAssetLink<ItemStructureAsset> asset, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
asset IAssetLink<ItemStructureAsset>
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

GetClosestStructureWhere(Vector3, Predicate<StructureDrop>, bool)

Find the closest structure matching a predicate to position.

[Pure]
public static StructureInfo GetClosestStructureWhere(Vector3 position, Predicate<StructureDrop> structureSelector, bool horizontalDistanceOnly = false)

Parameters

position Vector3
structureSelector Predicate<StructureDrop>
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

GetClosestStructureWhere(Vector3, float, Predicate<StructureDrop>, bool)

Find the closest structure matching a predicate to position within a given radius.

[Pure]
public static StructureInfo GetClosestStructureWhere(Vector3 position, float radius, Predicate<StructureDrop> structureSelector, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
structureSelector Predicate<StructureDrop>
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

GetClosestStructureWhere(Vector3, float, ulong, Predicate<StructureDrop>, bool)

Find the closest structure matching a predicate to position within a given radius and group.

[Pure]
public static StructureInfo GetClosestStructureWhere(Vector3 position, float radius, ulong group, Predicate<StructureDrop> structureSelector, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
group ulong
structureSelector Predicate<StructureDrop>
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

GetClosestStructureWhere(Vector3, ulong, Predicate<StructureDrop>, bool)

Find the closest structure matching a predicate to position with the given group.

[Pure]
public static StructureInfo GetClosestStructureWhere(Vector3 position, ulong group, Predicate<StructureDrop> structureSelector, bool horizontalDistanceOnly = false)

Parameters

position Vector3
group ulong
structureSelector Predicate<StructureDrop>
horizontalDistanceOnly bool

Returns

StructureInfo

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

IsStructureInRange(Vector3, float, bool)

Check for a nearby structure to position within the given radius.

[Pure]
public static bool IsStructureInRange(Vector3 position, float radius, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
horizontalDistanceOnly bool

Returns

bool

Exceptions

GameThreadException

Not on main thread.

IsStructureInRange(Vector3, float, Predicate<StructureDrop>, bool)

Check for a nearby structure matching a predicate to position within the given radius.

[Pure]
public static bool IsStructureInRange(Vector3 position, float radius, Predicate<StructureDrop> structureSelector, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
structureSelector Predicate<StructureDrop>
horizontalDistanceOnly bool

Returns

bool

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

IsStructureInRange(Vector3, float, ulong, bool)

Check for a nearby structure to position within the given radius and group.

[Pure]
public static bool IsStructureInRange(Vector3 position, float radius, ulong group, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
group ulong
horizontalDistanceOnly bool

Returns

bool

Exceptions

GameThreadException

Not on main thread.

IsStructureInRange(Vector3, float, ulong, Predicate<StructureDrop>, bool)

Check for a nearby structure matching a predicate to position within the given radius and group.

[Pure]
public static bool IsStructureInRange(Vector3 position, float radius, ulong group, Predicate<StructureDrop> structureSelector, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
group ulong
structureSelector Predicate<StructureDrop>
horizontalDistanceOnly bool

Returns

bool

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

Check for a nearby structure with the given asset to position within the given radius and group.

[Pure]
public static bool IsStructureInRange(Vector3 position, float radius, ulong group, IAssetLink<ItemStructureAsset> asset, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
group ulong
asset IAssetLink<ItemStructureAsset>
horizontalDistanceOnly bool

Returns

bool

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

Check for a nearby structure with the given asset to position within the given radius.

[Pure]
public static bool IsStructureInRange(Vector3 position, float radius, IAssetLink<ItemStructureAsset> asset, bool horizontalDistanceOnly = false)

Parameters

position Vector3
radius float
asset IAssetLink<ItemStructureAsset>
horizontalDistanceOnly bool

Returns

bool

Exceptions

ArgumentNullException
GameThreadException

Not on main thread.

SetOwnerOrGroup(StructureDrop, CSteamID?, CSteamID?)

Set the owner and/or group of a structure.

public static void SetOwnerOrGroup(StructureDrop drop, CSteamID? owner = null, CSteamID? group = null)

Parameters

drop StructureDrop
owner CSteamID?
group CSteamID?