aboutsummaryrefslogtreecommitdiff
path: root/building_guide/objects.md
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-09 22:15:54 -0400
committerhistoria <[not public]>2026-07-09 22:15:54 -0400
commitecba7f726f70b37126d852c38c7e3eec7b04d730 (patch)
tree9129215c6e5015336fde1116395336d82bb952d1 /building_guide/objects.md
parentb3d4c616f59ad2519f3a0b77e3b47d6571cd2486 (diff)
downloadthehouseoficarus-ecba7f726f70b37126d852c38c7e3eec7b04d730.tar.gz
feat: old standalone trigger systems completely unified into trigger->condition->action system
Diffstat (limited to 'building_guide/objects.md')
-rw-r--r--building_guide/objects.md102
1 files changed, 66 insertions, 36 deletions
diff --git a/building_guide/objects.md b/building_guide/objects.md
index cb38e0c..958938d 100644
--- a/building_guide/objects.md
+++ b/building_guide/objects.md
@@ -39,8 +39,9 @@ objects:
inroom_description: "A large framed sign is mounted near the cockpit door."
description: "Safety instructions are printed in bold lettering."
on_look:
- - set_player_flags:
- 1001_look_sign: true
+ - steps:
+ - set_player_flags:
+ 1001_look_sign: true
```
- **Identity comes from `name`.** Internally the object's id is the name, normalized
@@ -52,7 +53,8 @@ objects:
- **Partial-name siblings are fine.** `rusty sign` and `shiny sign` can coexist; `look
sign` matches both with "which one?", while `look rusty sign` resolves directly.
- Local objects support only the **passive subset**: `name`, `aliases`, `color`, `hidden`,
- `inroom_description`, `description` (including conditional variants), and `on_look`.
+ `inroom_description`, `description` (including conditional variants), and `on_look` (a
+ `[]Trigger` list).
- Interactable behavior (`gather`, `talk`, `use`, `safespot`, `steal`, `guard_mob`,
`removal_item`, `on_use`, craft stations) **must** be standalone files; startup validation
errors if those appear locally.
@@ -77,10 +79,10 @@ on_use:
- condition:
global_flag: secret_passage_open
not: true
- message: "You pull the lever. Grinding echoes from the east."
- action:
- set_global_flags:
- secret_passage_open: true
+ steps:
+ - messages: ["You pull the lever. Grinding echoes from the east."]
+ set_global_flags:
+ secret_passage_open: true
```
Room description hints at it:
@@ -186,9 +188,10 @@ actions, and linear auto-advance.
### Interactions — on_use / on_look
Objects can define `on_use` and/or `on_look` to react to player actions. Both take a list of
-interactions; entries are checked top-to-bottom, the first whose `condition` passes wins.
-The full `Interaction` shape (condition, message, action with the entire StepAction
-vocabulary) is documented in the [Interaction Reference](behaviors.md#interaction-reference).
+**Triggers**; entries are checked top-to-bottom, the first whose `item_id` and `condition`
+pass fires, and its `steps` run as a scripted sequence. See `triggers.md` for the full
+Trigger/Step/Condition reference, and `behaviors.md` for the Interaction/Step reference at a
+glance.
#### on_use — using items on objects
@@ -203,25 +206,50 @@ on_use:
- condition:
global_flag: gate_open
not: true
- message: "You push the heavy iron gate open."
- action:
- set_global_flags:
- gate_open: true
+ steps:
+ - messages: ["You push the heavy iron gate open."]
+ set_global_flags:
+ gate_open: true
```
-Item-specific:
+A two-state object with first-match-wins and value-match conditions (from
+`data/objects/tutorial_lever.yaml`):
+
+```yaml
+name: stone lever
+on_use:
+ - condition:
+ not: true
+ player_flag: unlocked_rock_cover
+ value: 1
+ steps:
+ - messages:
+ - You pull the stone lever down. A mechanism clicks into place somewhere in the glade.
+ set_player_flags:
+ unlocked_rock_cover: 1
+ - condition:
+ player_flag: unlocked_rock_cover
+ value: 1
+ steps:
+ - messages:
+ - You push the stone lever back up. The mechanism disengages with a soft clunk.
+ set_player_flags:
+ unlocked_rock_cover: 0
+```
+
+Item-specific (`use <item> on <obj>`):
```yaml
name: bookshelf
on_use:
- item_id: dusty_tome
- message: "The bookshelf slides aside, revealing a secret passage!"
- action:
- set_global_flags:
- secret_passage_open: true
+ steps:
+ - messages: ["The bookshelf slides aside, revealing a secret passage!"]
+ set_global_flags:
+ secret_passage_open: true
```
-Puzzle interaction:
+Puzzle interaction (first matching entry wins):
```yaml
name: crystal slot
@@ -229,13 +257,14 @@ on_use:
- item_id: crystal_key
condition:
global_flag: crystal_inserted
- message: "The crystal key is already in the slot."
+ steps:
+ - messages: ["The crystal key is already in the slot."]
- item_id: crystal_key
- message: "You insert the crystal key. It clicks into place."
- action:
- take_item: crystal_key
- set_global_flags:
- crystal_inserted: true
+ steps:
+ - messages: ["You insert the crystal key. It clicks into place."]
+ take_item: crystal_key
+ set_global_flags:
+ crystal_inserted: true
```
Quest item exchange:
@@ -245,25 +274,26 @@ on_use:
- item_id: ancient_scroll
condition:
player_flag: quest_started
- message: "You place the scroll on the pedestal. The door rumbles open!"
- action:
- take_item: ancient_scroll
- set_player_flags:
- quest_complete: true
- set_global_flags:
- temple_door_open: true
+ steps:
+ - messages: ["You place the scroll on the pedestal. The door rumbles open!"]
+ take_item: ancient_scroll
+ set_player_flags:
+ quest_complete: true
+ set_global_flags:
+ temple_door_open: true
```
#### on_look — actions when examining an object
`on_look` fires AFTER the object's description is shown. An entry with `item_id` only fires
-if the player carries that item. Supports the full Interaction shape:
+if the player carries that item. Same Trigger shape:
```yaml
name: sign
on_look:
- - set_player_flags:
- read_sign: true
+ - steps:
+ - set_player_flags:
+ read_sign: true
```
---