2024-06-16 14:31:52 +03:00
|
|
|
# Capabilities
|
|
|
|
|
|
|
|
Capabilities allow several systems provide same functionality in different ways. Exactly one capability implementation should be active.
|
|
|
|
|
|
|
|
Capabilities are registered by having an entry in `ctx.cap` table.
|
|
|
|
|
|
|
|
# List of capabilities
|
|
|
|
|
|
|
|
## `health` capability
|
|
|
|
|
|
|
|
Functions:
|
|
|
|
- `health() -> num`
|
|
|
|
- `max_health() -> num`
|
|
|
|
- `set_health(hp: num)`
|
|
|
|
- `set_max_health(hp: num)`
|
|
|
|
- `inflict_damage(dmg: num)`
|
2024-06-16 16:07:09 +03:00
|
|
|
- `do_game_over(msg: str)`
|
2024-08-07 15:05:38 +03:00
|
|
|
- `on_poly_death(msg: str)`
|
2024-06-16 14:31:52 +03:00
|
|
|
|
|
|
|
Provided by:
|
|
|
|
- damage (shared health) system
|
2024-08-07 15:05:38 +03:00
|
|
|
- local health system
|
2024-06-16 14:31:52 +03:00
|
|
|
|
|
|
|
Used by:
|
2024-07-14 12:19:26 +03:00
|
|
|
- heart pickups system
|
|
|
|
|
|
|
|
## 'item_sync' capability
|
|
|
|
|
|
|
|
Functions:
|
2024-09-16 15:23:58 +03:00
|
|
|
- `globalize(entity_id, instantly: bool | nil, give_authority_to: PeerId | nil)`
|
2024-07-14 14:57:00 +03:00
|
|
|
- `register_pickup_handler(fn(local_item_id))`
|
2024-07-14 12:19:26 +03:00
|
|
|
|
|
|
|
Provided by:
|
|
|
|
- item_sync system
|