attributes: @Node(field), @Derived, @Text, @Multiline and @Key on a field, into the schema - @Node's field must be @Asset("gltf") or an @Ref to a registry whose record has exactly one, every failure reported; reseeded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 18:31:17 +03:00
parent b647964839
commit ebfbabdfd8
10 changed files with 73439 additions and 71415 deletions

View file

@ -1,8 +1,8 @@
# attributes.ludic — editor metadata on the @-syntax: which registry a field indexes, which constants
# it takes, its range, its unit, the kind of file it names, that it is a colour, and a registry's own
# rules (append only, saved by key). None of them changes what the program does: `ludicc
# --emit-schema` carries them to an editor with every record, registry entry and const. One is
# checked - @Ref must name a registry that exists.
# --emit-schema` carries them to an editor with every record, registry entry and const. Two are
# checked - @Ref must name a registry that exists, and @Node a field of its record naming a glTF.
#
# Running it prints: 2 1 Lantern 2
program Attributes {
@ -26,9 +26,18 @@ program Attributes {
model: string = "" # its model, under assets/kit
@Color tint: int = 16777215
@OneOf(VD_) stocked_at: int = VD_STORE
@Node(model) grip: string = "grip" # where a hand holds it, a node in that model
@Derived reach: float = 0.0 # worked out at boot from the model
@Text @Multiline blurb: string = "" # what the shop says about it
@Key bind: int = 0 # the key that takes it in hand
}
@AppendOnly
registry Tools of Tool as TL from "data/attr_tools.lres"
# a tool hung on the camp's rack: which, and from which node of ITS model
property RackSlot {
@Ref(Tools) tool: int = 0
@Node(tool) hook: string = "grip"
}
const CAMP_TOOLS: int = 2 * VD_COUNT # how many a camp can carry
# the tool a new camp starts with
function first_tool() -> string { return Tools[0].name }

View file

@ -0,0 +1,18 @@
# attributes: @Node names a field of its record that names a glTF - `handle` names no field, `tag`
# is a plain string, and `kit` refers to a registry whose record has two models (all three are reported)
program R {
property Kit {
key: string = ""
@Asset("gltf") body: string = ""
@Asset("gltf") lod: string = ""
}
registry Kits of Kit
property Tool {
tag: string = ""
@Ref(Kits) kit: int = 0
@Node(handle) grip: string = ""
@Node(tag) tip: string = ""
@Node(kit) hook: string = ""
}
entry { print(KITS_COUNT) }
}