Anvil
Anvil.API.Location Class Reference

A location in the module, represented by area, position and orientation. More...

+ Inheritance diagram for Anvil.API.Location:
+ Collaboration diagram for Anvil.API.Location:

Public Member Functions

void ApplyEffect (EffectDuration durationType, Effect effect, TimeSpan duration=default)
 Applies the specified effect at this location. More...
 
void CreateTrap (TrapBaseType trap, float size=2.0f, string tag="", string disarm="", string triggered="")
 Creates the specified trap. More...
 
float Distance (Location target)
 Returns the distance to the target.
If you only need to compare the distance, you can compare the squared distance using DistanceSquared to avoid a costly sqrt operation. More...
 
float DistanceSquared (Location target)
 Returns the squared distance to the target. More...
 
IEnumerable< NwCreatureGetNearestCreatures ()
 Gets all creatures near this location, ordered by distance. More...
 
IEnumerable< NwCreatureGetNearestCreatures (CreatureTypeFilter filter1)
 Gets all creatures near this location, ordered by distance. More...
 
IEnumerable< NwCreatureGetNearestCreatures (CreatureTypeFilter filter1, CreatureTypeFilter filter2)
 Gets all creatures near this location, ordered by distance. More...
 
IEnumerable< NwCreatureGetNearestCreatures (CreatureTypeFilter filter1, CreatureTypeFilter filter2, CreatureTypeFilter filter3)
 Gets all creatures near this location, ordered by distance. More...
 
IEnumerable< T > GetNearestObjectsByType< T > ()
 Gets all objects near this location, ordered by distance. More...
 
IEnumerable< NwGameObjectGetObjectsInShape (Shape shape, float size, bool losCheck, ObjectTypes objTypes=ObjectTypes.Creature, Vector3 origin=default)
 Gets all objects in a shape at this location. More...
 
IEnumerable< T > GetObjectsInShapeByType< T > (Shape shape, float size, bool losCheck, Vector3 origin=default)
 Gets all objects in a shape at this location of the specified type. More...
 
void SetTile (int tileId, TileRotation rotation, int height=0, SettleFlags flags=SettleFlags.RecomputeLighting)
 Changes the tile at this location to a new tile. More...
 
void SetTileAnimationLoops (bool animLoop1, bool animLoop2, bool animLoop3)
 Sets the state of the animation loops of the tile at this location. More...
 
- Public Member Functions inherited from Anvil.API.EngineStructure
void Dispose ()
 

Static Public Member Functions

static ? Location Create (NwArea area, Vector3 position, float orientation)
 Create a new location from the specified area, position and orientation More...
 
static implicit operator Location? (IntPtr intPtr)
 
- Static Public Member Functions inherited from Anvil.API.EngineStructure
static implicit operator IntPtr (EngineStructure engineStructure)
 

Properties

NwArea Area [get]
 Gets the associated Area of this location. More...
 
float FlippedRotation [get]
 Gets the inverted rotation value of this location (placeables). More...
 
float GroundHeight [get]
 Gets the z-offset for the walkmesh at this location. More...
 
bool IsWalkable [get]
 Gets a value indicating whether the location is walkable. More...
 
Vector3 Position [get]
 Gets the position Vector of this location. More...
 
float Rotation [get]
 Gets the rotation value of this location. More...
 
override int StructureId [get]
 
int SurfaceMaterial [get]
 Gets the surface material index at this location.
Returns 0 if the location is invalid or has no surface type. More...
 
int TileHeight [get]
 Gets the height of the tile set at this location. More...
 
int TileId [get]
 Gets the id of the tile set at this location. More...
 
TileInfo?? TileInfo [get]
 Gets the tile information at this location. More...
 
TileMainLightColor TileMainLightColorOne [get]
 Gets the color of the first main light in the tile containing this location. More...
 
TileMainLightColor TileMainLightColorTwo [get]
 Gets the color of the second main light in the tile containing this location. More...
 
