attributes: @Tint(SLOT) on a colour field, into the schema - SLOT must be a constant that exists (a row of the program's tint-slot registry); reseeded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 18:51:27 +03:00
parent 34c2ac2cb9
commit b5bffe99fa
8 changed files with 71123 additions and 70774 deletions

View file

@ -11,15 +11,16 @@
# @Color tint: int = 0
# @Node(model) grip: string = "" # a node inside the glTF the field `model` names
# @Clip(model) idle: string = "" # a clip inside that glTF
# @Color @Tint(TSLOT_HAIR) hair: int = 0 # a colour for that tint slot (a constant that exists)
# @Derived reach: float = 0.0 # worked out at boot: anything written is overwritten
# @Text @Multiline blurb: string = "" # read by the player, so translated; prose
# @Key bind: int = 0 # a key code
# }
# @AppendOnly @ByKey registry Items of Item as IT from "items.lres"
#
# They change nothing the program does. Three are checked: @Ref must name a registry that exists,
# They change nothing the program does. Four are checked: @Ref must name a registry that exists,
# @Node and @Clip a field of its record that names a glTF (attrs_node.ludic), and a listing @OneOf
# constants that exist. A
# constants that exist, and @Tint a constant that exists (a slot's row in the game's registry). A
# field's or a registry's attributes are a group (Node.at, g_rg_at): a run of names, each with its
# arguments as JSON values - an identifier or a string as a string, a number as written.
var g_at_start: []int = new []int # a group's first attribute ...
@ -104,7 +105,7 @@ function at_lead0(raw: pointer) -> pointer {
# the editor attributes a field may carry, and what each takes
function at_field_known(a: pointer) -> bool {
if (a == "Ref") or (a == "OneOf") or (a == "Range") or (a == "Unit") or (a == "Asset") or (a == "Color") { return true }
return (a == "Node") or (a == "Clip") or at_flag(a)
return (a == "Node") or (a == "Clip") or (a == "Tint") or at_flag(a)
}
# the attributes that take nothing: they say what a field is
function at_flag(a: pointer) -> bool {
@ -114,7 +115,7 @@ function at_flag(a: pointer) -> bool {
function at_field(g: int, a: pointer) -> void {
let args = at_args()
let n = g_at_argn
if (a == "Ref") or (a == "Node") or (a == "Clip") {
if (a == "Ref") or (a == "Node") or (a == "Clip") or (a == "Tint") {
if n != 1 or toks[pi - 2].kind != TK_ID { perr(`@{a} takes one name: @{a}(Items)`) }
}
if (a == "OneOf") and (n < 1 or not g_at_allid) { perr("@OneOf takes a prefix or constants: @OneOf(GR_) or @OneOf(GR_GOLD, GR_SILVER)") }
@ -180,6 +181,9 @@ function at_check_field(d: Node, f: Node) -> void {
}
if (g_at_name[j] == "Node") or (g_at_name[j] == "Clip") { at_check_node(d, f, g_at_name[j], g_at_first[j]) }
if g_at_name[j] == "OneOf" { at_check_oneof(d, f, j) }
if (g_at_name[j] == "Tint") and not at_const_exists(g_at_first[j]) {
perr_at(f.file, f.line, f.col, `field {d.s}.{f.s}: @Tint({g_at_first[j]}) names no tint slot - there is no constant {g_at_first[j]}`)
}
j += 1
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff