LuaDoc_CObject.md.html - yasumitsu/JaggedAlliance3Modding GitHub Wiki

CObject Overview

CObjects are objects, accessible to Lua, which have a counterpart in the C++ side of the engine.

They do not have allocated memory in the Lua side, and therefore cannot store any information.

Reference: CObject

Parent classes

CObject reference

CObject:Attach

Attaches one object to another at a specified spot.

void CObject:Attach(object child, int spot) object child : object to be attached

int spot : spot numeric index

CObject:ChangeEntity

Changes the object's entity.

void CObject:ChangeEntity(string entity) string entity : the entity name

CObject:ClearEnumFlags

Clear the object's enumeration flags.

void CObject:ClearEnumFlags(int mask) int mask : mask containing the flags to be cleared.

Example:

obj:ClearEnumFlags(const.efVisible)
-- the object is now invisible

CObject:ClearGameFlags

Clear the object's game flags.

void CObject:ClearGameFlags(int mask) int mask : mask containing the flags to be cleared.

Example:

obj:ClearGameFlags(const.gofAlwaysRenderable)
-- the object wont be drawn when outside the camera view

CObject:CountAttaches

Counts object attaches based on certain criteria

int CObject:CountAttaches([string classes], [function filter], ...) string classes : an optional comma separated list of classes, to filter the attached objects. If not provided, all attaches shall be processed.

function filter : an optional function to test if an attach is to be counted. Any parameter provided after the callback, would be passed to it when called.

returns int : the count of matched attaches.

Example:

local count = obj:CountAttaches("foo, bar", function(obj) return not obj:GetVisible() end)
-- 'count' equals the number of the invisible attaches form the classes "foo" and "bar"

CObject:DestroyAttaches

Destroys object attaches based on certain criteria

int CObject:DestroyAttaches([string classes], [function filter], ...) string classes : an optional comma separated list of classes, to filter the attached objects. If not provided, all attaches shall be processed.

function filter : an optional function to test if an attach is to be deleted. Any parameter provided after the callback, would be passed to it when called.

returns int : the count of matched attaches.

Example:

obj:DestroyAttaches("foo, bar", function(obj) return not obj:GetVisible() end)
-- all invisible attaches form the classes "foo" and "bar" are now destroyed

CObject:Detach

Detach an attached object from its parent.

void CObject:Detach()

CObject:DetachFromMap

Removes the object from the map. The object's position wont be valid any more.

void CObject:DetachFromMap()

CObject:ForEachAttach

Calls a function callback for each attached object from a list of classes

int CObject:ForEachAttach([string classes], function callback, ...) string classes : an optional comma separated list of classes, to filter the attached objects. If not provided, all attaches shall be processed.

function callback : a function to call for each attach. Any parameter provided after the callback, would be passed to it when called.

returns int : the count of matched attaches.

Example:

obj:ForEachAttach("foo, bar", function(obj, visible) obj:SetVisible(visible) end, false)
-- all attaches form the classes "foo" and "bar" are now invisible

CObject:GetAccelerationAndTime

Computes the linear acceleration and the time needed to reach a target position with a given final speed.

int, int CObject:GetAccelerationAndTime(point pos, int speed, [int speed0])

int, int CObject:GetAccelerationAndTime(int x, int y, int z, int speed, [int speed0]) point pos : the target position as a point

int x, y, z : the target position as coordinates

int speed : the desired final speed

int speed0 : the initial speed (optional, the current speed by default)

returns int, int : the acceleration and the time

Example:

local accel, time = obj:GetAccelerationAndTime(pos, 0)
obj:SetAcceleration(accel)
obj:SetPos(pos, time)
-- the object will slowly stop at the target position

CObject:GetAngle

Returns the final rotation angle of an object.

The visual angle is different from the final angle, only when the object is still rotating.

int CObject:GetAngle() returns int : final rotation angle.

CObject:GetAttaches

Collects the attaches from given class(es). If no class is specified, then all attached objects shall be collected.

table CObject:GetAttaches([string class])

