| 12345678910111213141516171819202122232425262728293031 |
- # Example state machine (D15/D20: behavior language v2) — NPC schedule
- # placeholder. An anima/npc entity does not exist yet in this slice, so the
- # machine runs on a generic instance entity (id "sm:daily-routine", type
- # "statemachine") driven by time events and bus events. Demonstrates the
- # onSchedule time primitive with a when condition (first matching entry wins:
- # market day on day >= 28, normal work otherwise) and an event-driven
- # transition (item-acquire interrupts work).
- id: daily-routine
- initial: sleeping
- states:
- - id: sleeping
- - id: working
- onEnter:
- - action: emit-event
- event: behavior:daily-routine-working
- payload:
- state: working
- - id: resting
- transitions:
- - from: working
- to: resting
- on: item-acquire
- onSchedule:
- - at: day-start
- to: resting
- when:
- op: gte
- path: payload.day
- value: 28
- - at: day-start
- to: working
|