Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

data/predicates/

A named predicate: a condition or number written once and reused by name. Other entries refer to it with Ref("<key>") wherever a condition or number goes, and it is inlined when they compile, so it costs nothing at run time. Its context is checked where it is used.

Registrymanifold:predicate
Filesdata/predicates/*.ron, *.update.ron, *.final.ron
Sidesboth: the server and every client load it, and the handshake’s data hash covers it
Readsnothing
ContractGameplay framework, data stage

Entry

An entry is one of these forms, each written with its name:

VariantWrittenDescription
ConditionCondition(id: .., when: ..)A named condition, used as Ref("<key>") where a condition goes.
NumberNumber(id: .., value: ..)A named number, used as Ref("<key>") where a number goes.

Condition fields:

FieldTypeRequiredDefaultDescription
idstringyesThe predicate’s key, <mod-id>:<name>.
whenconditionyesThe condition.

Number fields:

FieldTypeRequiredDefaultDescription
idstringyesThe predicate’s key, <mod-id>:<name>.
valuenumberyesThe number.

Example

No bundled file declares one yet. From the reference’s test fixture, crates/manifold-server-state/tests/data-reference-fixture/data/predicates/health.ron, which the data stage loads in its tests:

Number(id: "dataref-fixture:half_max_health",
       value: "q.stat('this', 'manifold:max_health') / 2")

Value forms used here: condition, number.