Endstar LUA API Documentation
Loading...
Searching...
No Matches
Hittable Class Reference

This component makes something able to be targeted by attacks from the player, NPCs, and other objects. It handles incoming damage or healing, filtering it and passing it on to relative components before finally applying changes to the health component, if it has one. More...

Public Member Functions

void SetIsDamageable (Context instigator, bool isDamageable)
 Changes whether or not this object can take damage. This only applies to negative (damaging values). An object can still get healed.
 
bool GetIsDamageable ()
 Returns if the object is currently damageable or not.
 
void SetIsTargetable (Context instigator, bool isTargetable)
 Changes if this object can be tracked by Targeter components? Changing it during runtime allows something to potentially "become a threat," such as a turret turning on.
 
bool GetIsTargetable ()
 Can this object be tracked by Targeter components?
 
bool GetIsFullHealth ()
 Is this object at it full health? If this object doesn't have a health component it also returns true.
 
int ModifyHealth (Context instigator, int delta, int damageType)
 This is the main way you deal damage to, or heal an object. If it doesn't have a health component, it will still trigger reactions, but no health value will change.
 
bool GetIsDowned ()
 Is the object currently at 0 health?
 
void ChangeThreatLevel (Context instigator, int threatLevel)
 Changes the ThreatLevel of this hittable component. This is used by the targeter component to modify target priority by their threat level.
 

Detailed Description

This component makes something able to be targeted by attacks from the player, NPCs, and other objects. It handles incoming damage or healing, filtering it and passing it on to relative components before finally applying changes to the health component, if it has one.

Member Function Documentation

◆ ChangeThreatLevel()

void ChangeThreatLevel ( Context instigator,
int threatLevel )

Changes the ThreatLevel of this hittable component. This is used by the targeter component to modify target priority by their threat level.

Parameters
instigatorThe context making this change.
threatLevelThe new ThreatLevel of the hittable.

◆ GetIsDamageable()

bool GetIsDamageable ( )

Returns if the object is currently damageable or not.

Returns
True means it can take damage, false means any damage will be ignored

◆ GetIsDowned()

bool GetIsDowned ( )

Is the object currently at 0 health?

Returns

◆ GetIsFullHealth()

bool GetIsFullHealth ( )

Is this object at it full health? If this object doesn't have a health component it also returns true.

Returns
Returns true if the object is at full health or doesn't have a health component.

◆ GetIsTargetable()

bool GetIsTargetable ( )

Can this object be tracked by Targeter components?

Returns
True means it can be targeted, false means they will ignore it

◆ ModifyHealth()

int ModifyHealth ( Context instigator,
int delta,
int damageType )

This is the main way you deal damage to, or heal an object. If it doesn't have a health component, it will still trigger reactions, but no health value will change.

Parameters
instigatorWhat is the source of this damage? Some objects may react to this source and fight back, if they are capable
deltaHow much should health change by? Positive to heal, negative to deal damage
damageTypeWhat type of damage should this do? See DamageType. Note that this will be expanded later to allow for different types of damage and resistances and such!
Returns
What effect did it have on this object? Returns an integer value that represents a HealthChangeResult

◆ SetIsDamageable()

void SetIsDamageable ( Context instigator,
bool isDamageable )

Changes whether or not this object can take damage. This only applies to negative (damaging values). An object can still get healed.

Parameters
instigatorThe source context that is triggering this change
isDamageableTrue means it can take damage, false means any damage will be ignored

◆ SetIsTargetable()

void SetIsTargetable ( Context instigator,
bool isTargetable )

Changes if this object can be tracked by Targeter components? Changing it during runtime allows something to potentially "become a threat," such as a turret turning on.

Parameters
instigatorThe source context that is triggering this change
isTargetableTrue means it can be targeted, false means they will ignore it