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

Tracks the health of an object. Also depending on configuration, it can handle automatically destroying an object when health reaches 0. Note that damage or healing should generally be dealt to Hittable component, but you can set health or max health directly from this component. More...

Public Member Functions

void SetHealthZeroedBehavior (Context instigator, int behavior)
 What should the object do when it's health is set to 0?
 
int GetHealth ()
 
void SetHealth (Context instigator, int newValue)
 Set the current health of this object. It will always be clamped between 0 and MaxHealth.
 
void ChangeHealth (Context instigator, int delta)
 Change the current health of this object.
 
int GetMaxHealth ()
 
void SetMaxHealth (Context instigator, int newValue)
 Explicitly sets the maximum health of this object.
 
void ChangeMaxHealth (Context instigator, int delta)
 Adds the delta to the current maximum health.
 

Public Attributes

LuaInterfaceEvent OnHealthChanged = new()
 Subscribe to this to get updates when this object's health changes! Broadcasts context and current health.
 

Detailed Description

Tracks the health of an object. Also depending on configuration, it can handle automatically destroying an object when health reaches 0. Note that damage or healing should generally be dealt to Hittable component, but you can set health or max health directly from this component.

Member Function Documentation

◆ ChangeHealth()

void ChangeHealth ( Context instigator,
int delta )

Change the current health of this object.

Parameters
instigatorThe source context that is triggering this change
deltaPositive to restore health, negative to remove health

◆ ChangeMaxHealth()

void ChangeMaxHealth ( Context instigator,
int delta )

Adds the delta to the current maximum health.

Parameters
instigatorThe source context that is triggering this change
deltaPositive to increase max health, negative to decrease it

◆ GetHealth()

int GetHealth ( )

◆ GetMaxHealth()

int GetMaxHealth ( )

◆ SetHealth()

void SetHealth ( Context instigator,
int newValue )

Set the current health of this object. It will always be clamped between 0 and MaxHealth.

Parameters
instigatorThe source context that is triggering this change
newValueThe new value for current health

◆ SetHealthZeroedBehavior()

void SetHealthZeroedBehavior ( Context instigator,
int behavior )

What should the object do when it's health is set to 0?

Parameters
instigatorThe source context that is triggering this change
behaviorWhat HealthZeroedBehavior should this object use?

◆ SetMaxHealth()

void SetMaxHealth ( Context instigator,
int newValue )

Explicitly sets the maximum health of this object.

Parameters
instigatorThe source context that is triggering this change
newValue

Member Data Documentation

◆ OnHealthChanged

LuaInterfaceEvent OnHealthChanged = new()

Subscribe to this to get updates when this object's health changes! Broadcasts context and current health.