table CObject:GetAttaches([table classes]) string class : an optional class name, to filter the attached objects.

table classes : an optional class list, to filter the attached objects.

returns table : a list containing the matched attaches, or nil if none has been found.

Example:

local attaches = obj:GetAttaches("foo")
-- 'attaches' containts all attached objects form the class "foo"

CObject:GetAxis

Returns the rotation axis of an object.

point CObject:GetAxis() returns point : rotation axis vector as point

CObject:GetClassFlags

Returns the object's class flags. All object flags are represented as a single bit (0 or 1).

int CObject:GetClassFlags([int mask]) int mask : optional flag mask, used to check if the object contains specific flags.

returns int : the object's enumeration flags, masked with the mask if provided.

Example:

if obj:GetClassFlags(const.cfDecal) ~= 0 then
-- the object is a decal
end

CObject:GetDist

Computes the distance from the object's final position to another position.

int CObject:GetDist(object obj)

int CObject:GetDist(box bx)

int CObject:GetDist(point pos) object obj : check distance to an object

box bx : check distance to a box

point pos : check distance to a position

returns int : the computed distance

CObject:GetEntityBBox

Returns the bounding box of the current state of the object with mirroring applied, but without applying object's position, scale and orientation.

box CObject:GetEntityBBox() returns box : the bounding box of the entity.

CObject:GetEnumFlags

Returns the object's enumeration flags. All object flags are represented as a single bit (0 or 1).

int CObject:GetEnumFlags([int mask]) int mask : optional flag mask, used to check if the object contains specific flags.

returns int : the object's enumeration flags, masked with the mask if provided.

Example:

if obj:GetEnumFlags(const.efVisible) ~= 0 then
-- the object is visible
end

CObject:GetFreeSpot

Returns an index of a spot from a given type with no attaches

int CObject:GetFreeSpot(string spot) string spot : spot type name

returns int : the spot index, -1 if not found.

CObject:GetGameFlags

Returns the object's game flags. All object flags are represented as a single bit (0 or 1).

int CObject:GetGameFlags([int mask]) int mask : optional flag mask, used to check if the object contains specific flags.

returns int : the object's game flags, masked with the mask if provided.

Example:

if obj:GetGameFlags(const.gofAlwaysRenderable) ~= 0 then
-- the object is drawn even when outside the camera view
end

CObject:GetMaxRadius

Returns the maximim object's entity radius in any of its states (animations).

int CObject:GetMaxRadius() returns int : object's max radius.

CObject:GetNearestSpot

Returns the index of the nearest spot to a specified location

int CObject:GetNearestSpot(string spot, point pos)

int CObject:GetNearestSpot(string spot, object obj) string spot : spot type name

point pos : location as point

object obj : location as object

returns int : the spot index, -1 if not found.

CObject:GetNumStates

Returns the number of valid states (animations) for current object.

int CObject:GetNumStates() returns int : number of states

CObject:GetObjectBBox

Returns the object's bounding box in its current state (animation).

box CObject:GetObjectBBox() returns box : the object's bounding box.

CObject:GetParent

Returns the parent object (if the current object is attached).

object CObject:GetParent() returns object : the parent object if any, nil otherwise

CObject:GetPos

Returns the final map position of an object .

The visual position is different from the final position, only when the object is still moving.

point CObject:GetPos() returns point : final map position.

CObject:GetPosXYZ

Same as GetPos, but returns the coordinates of the position.

int, int, int CObject:GetPosXYZ() returns int, int, int : coordinates of the final map position.

CObject:GetRadius

Returns the object's entity radius in its current state (animation). For objects without entity, the radius can be specified as a member 'radius' in the class definition.

int CObject:GetRadius() returns int : object's radius.

CObject:GetRandomSpot

Returns the index of a random spot from a given type

int CObject:GetRandomSpot(string spot) string spot : spot type name

returns int : the spot index, -1 if not found.

CObject:GetRelativePoint

Computes the world position of a point relative to an object.

