Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

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.

Registrymanifold:impact-damage
Filesdata/impact_damage/*.ron, *.update.ron, *.final.ron
Sidesserver: only the server loads it
Readsmanifold:predicate
ContractGameplay framework, data stage

Entry

A record, written ImpactDamage(..); the name before the parentheses is optional.

FieldTypeRequiredDefaultDescription
idstringyesThe set’s key, <mod-id>:<name>.
ruleslist of RuleyesThe 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 (..).

FieldTypeRequiredDefaultDescription
kindslist of ImpactKindyesThe impacts it handles.
damage_typestringyesThe damage type dealt (manifold:damage-type key).
amountnumberyesThe amount, a number in the impact context (v.impact_speed, v.impact_energy).

ImpactKind

How a character met something.

VariantWrittenDescription
LandingLandingLanding on the ground.
WallWallRunning into a wall.
StruckStruckStruck by a moving body.
CrushedCrushedCrushed between bodies.

Value forms used here: number.