Scope scene for Variables assets and state machines (#164)

Behaviors: Scope on the Variables asset. State machines: third step and the announcement after a swap. Development: check sum 1307.
admin committed 2026-09-23 06:07:08 +02:00
1 parent e21f047eb3
commit 9087225e9f
3 files changed
+12 -2

No files matched your search

+6
@@ -224,6 +224,12 @@ shown on the node and editable in the inspector.
next run starts from. Two Variables assets may declare the same name without meeting: the
asset is the key, not the name. A coin counter is one such asset with `coins` in it; picking a
coin up is one node, `coins` fed through `Add` back into itself.
- **Scope**: a Variables asset is shared either way, and the dropdown says for how long. **Global**
(the default) is the whole run: the values travel through every `Load scene`, which is what lets
a score survive the next level. **Scene** is one set per scene, built again from the declarations
whenever a scene is loaded — for what a level counts and the level takes with it, like the
enemies left in it or a switch that was flipped. A scene asset cannot be persistent; there is
nothing to keep between runs when every scene throws the values away, so that switch is not shown.
- **Saved values (savegame)**: tick **Persistent** in a Variables asset's inspector and its values
outlive the run — a highscore, the levels unlocked, the player's settings. The next Play starts
where the last one ended instead of at the declared values. Nothing new is needed in the graph:
+1 -1
@@ -13,7 +13,7 @@ npm run check # typecheck + lint + format:check + tests, the gate CI runs
npm run build # writes dist/ and regenerates index.html
./build.sh # the same under `set -o pipefail`, for callers that pipe the output
php tools/make-user.php <name> <password> # an account; every tool signs in (see Accounts)
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1304 editor checks, screenshots in /tmp/gm-e2e-*.png
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1307 editor checks, screenshots in /tmp/gm-e2e-*.png
GM_STEPS=20 node tools/e2e.mjs # or 1-12, or 6,20 — a subset while working on one step
./e2e.sh start [GM_STEPS] # the same run detached, see below
./e2e.sh status # live progress, or the last run's result
+5 -1
@@ -13,7 +13,11 @@ A machine's **Scope** is a dropdown in its own inspector, since the machine is t
current state hangs off its id. **Local** (the default) gives every behavior instance a current
state of its own — two doors open independently. **Global** keeps one current state for the whole
run, so every behavior using the machine sees the same one, and a second behavior can branch on a
state it never set itself. Scope also decides who hears a move: see *Start state and events* below.
state it never set itself. **Scene** shares one the same way, but only for as long as the scene
lasts: every `Load scene` puts the machine back into its start state, and that entry is announced
again, so an `On state entered` in the new scene hears it. A global machine stays quiet there,
because it never left the state it was in. Scope also decides who hears a move: see *Start state
and events* below.
## Transitions