This document is about: QUANTUM 2
SWITCH TO

Health

Overview

The HealthSystem is a SystemSignalsOnly system which provides a way to damage, heal and kill entities. The point of entry is ISignalModifyHealth and requires a HealthData struct.

By default, the HealthSystem does not take external conditions such as attributes or friendly fire into consideration, nor does it return a modified HealthData for further usage. This limitation is, to a degree, mitigated by the HitSystem which provides a customizable environment to calculate hits. ISignalModifyHealthNoReport is an avenue provided by the HealthSystem to modify the HealthData. In this case, HealthData is passed as a reference thus enabling further processing after a first heatlh pass. Passing HealthData as a reference ensures the properties inside the structure have been calculated when execution control is returned to the calling method. However, this means HealthSystem.ReportHealthModified() needs to be manually invoked with the final HealthData after the processing is done.

The Health component itself supports IsInvulnerable and IsRevivable; these can be set at any time.

HealthData

The HealthData contains the following properties:

  • Type ( required ): the EHealthType defining what is affected - Health / Shield / Health and Shield
  • Action ( required ): the EHealthAction definining what action is to be taken - Add / Remove / Remove All / Kill / Revive
  • Result ( automatic ): the EHealthActionResult - None / Applied / Ignored
  • Target ( required ): the Entity whose health is modified
  • Source ( required ): the Entity which created the modify request (e.g. a Projectile)
  • Instigator ( required ): the Entity which instigated the health change (e.g. an Agent - the owner of the Weapon / the Projectile causing the change)
  • DesiredAmount ( required ): Desired value
  • AppliedAmount ( automatic ): Applied value, reflects the real change based on the internal component state
  • IgnoreMax: If set to true, the Health / Shield properties can go over their maximum limits
  • HasDied ( automatic ): Indicates the entity has died
  • HasRevived ( automatic ): Indicates the entity has been revived
  • WasDamaged ( automatic ): Indicates the entity was damaged
  • WasHealed ( automatic ): Indicates the entity was healed

Note: All fields marked as required need to have a value assigned prior to passing the HealthData to ISignalHit. All fields marked as automatic are set automatically insideISignalModifyHealth.

ReportHealthModified

HealthSystem.ReportHealthModified() is used to report to the changes made to the Health component. This can be called after ISignalModifyHealthNoReport.

N.B.: ISignalModifyHealth should not be called directly, use the HitSystem instead.

The HealthSystem supports these signal-event pairs for reporting changes :

  • ISignalOnHeal and Heal
  • ISignalOnDamage and Damage
  • ISignalOnDeath and Death (synced event)
  • ISignalOnRevive and Revive (synced event)
Back to top