@Asset(kind, map): a path under each map's directory - ludicc --check looks for it in every map (a @PerMap row's in its own, a game-wide row's in all), unless @Asset(kind, map, optional); the schema marks it scope map; reseeded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 22:13:14 +03:00
parent 9cc67fee74
commit af90a1a334
10 changed files with 79959 additions and 77965 deletions

View file

@ -135,11 +135,21 @@ function at_field(g: int, a: pointer) -> void {
g_at_strs_next = (a == "OneOf") and g_at_allstr
if (a == "Range") and n != 2 { perr("@Range takes the least and the most: @Range(0, 1.5)") }
if (a == "Range") and not g_at_allnum { perr("@Range takes two numbers: @Range(0, 1.5)") }
if ((a == "Unit") or (a == "Asset")) and (n != 1 or toks[pi - 2].kind != TK_STR) { perr(`@{a} takes one string: @{a}("m/s")`) }
if (a == "Unit") and (n != 1 or toks[pi - 2].kind != TK_STR) { perr(`@{a} takes one string: @{a}("m/s")`) }
if (a == "Asset") and not at_asset_ok(args, n) { perr("@Asset takes a kind, and `map` for a path under each map's directory (then `optional`): @Asset(\"png\"), @Asset(\"png\", map), @Asset(\"png\", map, optional)") }
if a == "Unit" { at_unit_check(g_at_arg0, toks[pi - 2]) }
if at_flag(a) and n != 0 { perr(`@{a} takes nothing`) }
at_push(g, a, args, g_at_arg0, n)
}
# @Asset("png"), @Asset("png", map) or @Asset("png", map, optional)
function at_asset_ok(args: pointer, n: int) -> bool {
if n < 1 or n > 3 { return false }
let w = at_arg_names(args)
if len(w) != n { return false }
if n >= 2 and not (w[1] == "map") { return false }
if n == 3 and not (w[2] == "optional") { return false }
return true
}
# a field's group, made the first time it needs one
function at_field_group(f: Node) -> int {
if f.at < 0 { f.at = at_group() }