Class StructureUtility
Helper functions for structures.
public static class StructureUtility
- Inheritance
-
StructureUtility
- Inherited Members
Methods
CountStructures(IAssetLink<ItemStructureAsset>, int)
Count the number of structures in the given radius matching an asset.
[Pure]
public static int CountStructures(IAssetLink<ItemStructureAsset> asset, int max = -1)
Parameters
assetIAssetLink<ItemStructureAsset>maxint
Returns
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
Returns
Exceptions
- GameThreadException
Not on main thread.
CountStructuresInRange(Vector3, float, IAssetLink<ItemStructureAsset>, int, bool)
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
positionVector3radiusfloatassetIAssetLink<ItemStructureAsset>maxinthorizontalDistanceOnlybool
Returns
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
Returns
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
positionVector3radiusfloatstructureSelectorPredicate<StructureDrop>maxinthorizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
EnumerateStructures()
Enumerate through all structures around the center of the level.
[Pure]
public static StructureIterator EnumerateStructures()
Returns
Exceptions
- GameThreadException
Not on main thread.
EnumerateStructures(RegionCoord)
Enumerate through all structures around region.
[Pure]
public static StructureIterator EnumerateStructures(RegionCoord region)
Parameters
regionRegionCoord
Returns
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
Returns
Exceptions
- GameThreadException
Not on main thread.
EnumerateStructures(Vector3)
Enumerate through all structures around center.
[Pure]
public static StructureIterator EnumerateStructures(Vector3 center)
Parameters
centerVector3
Returns
Exceptions
- GameThreadException
Not on main thread.
FindStructure(uint)
Find a structure by it's instance ID.
[Pure]
public static StructureInfo FindStructure(uint instanceId)
Parameters
instanceIduint
Returns
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
Returns
Remarks
All regions will be searched if it's not found in the expected region.
Exceptions
- GameThreadException
Not on main thread.
FindStructure(uint, IAssetLink<ItemStructureAsset>, Vector3)
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
instanceIduintexpectedAssetIAssetLink<ItemStructureAsset>expectedPositionVector3
Returns
Remarks
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
instanceIduintexpectedPositionVector3
Returns
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
positionVector3horizontalDistanceOnlybool
Returns
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
Returns
Exceptions
- GameThreadException
Not on main thread.
GetClosestStructure(Vector3, ulong, IAssetLink<ItemStructureAsset>, bool)
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
positionVector3groupulongassetIAssetLink<ItemStructureAsset>horizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
GetClosestStructure(Vector3, IAssetLink<ItemStructureAsset>, bool)
Find the closest structure with the given asset to position.
[Pure]
public static StructureInfo GetClosestStructure(Vector3 position, IAssetLink<ItemStructureAsset> asset, bool horizontalDistanceOnly = false)
Parameters
positionVector3assetIAssetLink<ItemStructureAsset>horizontalDistanceOnlybool
Returns
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
Returns
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
Returns
Exceptions
- GameThreadException
Not on main thread.
GetClosestStructureInRange(Vector3, float, ulong, IAssetLink<ItemStructureAsset>, bool)
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
positionVector3radiusfloatgroupulongassetIAssetLink<ItemStructureAsset>horizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
GetClosestStructureInRange(Vector3, float, IAssetLink<ItemStructureAsset>, bool)
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
positionVector3radiusfloatassetIAssetLink<ItemStructureAsset>horizontalDistanceOnlybool
Returns
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
Returns
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
positionVector3radiusfloatstructureSelectorPredicate<StructureDrop>horizontalDistanceOnlybool
Returns
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
positionVector3radiusfloatgroupulongstructureSelectorPredicate<StructureDrop>horizontalDistanceOnlybool
Returns
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
Returns
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
Returns
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
positionVector3radiusfloatstructureSelectorPredicate<StructureDrop>horizontalDistanceOnlybool
Returns
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
Returns
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
positionVector3radiusfloatgroupulongstructureSelectorPredicate<StructureDrop>horizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
IsStructureInRange(Vector3, float, ulong, IAssetLink<ItemStructureAsset>, bool)
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
positionVector3radiusfloatgroupulongassetIAssetLink<ItemStructureAsset>horizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
IsStructureInRange(Vector3, float, IAssetLink<ItemStructureAsset>, bool)
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
positionVector3radiusfloatassetIAssetLink<ItemStructureAsset>horizontalDistanceOnlybool
Returns
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
dropStructureDropownerCSteamID?groupCSteamID?