TileRotation TileRotation [get]
 Gets the rotation of the tile set at this location. More...
 
TileSourceLightColor TileSourceLightColorOne [get]
 Gets the color of the first light source in the tile containing this location. More...
 
TileSourceLightColor TileSourceLightColorTwo [get]
 Gets the color of the second light source in the tile containing this location. More...
 
- Properties inherited from Anvil.API.EngineStructure
bool IsValid [get]
 Gets if this object is valid. More...
 
abstract int StructureId [get]
 

Additional Inherited Members

- Protected Member Functions inherited from Anvil.API.EngineStructure
 EngineStructure (IntPtr handle, bool memoryOwn)
 

Detailed Description

A location in the module, represented by area, position and orientation.

Member Function Documentation

◆ ApplyEffect()

void Anvil.API.Location.ApplyEffect ( EffectDuration  durationType,
Effect  effect,
TimeSpan  duration = default 
)
inline

Applies the specified effect at this location.

Parameters
durationTypeThe duration type to apply with this effect.
effectThe effect to apply.
durationIf duration type is EffectDuration.Temporary, the duration of this effect.

◆ Create()

static ? Location Anvil.API.Location.Create ( NwArea  area,
Vector3  position,
float  orientation 
)
inlinestatic

Create a new location from the specified area, position and orientation

Parameters
areaThe area of the location.
positionThe position of the location.
orientationThe rotation of the location.
Returns
The created location.

◆ CreateTrap()

void Anvil.API.Location.CreateTrap ( TrapBaseType  trap,
float  size = 2.0f,
string  tag = "",
string  disarm = "",
string  triggered = "" 
)
inline

Creates the specified trap.

Parameters
trapThe base type of trap.
sizeThe size of the trap. Minimum size allowed is 1.0f. If no value set, defaults to 2.0f.
tagThe tag of the trap being created. If no value set, defaults to an empty string.
disarmThe script that will fire when the trap is disarmed. If no value set, defaults to an empty string and no script will fire.
triggeredThe script that will fire when the trap is triggered. If no value set, defaults to an empty string and the default OnTrapTriggered script for the trap type specified will fire instead (as specified in the traps.2da).

◆ Distance()

float Anvil.API.Location.Distance ( Location  target)
inline

Returns the distance to the target.
If you only need to compare the distance, you can compare the squared distance using DistanceSquared to avoid a costly sqrt operation.

Parameters
targetThe other location to calculate distance between.
Returns
The distance in game units, or -1 if the target is in a different area.

◆ DistanceSquared()

float Anvil.API.Location.DistanceSquared ( Location  target)
inline

Returns the squared distance to the target.

Parameters
targetThe other location to calculate distance between.
Returns
The squared distance in game units, or -1 if the target is in a different area.

◆ GetNearestCreatures() [1/4]

IEnumerable<NwCreature> Anvil.API.Location.GetNearestCreatures ( )
inline

Gets all creatures near this location, ordered by distance.

◆ GetNearestCreatures() [2/4]

IEnumerable<NwCreature> Anvil.API.Location.GetNearestCreatures ( CreatureTypeFilter  filter1)
inline

Gets all creatures near this location, ordered by distance.

Parameters
filter1A filter for the returned creatures.

◆ GetNearestCreatures() [3/4]

IEnumerable<NwCreature> Anvil.API.Location.GetNearestCreatures ( CreatureTypeFilter  filter1,
CreatureTypeFilter  filter2 
)
inline

Gets all creatures near this location, ordered by distance.

Parameters
filter1A filter for the returned creatures.
filter2A 2nd filter for the returned creatures.

◆ GetNearestCreatures() [4/4]

IEnumerable<NwCreature> Anvil.API.Location.GetNearestCreatures ( CreatureTypeFilter  filter1,
CreatureTypeFilter  filter2,
CreatureTypeFilter  filter3 
)
inline

Gets all creatures near this location, ordered by distance.

