Describe object variables that hold a spawned object

- Behaviors: Object joins the list of variable kinds. A paragraph
  explains that the reference lives for the run only, reads as
  (null) once the object is gone, and is checked with Equals.
- Behaviors: saved values of a persistent Variables asset never keep
  an object variable. It starts at (null) on every run.
- Development: e2e check total 1406.
admin committed 2026-09-26 20:15:29 +02:00
1 parent 699b72db46
commit e77a6ac00f
2 files changed
+15 -2

No files matched your search

+14 -1
@@ -38,7 +38,7 @@ playing use the same two words.
width. Switching the type keeps the ports; one the new type lacks is marked. The node shows its
type as a setting row (*Type: Sprite*, plus *Behavior: Game* under that type). Textures and
scenes are no type here: they are not objects in a running game. A variable is a
**number, a text, a yes/no, a colour, a texture, a state machine, a list or a struct**; a list declares **nothing** about its items —
**number, a text, a yes/no, a colour, a texture, a state machine, an asset, an object, a list or a struct**; a list declares **nothing** about its items —
each one is a number, a text, a yes/no, a colour, a texture, a state machine or a struct and says so itself, so one list may
hold several kinds at once. A list is
compared by its items, never by identity — otherwise every reload would look like an override.
@@ -48,6 +48,16 @@ playing use the same two words.
The moment that list is written into a variable or a property, every object in it becomes its name
— that is the one door into a saved value, and nothing alive goes through it. A set of objects
that has to *survive* is therefore still a list of names, walked with `Repeat` and `Object by name`.
One object on its own **can** be held, by an **object variable**: write the `object` output of
`Spawn` (or of `Object by name`, `Child by name`, a collision) into it, and every later frame
reads the same object back. It lives for the run only. The file stores the declaration and an
empty value, the inspector shows `(null)` and offers nothing to pick, and neither a scene
override, a snapshot nor a save of a persistent Variables asset ever holds the object. The handle
sits beside the variable rather than in it (`core/graph/objectSlots.ts`), since everything in the
variable bag is written back into the scene as an override. A **destroyed** object reads as
`(null)`, as does one from a scene that was restarted or left. "Is it still there?" is `Equals`
with the variable on `a` and `b` left empty: true once the object is gone. Kept variables of a called behavior (#229) keep their object across calls too,
and `Properties` of type *Behavior* reads and writes another behavior's object variable.
A list property is shown as a button saying how many items it holds;
clicking it opens the **List** tab, which gives each item a row with the same widget the
inspector would use for that kind — a struct item is its fields as rows under each other. The inspector stays visible beside the tab, so what the list
@@ -269,6 +279,9 @@ playing use the same two words.
forgets that asset, and **Menu → Clear saved data** forgets the whole project. A save is read
through the declaration as it is now: a variable deleted since is dropped, one added since starts
at its declared value, and a value whose kind changed is converted like any other value.
An **object variable** may sit in a persistent asset too, but is never saved: the object is an
instance of that run, and the next run has new ones. It starts every run at `(null)` while the
other values go on, and the inspector says so under the switch.
- **Cross-object state** the other way: a behavior's own variables *are* the properties of its
object, so another graph reads and writes them with `Object by name` → `Properties` of type
*Behavior*. That reaches one named object, where a Variables asset belongs to no object at all.
+1 -1
@@ -15,7 +15,7 @@ npm run build # writes dist/ and regenerates index.html
php tools/make-user.php <name> <password> [admin|user] # an account; every tool signs in (see Accounts)
php tests/php/accounts.test.php # the API's account rules, no server needed (CI's gate job)
php tests/php/snapshots.test.php # the snapshot store (#231), the same way
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1403 editor checks, screenshots in /tmp/gm-e2e-*.png
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1406 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