# Health

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

```
component gameplay.Health
```

Hit points of a node. Hitboxes, kill zones and scripts damage it; it dies once at zero until revived.

## Fields

| Name | Script name | Type | Default | Description |
|---|---|---|---|---|
| Max | `Max` | `int` | `3` | Hit points at the start and after a full revive. |
| Current | `Current` | `int` | `0` | Runtime state. Hit points now. |
| Team | `Team` | `int` | `0` | Hitboxes of the same team do not hurt this node unless they allow friendly fire. |
| Invuln Time | `InvulnTime` | `float` | `0.5` | Seconds of game time without damage after a hit. Hits in the same step all count. |
| Destroy On Death | `DestroyOnDeath` | `bool` | `false` | Destroys the node at death, unless it has Respawn. |
| Despawn On Death | `DespawnOnDeath` | `bool` | `false` | Returns the node to its pool at death; a node that was not spawned is destroyed. |
| Invulnerable | `Invulnerable` | `bool` | `false` | Runtime state. True while damage is ignored. |
| Dead | `Dead` | `bool` | `false` | Runtime state. True from death until Revive. |

## Damage

```
func (Health) Damage(amount int, source NodeRef) bool
```

Removes hit points and reports whether they were removed: not while invulnerable, dead or for amounts below 1.

## Heal

```
func (Health) Heal(amount int)
```

Adds hit points up to Max; it does nothing while dead.

## Kill

```
func (Health) Kill(source NodeRef)
```

Sets the hit points to zero.

## Revive

```
func (Health) Revive(hp int)
```

Brings the node back with this many hit points; 0 means Max.

## SetInvulnerable

```
func (Health) SetInvulnerable(seconds float)
```

Ignores damage for some seconds of game time.

## Damaged

```
signal Damaged(amount int, source NodeRef)
```

Fires once per step with the damage taken in it.

## Died

```
signal Died(source NodeRef)
```

Fires once when the hit points reach zero.

## Healed

```
signal Healed(amount int)
```

Fires with the hit points restored.

## Revived

```
signal Revived()
```

Fires after Revive.