point CObject:GetRelativePoint(point pos)

point CObject:GetRelativePoint(int x, int y, int z) point pos : position relative to the object as a point.

int x, y, z : position relative to the object as coordinates.

Example:

local pos = obj:GetRelativePoint(0, 0, 10*guim)
-- 'pos' is located 10 meters above the object

CObject:GetRollPitchYaw

Returns the object's orientation as roll, pitch and yaw angles.

int CObject:GetRollPitchYaw([int time_delta]) int time_delta : optional time interval in the future, thus enabling to get a future orientation.

returns int, int, int : the object's roll, pitch and yaw angle.

CObject:GetScale

Returns the object's scale (disregarding parent hierarchy).

int CObject:GetScale() returns int : the object's scale in percent (100% is the default).

CObject:GetSpotAxisAngle

Returns the rotation of the specified spot around it's rotation axis.

angle axis CObject:GetSpotAxisAngle(int spot) int spot : spot index.

returns point axis : the spot rotation axis vector as point.

returns int angle : the spot rotation.

CObject:GetSpotBeginIndex

Returns the first spot index from a given spot type for an object

int, int CObject:GetSpotBeginIndex(string spot) string spot : spot name

returns int : the spot index, -1 if not found.

CObject:GetSpotEndIndex

Returns the last spot index from a given spot type for an object

int, int CObject:GetSpotEndIndex(string spot) string spot : spot name

returns int : the spot index, -1 if not found.

CObject:GetSpotPos

Returns the final world position of the specified spot.

point CObject:GetSpotPos(int spot) int spot : spot index.

returns point : the spot position.

CObject:GetSpotPosXYZ

Same as GetSpotPos but the returned values are the position's coordinates.

int, int, int CObject:GetSpotPosXYZ(int spot) int spot : spot index.

returns int, int, int : the coordinates of the spot position.

CObject:GetSpotRange

Returns the first and the last spot indexes from a given spot type for an object

int, int CObject:GetSpotRange(string spot) string spot : spot name

returns int, int : the spot indexes, -1 if not found.

CObject:GetState

Gets the object's current state index (animation index).

int CObject:GetState() returns int : the state index

CObject:GetVisualAngle

Returns the visual rotation angle of an object.

The visual angle is different from the final angle, only when the object is still rotating.

int CObject:GetVisualAngle() returns int : visual rotation angle.

CObject:GetVisualDist

Computes the distance from the object's visual position to another position.

int CObject:GetVisualDist(object obj)

int CObject:GetVisualDist(box bx)

int CObject:GetVisualDist(point pos) object obj : check distance to an object

box bx : check distance to a box

point pos : check distance to a position

returns int : the computed distance

CObject:GetVisualPos

Returns the visual position of an object.

The visual position is different from the final position, only when the objects is still moving.

point CObject:GetVisualPos([int time_delta = 0], [bool extrapolate = false]) int time_delta : optional parameter to specify a different moment than now.

bool extrapolate : if true and if the provided time exceeds the movement time, avoids the clamping.

returns point : visual position.

CObject:GetVisualPos2D

Same as GetVisualPos, but the returned position is only two dimensional.

point CObject:GetVisualPos2D([int time], [bool extrapolate = false]) returns point : visual 2D position.

CObject:GetVisualPosXYZ

Same as GetVisualPos, but the returned values are the object coordinates.

int, int, int CObject:GetVisualPosXYZ([int time_delta = 0], [bool extrapolate = false]) returns int, int, int : visual coordinates X, Y and Z.

CObject:GetVisualScale

Returns the object's current visual scale (disregarding parent hierarchy).

int CObject:GetVisualScale(int delta = 0) returns int : the object's scale in percent (100% is the default).

CObject:GetVisualWorldScale

Returns the object's world current visual scale (considering parent hierarchy).

int CObject:GetVisualWorldScale(int delta = 0) returns int : the object's world scale in percent (100% is the default).

CObject:GetVisualZ

Same as GetVisualPos, but returns only the Z coordinate of the visual map position.

