Condition System
Conditions decide whether an operation is allowed to continue. They are used by recipes, strengthening, skills, items, GUI buttons, and actions.
Unified block
Modules use condition as the unified condition block entry. CoreLib parses it through ConditionBlock.
yaml
condition:
type: all_of
entries:
- '%player_level% >= 10'
- '%money% >= 1000'
required_count: 0
invalid_as_failure: true| Field | Meaning |
|---|---|
condition.type | Combination mode: all_of, any_of, none_of, at_least, or exactly. |
condition.entries | Condition entries. |
condition.required_count | Required passing count for at_least and exactly. |
condition.invalid_as_failure | Treat invalid configuration as failure. |
condition.on_pass.actions | Actions to run when the condition passes, when supported by the caller. |
condition.on_fail.actions | Actions to run when the condition fails, when supported by the caller. |
condition.on_fail.block_output | Block output on failure, used by output-producing modules such as Cooking. |
condition.on_fail.message | Failure message for modules such as Item equipment checks. |
Nested groups are written as entries with their own type and entries:
yaml
condition:
type: all_of
entries:
- type: any_of
entries:
- '%vip_level% >= 1'
- '%player_level% >= 50'
- '%money% >= 5000'Advice
Use clear failure messages for players. For important restrictions, keep invalid configuration as failure to avoid bypasses.