data/impact_damage/
Impact damage rules: how a character’s physics impacts (landing, hitting a wall, being struck or crushed) become damage, such as fall damage. An impact takes the first rule, in entry key order then list order, whose kinds include it; the impact’s other owner is credited, so a trap’s builder gets the kill. Players’ and creatures’ landings and wall hits are reported; struck and crushed impacts come with physics’ moving bodies, so rules for them load and wait. An explosion’s push is not an impact: its explosion damage hurts the target instead. Loaded by the server only.
| Registry | manifold:impact-damage |
| Files | data/impact_damage/*.ron, *.update.ron, *.final.ron |
| Sides | server: only the server loads it |
| Reads | manifold:predicate |
| Contract | Gameplay framework, data stage |
Entry
A record, written ImpactDamage(..); the name before the parentheses is optional.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The set’s key, <mod-id>:<name>. | |
rules | list of Rule | yes | The rules, tried in order. |
Example
From game/flagship-game/data/impact_damage/flagship.ron:
ImpactDamage(
id: "flagship-game:impacts",
rules: [
Rule(kinds: [Landing], damage_type: "flagship-game:fall",
amount: "math.max(0, (v.impact_speed - 12) * 1.5)"),
Rule(kinds: [Struck, Crushed], damage_type: "flagship-game:crush",
amount: "v.impact_energy / 800"),
],
)
Types
Rule
An impact damage rule.
A record: Rule(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
kinds | list of ImpactKind | yes | The impacts it handles. | |
damage_type | string | yes | The damage type dealt (manifold:damage-type key). | |
amount | number | yes | The amount, a number in the impact context (v.impact_speed, v.impact_energy). |
ImpactKind
How a character met something.
| Variant | Written | Description |
|---|---|---|
Landing | Landing | Landing on the ground. |
Wall | Wall | Running into a wall. |
Struck | Struck | Struck by a moving body. |
Crushed | Crushed | Crushed between bodies. |
Value forms used here: number.