int CObject:GetVisualZ([int time_delta = 0], [bool extrapolate = false]) returns int : Z coordinate of the visual map position.

CObject:GetWorldScale

Returns the object's world scale (considering parent hierarchy).

int CObject:GetWorldScale() returns int : the object's world scale in percent (100% is the default).

CObject:GetZ

Same as GetPos, but returns only the Z coordinate of the final map position, or nil if on the terrain.

int CObject:GetZ() returns int : Z coordinate of the final map position.

CObject:HasAllSurfaces

Checks if the object's entity has specific surfaces.

bool CObject:HasAllSurfaces(int mask, [bool hierarchical]) int mask : A mask of the surfaces in question. See the 'EntitySurfaces' global for a list of surfaces and their masks.

bool hierarchical : Checks the attached objects too.

returns bool : Returns true if the entity has all of those surfaces.

CObject:HasAnySurfaces

Checks if the object's entity has specific surfaces.

bool CObject:HasAnySurfaces(int mask, [bool hierarchical]) int mask : A mask of the surfaces in question. See the 'EntitySurfaces' global for a list of surfaces and their masks.

bool hierarchical : Checks the attached objects too.

returns bool : Returns true if the entity has any of those surfaces.

CObject:HasEntity

Checks if an object has an entity.

bool CObject:HasEntity() returns bool : true if entity is present.

CObject:HasSpot

Checks if an object has a given spot type.

bool CObject:HasSpot(string spot) string spot : the spot name to be checked

returns bool : true if the spot is present.

CObject:HasState

Checks if the object's entity has a given state (animation).

bool CObject:HasState(string name)

bool CObject:HasState(int index) string name : the state name to check for

int index : the state index to check for

returns bool : Returns true if the state is present

CObject:IntersectBBox

Intersects object's bounding box in its current state/animation with a given box or point.

int CObject:IntersectBBox(box/point, b2D = false) returns int/bool : intersection result.

CObject:IsAnimEnd

Returns if the current phase is the last anim phase

int CObject:IsAnimEnd([int channel = 1]) int channel : optional animation channel

returns bool : true if the current phase is the last anim phase

CObject:IsReachableFrom

Checks if any of the source points can reach any of the approach points.

The function makes a single path finding call. In order to work correctly, all pass tunnels have to be symetrical (no one way tunnels).

bool CObject:IsReachableFrom(table sources, int pfclass = 0, int restrict_dist = 150*guim) table sources : Table with points or objects or a single object

int pfclass : Optional pfclass

int restrict_dist : Optional restrict distance

CObject:IsSoundMuted

Returns the value of the sound mute flag for an object.

void CObject:IsSoundMuted()

CObject:IsValidPos

Checks if an object is present on the map

bool CObject:IsValidPos() returns bool : returns true, if the object has a position on the map.

CObject:IsValidZ

Checks if the object position has a valid Z coordinate. Objects with invalid Z are always drawn on the terrain surface.

bool CObject:IsValidZ() returns bool : returns true, if the object has a valid Z coordinate.

CObject:PlayState

Similar to SetState, but waits until the state animation is played before returning.

void CObject:PlayState(string name, [int count = 1, int flags = 0, int crossfade = -1])

void CObject:PlayState(int index, [int count = 1, int flags = 0, int crossfade = -1]) string name : the state name to check for

string index : the state index to check for

int count : optional count of animation replays (for looped animations only)

int flags : optional animation control flags (see object documentation for details)

int crossfade : optional animation crossfade time (see object documentation for details)

CObject:RemoveLuaReference

Called when a cobject having a Lua reference is being destroyed. The method isn't overriden by child classes, but instead all implementations are called starting from the topmost parent.

void CObject:RemoveLuaReference()

CObject:SetAcceleration

Sets linear acceleration as easing function when moving the object.

void CObject:SetAcceleration(int accel) int accel : the linear acceleration value

CObject:SetAngle

Smoothly changes the object's rotation angle over the specified time.