Parameters
filter1A filter for the returned creatures.
filter2A 2nd filter for the returned creatures.
filter3A 3rd filter for the returned creatures.

◆ GetNearestObjectsByType< T >()

IEnumerable<T> Anvil.API.Location.GetNearestObjectsByType< T > ( )
inline

Gets all objects near this location, ordered by distance.

Type Constraints
T :NwGameObject 

◆ GetObjectsInShape()

IEnumerable<NwGameObject> Anvil.API.Location.GetObjectsInShape ( Shape  shape,
float  size,
bool  losCheck,
ObjectTypes  objTypes = ObjectTypes.Creature,
Vector3  origin = default 
)
inline

Gets all objects in a shape at this location.

◆ GetObjectsInShapeByType< T >()

IEnumerable<T> Anvil.API.Location.GetObjectsInShapeByType< T > ( Shape  shape,
float  size,
bool  losCheck,
Vector3  origin = default 
)
inline

Gets all objects in a shape at this location of the specified type.

Type Constraints
T :NwGameObject 

◆ SetTile()

void Anvil.API.Location.SetTile ( int  tileId,
TileRotation  rotation,
int  height = 0,
SettleFlags  flags = SettleFlags.RecomputeLighting 
)
inline

Changes the tile at this location to a new tile.

Parameters
tileIdThe new tile to apply.
rotationHow the tile should be rotated.
heightThe height of the tile.
flagsAdditional flags/behaviours to run after the tile is updated.

◆ SetTileAnimationLoops()

void Anvil.API.Location.SetTileAnimationLoops ( bool  animLoop1,
bool  animLoop2,
bool  animLoop3 
)
inline

Sets the state of the animation loops of the tile at this location.

Property Documentation

◆ Area

NwArea Anvil.API.Location.Area
get

Gets the associated Area of this location.

◆ FlippedRotation

float Anvil.API.Location.FlippedRotation
get

Gets the inverted rotation value of this location (placeables).

◆ GroundHeight

float Anvil.API.Location.GroundHeight
get

Gets the z-offset for the walkmesh at this location.

◆ IsWalkable

bool Anvil.API.Location.IsWalkable
get

Gets a value indicating whether the location is walkable.

◆ Position

Vector3 Anvil.API.Location.Position
get

Gets the position Vector of this location.

◆ Rotation

float Anvil.API.Location.Rotation
get

Gets the rotation value of this location.

◆ SurfaceMaterial

int Anvil.API.Location.SurfaceMaterial
get

Gets the surface material index at this location.
Returns 0 if the location is invalid or has no surface type.

◆ TileHeight

int Anvil.API.Location.TileHeight
get

Gets the height of the tile set at this location.

◆ TileId

int Anvil.API.Location.TileId
get

Gets the id of the tile set at this location.

◆ TileInfo

TileInfo?? Anvil.API.Location.TileInfo
get

Gets the tile information at this location.

◆ TileMainLightColorOne

TileMainLightColor Anvil.API.Location.TileMainLightColorOne
get

Gets the color of the first main light in the tile containing this location.

Returns
A TileMainLightColor value representing the main light color of the specified tile.

◆ TileMainLightColorTwo

TileMainLightColor Anvil.API.Location.TileMainLightColorTwo
get

Gets the color of the second main light in the tile containing this location.

Returns
A TileMainLightColor value representing the second main light color of the specified tile.

◆ TileRotation

TileRotation Anvil.API.Location.TileRotation
get

Gets the rotation of the tile set at this location.

◆ TileSourceLightColorOne

TileSourceLightColor Anvil.API.Location.TileSourceLightColorOne
get

Gets the color of the first light source in the tile containing this location.

Returns
A TileSourceLightColor value representing the first light source color of the specified tile.

◆ TileSourceLightColorTwo

TileSourceLightColor Anvil.API.Location.TileSourceLightColorTwo
get

Gets the color of the second light source in the tile containing this location.

Returns
A TileSourceLightColor value representing the second light source color of the specified tile.

The documentation for this class was generated from the following file: