Describe splitting struct outputs (#256)

Structs gets a section Split outputs, Behaviors a note under Find … Match, Development the check total 1520.
admin committed 2026-09-28 11:33:45 +02:00
1 parent 564b46663b
commit 064f996918
3 files changed
+27 -3

No files matched your search

+3 -1
@@ -267,7 +267,9 @@ playing use the same two words.
and the nodes between them shows what belongs to the test (a literal feeding the test from
outside stays outside). While a Find has no Match, or two Matches test it, or one Match is built
from two Finds, both nodes say so and nothing runs past the Find. The test is data only: every
element reads it anew, like the break of `For each`.
element reads it anew, like the break of `For each`. Over a typed list, right-click the `item`
pin and split it into the fields of the type (`item.Name`, …), so the test needs no `Expand`
— see [Structs](Structs), *Split outputs*.
- **A behavior as a node** (nesting): a behavior, usually one with a **Start** and an **End**
node, can be run as a step of another behavior's graph. Every input declared on the start node becomes an
input port of the calling node, every output declared on the end node one of its outputs; the
+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 # 1517 editor checks, screenshots in /tmp/gm-e2e-*.png
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1520 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
+23 -1
@@ -46,6 +46,27 @@ input per field on `Pack`, one output per field on `Expand` — and they follow
on. The FIELDS section of such a node lists them without letting you change them. Without a type,
the fields are declared on the node by hand as before (**+ Field**, **From variable**).
## Split outputs
Reading one field of a struct does not need an `Expand` of its own: **right-click the pin** of an
output that can carry a struct and split it. The output is replaced, where it stood, by one output
per field of a struct asset — `item` becomes `item.Name`, `item.Amount` — each typed as its field.
- **Split into Loot fields** is offered when the graph already knows the type: a struct variable
with a type, the value of a typed `Pack`, a field of a typed `Expand` or of another split, and
the `item` of `For each`, `Find`, `Match` and `Item at` over a typed list.
- **Split as …** lists every other struct asset, for outputs whose type the graph does not know,
such as an input of a behavior.
- A right-click on one of the field pins offers **Recombine**, which puts the whole output back.
Splitting drops the edges on the whole output, recombining the edges on the field pins; one undo
brings them back. The field pins follow the asset like a typed `Expand`: a new field gets a pin, a
removed field loses its pin and edge, a renamed one keeps its edge. After the asset is deleted, the
split keeps its last fields. Renaming the variable behind a split output takes the split along.
At run time the node still produces the whole value; a field pin reads that field out of it, the
way `Expand` does — a field the value lacks reads as empty.
## When the asset changes
Every change to a struct asset's fields reaches every place of that type at once, and **one undo**
@@ -103,7 +124,8 @@ the overrides of placed objects and in lists nested inside other items, in one u
## Deleting a struct asset
The delete dialog counts the structs, the typed lists and the `Pack`/`Expand` nodes that use it.
The delete dialog counts the structs, the typed lists and the nodes that use it (`Pack`/`Expand`
with the type, and every split output).
After deleting, each of them **keeps the fields it last had**, now as its own fields — no value is
lost, only the link. A Type row reads **Own fields** again, an Items row **Mixed**.