void CObject:SetAngle(int angle, [int time = 0]) int angle : the new angle (in minutes, 1 degree equals 60 minutes)

int time : the time (ms) to change the axis (optional)

CObject:SetAnimPhase

Advance the object's animation to a specific moment (phase). For nonlooping animations, the phase is clamped between 0 and the normal duration of the animation (without considering any speed modifications).

void CObject:SetAnimPhase(int channel, int phase) int channel : animation channel index (first channel is 1)

int phase : the animation time to set.

Example:

local duration = obj:SetState("step")
obj:SetAnimPhase(1, duration - 1)
-- the object animation is forced to advance to its last frame

CObject:SetAnimSpeed

Sets the new object's animation channel speed.

The channel speed is a property of the animation channel alone and doesn't affect the animations played on other channels.

void CObject:SetAnimSpeed(int channel, int speed, [int time = 0]) int channel : animation channel (the first channel is 1)

int speed : the new speed to set in promilles

int time : the time we want the animation to reach smoothly the given speed (optional)

CObject:SetAnimSpeedModifier

Sets the new object's animation speed modifier.

The speed modifier is a property of the object and affects all animation channels.

void CObject:SetAnimSpeedModifier(int speed) int speed : the new speed modifier to set in promilles

CObject:SetAttachAngle

Specifies the angle for the rotation offset when the object is attached.

void CObject:SetAttachAngle(int angle) int angle : attach rotation angle

CObject:SetAttachAxis

Specifies the axis for the rotation offset when the object is attached.

void CObject:SetAttachAxis(point axis)

void CObject:SetAttachAxis(int dx, int dy, int dz) point axis : attach rotation axis vector as point

int dx, dy, dz : the axis vector as coordinates

CObject:SetAttachOffset

Specifies a linear offset when the object is attached.

void CObject:SetAttachOffset(point offset)

void CObject:SetAttachOffset(int dx, int dy, int dz) point offset : offset vector from the spot position as point

int dx, dy, dz : the offset vector as coordinates

CObject:SetAxis

Smoothly changes the object's rotation axis over the specified time.

void CObject:SetAxis(point axis, [int time = 0])

void CObject:SetAxis(int dx, int dy, int dz, [int time = 0]) point axis : the new rotation axis vector as point

int dx, dy, dz : the new rotation axis vector as coordinates

int time : the time (ms) to change the axis (optional).

CObject:SetAxisAngle

Smoothly turns the object to the given axis and angle for the specified time. This method ensures proper interpolation avoiding discontinuities.

void CObject:SetAxisAngle(point axis, int angle, [int time = 0])

void CObject:SetAxisAngle(int axis_x, int axis_y, int axis_z, int angle, [int time = 0])

void CObject:SetAxisAngle(object other, [int time = 0])

CObject:SetColorModifier

Modifies the colorization of the entire object.

void CObject:SetColorModifier(int color, [int time = 0, bool recursive = false]) int color : the modification color in integer format. Each color component ranges between 0 and 255. For values above 100 the color component's value is being increased, while for values below, it's being reduced. To disable any modification, use RGB(100, 100, 100).

int time : optional parameter allowing to make the modification smoothly over an interval of time.

bool recursive : optional parameter indicating to set the color to all the attaches too.

Example:

obj:SetColorModifier(RGB(200, 100, 50))
-- the object is now with increased red color, reduced blue color and unchanged green
obj:SetColorModifier(RGB(100, 100, 100))
-- the object's true colors are now restored

CObject:SetColorizationMaterial

Specifies object's material properties.

void CObject:SetColorizationMaterial(int idx, int color, int roughness, int metallic)

void CObject:SetColorizationMaterial(object other) int idx : colorization index, depends on the number of colorization masks available in the object's entity

int color : the material color to be used, in RGB format represented as an unsigned integer (one byte per color component).

int roughness : the material roughness, represented as an integer between -128 and 127

int metallic : the metallic degree, represented as an integer between -128 and 127

object other : copy the colorization from another object

CObject:SetDust

