API Damageable is an interface which defines properties, events, and functions for objects which can take damage and die.
Property Name Return Type Description Tags hitPoints number Current amount of hit points. Read-Write maxHitPoints number Maximum amount of hit points. Read-Write
Function Name Return Type Description Tags ApplyDamage(Damage) None Damages a Damageable, unless it is invulnerable. If its hit points reach 0 and it is not immortal, it dies. Server-Only Die([Damage]) None Kills the Damageable, unless it is immortal. The optional Damage parameter is a way to communicate cause of death. Server-Only
Event Name Return Type Description Tags damagedEvent Event <Damageable damageable, Damage damage> Fired when the Damageable takes damage. Server-Only diedEvent Event <Damageable damageable, Damage damage> Fired when the Damageable dies. Server-Only hitPointsChangedEvent Event <Damageable damageable, number previousHitPoints> Fired when there's a change in hit points on the Damageable. Server-Only
Hook Name Return Type Description Tags damageHook Hook <Damageable damageable, Damage damage> Hook called when applying damage from a call to ApplyDamage(). The incoming damage may be modified or prevented by modifying properties on the damage parameter. Server-Only
Dernière mise à jour: 13 avril 2023