A list of structs used to let every item carry its own fields. Adding
an item meant typing the same fields again, and nothing kept the items
in step with the struct asset from #253. A list can now name a struct
type for its items, and the asset keeps them in shape.
- A list variable and a list field get the row Items with Mixed, every
struct asset and Make struct type. Make struct type collects every
field any item has, so no item loses a field.
- A typed item carries its type under the key `$struct`
(ITEM_TYPE_KEY). listItems does not count it as a field.
- A list that holds anything but structs refuses a type, also when
the offending item sits in an override. The console names the list
and the count, and the list stays as it was.
- In a typed list `+ Item` adds an item with the defaults, without the
kind menu. Field names are locked, values stay editable.
- The rows of a typed item take their kind from the struct asset
(declaredKind in InlineList.ts). An asset field shows the asset
picker instead of a text field, as reported in the issue.
- A struct item in a mixed list gets its own Type row. Switching a
list back to Mixed keeps the type on each item.
- syncStructTypes brings marked items into shape and carries renames
into them, also inside overrides and nested lists. One undo step.
- The delete dialog of a struct asset also counts typed lists.
- The game never sees the key. World and sharedState strip it with
withoutItemTypes and bagWithoutItemTypes, so a struct stays a
plain object at runtime.
- Add item and Set item get the setting Type. With a type they only
accept a struct with exactly its field names (fitsType in
SetItem.ts). Anything else is left out and logged.
- The item indent from #252 is back to its old width, the narrow one
squeezed the value fields.
Not done: writing a variable does not check the type, and the List
node offers no type.
Found on the way: a test helper in list-of-structs.test.ts called
nodes without params. It now passes the same arguments as the
interpreter.
Tests:
- ./check.sh: 183 files, 2679 tests, CHECK EXIT 0
- e2e GM_STEPS=1,21,22,32,54,55: ALL PASSED, 150 checks
- e2e GM_STEPS=1-6,21,22,32,54,55 before the follow-up: 404 checks
- New: tests/core/typed-lists.test.ts, e2e module 55 with 13 checks
- Counter-checks bite in unit and browser, originals restored by cmp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A list could only grow through Join lists, and that takes its b apart:
a struct becomes one item per field and a list is joined. A list of
structs such as loot could not grow at all.
- Add item returns a new list with value as exactly one more item. A
struct or a list goes in whole. The list that came in is left alone,
like with Set item.
- index -1 or unset appends. Otherwise the item goes in before that
index. An index outside the list appends, so the value is not lost.
- The rule that an item takes the kind of its slot moved out of Set item
into fitToSlot. Both nodes use it, Set item behaves as before.
- No e2e check and no browser look. The node is covered by unit tests.
Tests:
- ./check.sh: 180 files, 2634 tests, CHECK EXIT 0
- 7 catalog cases, 4 cases in list-of-structs.test.ts, and index in the
whole-number inputs of texture-kind.test.ts
- Counter-check: taking the value apart like Join lists fails 3 tests
- This commit alone: tsc and the three touched unit files pass
(337 tests)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Structs and lists were capped at two fixed levels (list of structs,
struct with a list field). Anything deeper was dropped silently on
load, in node settings and when written to a variable. The cap came
from an early design choice, not from a technical need, so it is
lifted completely instead of adding a third fixed level.
- One kind list NESTED_KINDS replaces ListItemKind and
StructFieldKind. The flat special cases in listItems.ts are gone,
every value goes through one recursive path.
- A struct inside a struct is declared, like a top-level struct.
Values coming in over an edge are brought into that shape. Struct
items in lists still take their fields from the value.
- New valuePath.ts addresses any nested spot by keys and indices.
ListSlot.field is now ListSlot.path.
- Field commands (add, rename, remove) take the path to the struct.
They change declaration, own value and all overrides in one undo
step, as before on the top level.
- Inspector: "+ Field" offers Struct and List on every level. A
nested struct is a header row with its own "+ Field", its fields
are indented one step further.
- List tab: a list item shows "n items" and opens one level deeper.
The title shows the path, e.g. "Listy · nums · [3]".
- Pack in Pack now writes a struct into a struct field instead of
text. Objects are kept at any depth and stripped at every exit.
- A list edit in a struct field without an existing object override
now starts from the shown value instead of an empty struct.
- Old projects load unchanged. Save, load and save again gives the
same result.
Tests:
- ./check.sh: 172 files, 2498 tests, CHECK EXIT 0
- e2e 21 + 22: ALL PASSED, 90 checks (new 21d-iii, 22f-ii,
21d and 22f updated)
- 20 new unit tests in nested-values.test.ts and
nested-list-slot.test.ts, three tests that pinned the old cap
turned around
- 6 counter-probes, each fails 1 to 8 tests, originals restored
and checked with cmp
- Not covered: a nested struct inside a struct item in the list
tab has no e2e click
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A kind like colour or texture used to be spelled out in five parallel
lists, its port type, its empty value, its glyph, its label and its list
tag - 22 literal places for texture alone. core/properties/kinds.ts now
holds one row per kind and the rest is derived from it, so adding a kind
is one row. The five literal nodes collapse into literals.ts, the six
kind menus into one helper.
Number, Text, Boolean is now the one order everywhere; the variable and
port menus used to list Boolean before Text.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A list no longer says what its items are. ListDef.items, ListDef.fields,
ListFieldDef.items and SetListItemsCommand are gone; the single seam is
src/core/properties/listItems.ts. JSON already tells number, text, boolean
and struct apart, so only two kinds need a tag: {"$color": n} and the new
{"$texture": id}. Field names cannot start with "$", so a tag never
collides with a struct field. On a data link a texture item arrives as
its bare id; the graph has no images.
List tab: the mark in front of each row is the kind picker, "+ Item"
asks for the kind, both are ordinary value edits (one undo step). A list
inside a struct field only offers the flat kinds because the depth rule
forbids a struct item there (ListAccess.kinds); the menu used to offer
it and silently do nothing.
Legacy lists that declared items: 'color' are tagged on load.
Actor demo: the four walk animations and four standing frames live in
two list variables of texture items indexed by facing (Item at), so the
graph can be rebuilt in the editor. The stand frames get their grid ids
back; 44 nodes instead of 46.
Also: the user's edits to on-start-during-play.md and the new note
reseed-because-of-list.md.
Verified: check.sh 794 tests, full e2e 631 checks, smokes 24/19/20.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A list item may now be a struct. The depth is bounded in the declaration
rather than by a comment: FieldKind (number|text|boolean|color) says what a
struct field holds, ListItemKind adds struct on top and says what a list
holds, so list -> struct -> primitive is the deepest storable shape and
sameValue stays finite. A struct item renders inline in the List tab, which
is why it needs no path in the slot address.
Four paths silently assumed a list item was a primitive: sameValue compared
items with ===, textOf would have printed [object Object], asListItem turned
a struct into text on Set item and Fill, and Index of used indexOf, which is
reference equality and could never have found a struct.
Tetris now runs on bundles. shapes is 112 {x, y} structs instead of 224 loose
numbers, piece and the candidate are structs, so Next move hands back a whole
candidate and each strand packs only the field it changes, since mergeStruct
leaves the rest standing. Declared behavior ports drop 49 -> 35, the master's
variables 18 -> 13, its graph 84/94 -> 69/76 nodes/edges.
Get variables and Set variables declare their ports from a list of variable
names, the way Pack and Expand already do, so one node can read or write
several at once. Renaming a variable rewires them, because there the port key
is the variable name.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>