Changes the object's dust visuals. Has an effect only if the entity has a dust mask.

void CObject:SetDust(int value, int material, int color) int value : the degree of dust, ranging from 0 to 255

int material : material index, can be 0 (exterior) or 1 (interior)

CObject:SetEnumFlags

Sets the object's enumeration flags.

void CObject:SetEnumFlags(int mask) int mask : mask containing the flags to be set.

Example:

obj:SetEnumFlags(const.efVisible)
-- the object is now visible

CObject:SetGameFlags

Sets the object's game flags.

Example:

obj:SetGameFlags(const.gofAlwaysRenderable)
-- the object is now drawn even when outside the camera view

void CObject:SetGameFlags(int mask) int mask : mask containing the flags to be set.

CObject:SetGravity

Sets gravity acceleration as easing function when moving the object.

void CObject:SetGravity([int gravity = 980]) int gravity : the gravity acceleration value (optional)

CObject:SetMirrored

Specifies the the object entity should be mirrored.

void CObject:SetMirrored(bool mirrored) bool mirrored : true if mirrored

CObject:SetOpacity

Sets the current object opacity.

void CObject:SetOpacity(int opacity, [int time = 0, bool recursive = false]) int opacity : 0 for full transparency; 100 for full opacity

int time : time for smooth transition (optional)

int recursive : if true, apply to attached objects too (optional)

CObject:SetPos

Smoothly changes the object's position over the specified time.

The map position of the object is changed immediately, but its visual position will change over the given interval of time.

void CObject:SetPos(point pos, [int time = 0])

void CObject:SetPos(int x, int y, int z, [int time = 0]) point pos : the new position as a point

int x, y, z : the new position as three coordinates.

int time : the time (ms) to change the position (optional).

CObject:SetPosAxisAngle

Smoothly moves and turns the object to the given pos, axis and angle for the specified time. It is better to use this method instead of invoking the interpolations separately.

void CObject:SetPosAxisAngle(point pos, point axis, int angle, [int time = 0])

void CObject:SetPosAxisAngle(int pos_x, int pos_y, int pos_z, int axis_x, int axis_y, int axis_z, int angle, [int time = 0])

void CObject:SetPosAxisAngle(object other, [int time = 0])

CObject:SetRollPitchYaw

Sets the object's orientation via roll, pitch and yaw angles.

