daily-routine.yaml 921 B

12345678910111213141516171819202122232425262728293031
  1. # Example state machine (D15/D20: behavior language v2) — NPC schedule
  2. # placeholder. An anima/npc entity does not exist yet in this slice, so the
  3. # machine runs on a generic instance entity (id "sm:daily-routine", type
  4. # "statemachine") driven by time events and bus events. Demonstrates the
  5. # onSchedule time primitive with a when condition (first matching entry wins:
  6. # market day on day >= 28, normal work otherwise) and an event-driven
  7. # transition (item-acquire interrupts work).
  8. id: daily-routine
  9. initial: sleeping
  10. states:
  11. - id: sleeping
  12. - id: working
  13. onEnter:
  14. - action: emit-event
  15. event: behavior:daily-routine-working
  16. payload:
  17. state: working
  18. - id: resting
  19. transitions:
  20. - from: working
  21. to: resting
  22. on: item-acquire
  23. onSchedule:
  24. - at: day-start
  25. to: resting
  26. when:
  27. op: gte
  28. path: payload.day
  29. value: 28
  30. - at: day-start
  31. to: working