| 12345678910111213141516171819202122232425262728293031 |
- # Example state machine (D15/D20 behavior language v2) — decision #9's
- # "produce rules via language". The engine emits animal-produce per eligible day
- # for a mature (final-stage) chicken; this machine turns that EVENT into an egg
- # grant via a give-item onEnter. The machine alternates on successive
- # animal-produce events (one transition per machine per event), so the egg is
- # granted on every second produce — frequency/quantity are exactly the kind of
- # rule the language (not the engine) owns.
- id: chicken-egg
- initial: waiting
- states:
- - id: waiting
- - id: laid
- onEnter:
- - action: give-item
- itemId: egg
- qty: 1
- transitions:
- - from: waiting
- to: laid
- on: animal-produce
- when:
- op: eq
- path: payload.animalDefId
- value: chicken
- - from: laid
- to: waiting
- on: animal-produce
- when:
- op: eq
- path: payload.animalDefId
- value: chicken
|