void CObject:SetRollPitchYaw(int roll, int pitch, int yaw, [int time_delta]) int roll : roll angle (Rotation around the object's front-to-back axis)

int pitch : pitch angle (Rotation around the object's side-to-side axis)

int yaw : yaw angle (Rotation around the object's vertical axis)

int time_delta : optional time interval in the future, thus enabling smooth interpolation from the current orientation.

CObject:SetSIModulation

Sets the current self illumination modulation.

void CObject:SetSIModulation(int modulation) int modulation : 0 for no self illumination; 100 for max self illumination

CObject:SetScale

Changes the object's scale.

void CObject:SetScale(int scale) int scale : the object's scale in percent (100% is the default).

int time : interpolation delta (0 by default).

CObject:SetSound

Associates a sound to be played from this object.

void CObject:SetSound(string sound, [string type, int volume, int crossfade, bool looping]) string sound : a sound name (sound bank) or a sound filename.

string type : a sound type name, indicating that a sound file is provided, instead of a sound name.

int volume : forces the volume of the sound between 0 and 1000 (the sound bank volume is used by default).

int crossfade : optional cross-fade time if changing the sound state.

bool looping : specifies if the sound should be looping (uses the sound bank flag by default).

CObject:SetSoundMute

Sets or resets the sound mute flag for an object.

void CObject:SetSoundMute(int volume, bool bMute) bool bMute : mutes the sounds from the object if set

CObject:SetSoundVolume

Changes the sound volume for an object.

void CObject:SetSoundVolume(int volume, [int time = 0]) int volume : specifies the volume of the sound between 0 and 1000.

int time : optional time for smooth change.

CObject:SetState

Changes the object's state (animation).

int CObject:SetState(string name, [int flags = 0, int crossfade = -1, int speed = 1000, bool change_only])

int CObject:SetState(int index, [int flags = 0, int crossfade = -1, int speed = 1000, bool change_only]) string name : the state name to check for

string index : the state index to check for

int flags : optional animation control flags (see object documentation for details)

int crossfade : optional animation crossfade time (see object documentation for details)

int speed : optional animation speed in promilles

bool change_only : will early-out if the state is already the requested one

CObject:StopSound

Stops the sound of an object.

void CObject:StopSound([int time = 0]) int time : optional time for smoothly muting the sound.

CObject:TimeToAnimEnd

Returns remaining time to the end of currently played animation of the object (the result is depending on the current animation speed).

int CObject:TimeToAnimEnd([int channel = 1]) int channel : optional animation channel

returns int : the time remaining

GetEntityBBox

Returns the bounding box of an entity in a given state.

box GetEntityBBox(string entity, string state)

box GetEntityBBox(string entity, int state) string entity : entity name

string state : state name

int state : state idx

returns box : the bounding box of the entity.

GetNumStates

Returns the number of valid states (animations) for a given entity.

int GetNumStates(string entity) string entity : the entity name

returns int : number of states

GetSpotBeginIndex

Returns the first spot index from a given spot type for an entity in a given state

int, int GetSpotBeginIndex(string entity, string state, string spot)

int, int GetSpotBeginIndex(string entity, int state, string spot) string entity : entity name

string state : state name

int state : state index

string spot : spot name

returns int : the spot index, -1 if not found.

GetSpotEndIndex

Returns the last spot index from a given spot type for an entity in a given state

int, int GetSpotEndIndex(string entity, string state, string spot)

int, int GetSpotEndIndex(string entity, int state, string spot) string entity : entity name

string state : state name

int state : state index

string spot : spot name

returns int : the spot index, -1 if not found.

GetSpotRange

Returns the first and the last spot indexes from a given spot type for an entity in a given state

int, int GetSpotRange(string entity, string state, string spot)

int, int GetSpotRange(string entity, int state, string spot) string entity : entity name

string state : state name

int state : state index

string spot : spot name

returns int, int : the spot indexes, -1 if not found.

GetTopmostParent

Returns the topmost parent, if attached, or the object itself otherwise.

object GetTopmostParent(object obj [, string class = false]) object obj : the object

string class : optional class name as filter

returns object : the topmost parent

HasAllSurfaces

Checks if an entity has specific surfaces.

bool HasAllSurfaces(string entity, int mask) string entity : The entity name.

int mask : A mask of the surfaces in question. See the 'EntitySurfaces' global for a list of surfaces and their masks.

returns bool : Returns true if the entity has all of those surfaces.

HasAnySurfaces

Checks if an entity has specific surfaces.

bool HasAnySurfaces(string entity, int mask) string entity : The entity name.

int mask : A mask of the surfaces in question. See the 'EntitySurfaces' global for a list of surfaces and their masks.

returns bool : Returns true if the entity has any of those surfaces.

HasSpot

Checks if an entity has a given spot type in a specified state.

bool HasSpot(string entity, string state, string spot) string entity : the entity name

#param string state - the state to check

string spot : the spot name to be checked

returns bool : true if the spot is present.

HasState

Checks if an entity has a given state (animation).

bool HasState(string entity, string name)

bool HasState(string entity, int index) string entity : the entity name

string name : the state name to check for

int index : the state index to check for

returns bool : Returns true if the state is present

IsBeingDestructed

Returns if the given param is an object in the process of being destroyed.

bool IsBeingDestructed(object obj) object obj : the object to be tested

returns bool : true if the object is being destroyed

IsValid

Returns if the given param is a valid, non yet destroyed object.

bool IsValid(object obj) object obj : the object to be tested

returns bool : true if the object is valid

(insert footer.md.html here)

<style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="markdeep.min.js" charset="utf-8"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>
⚠️ **GitHub.com Fallback** ⚠️