wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run

ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
  1804 vars into 126 states, 64 into lets; 23498 edits in 460 files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 15:31:34 +03:00
parent 5ffe50ed02
commit 19fcf60599
459 changed files with 17862 additions and 17603 deletions

View file

@ -1,43 +1,43 @@
# system.ludic - gear as a system: the burn each tick, and the levels and charges saved by key (the
# hand is not saved: a trip opens with empty hands)
export function gear_reset() -> void {
gear__ensure()
for k in 0 .. GEAR_COUNT { gear__lv[k] = GearKinds[k].start }
export function gear_reset(base_st: mut BaseState, gear_st: mut GearState) -> void {
gear__ensure(gear_st)
for k in 0 .. GEAR_COUNT { gear_st.gear__lv[k] = GearKinds[k].start }
for c in 0 .. CHARGE_COUNT {
gear__left[c] = GearCharges[c].full
gear__on[c] = false
gear_st.gear__left[c] = GearCharges[c].full
gear_st.gear__on[c] = false
}
gear__hand = -1
q_clear(gear_facts())
gear_st.gear__hand = -1
q_clear(base_st, gear_facts(base_st, gear_st))
}
export function gear_save() -> Val {
gear__ensure()
export function gear_save(gear_st: mut GearState) -> Val {
gear__ensure(gear_st)
let v = Value.object()
let lv = Value.object()
for k in 0 .. GEAR_COUNT { sv_put_int(lv, GearKinds[k].key, gear__lv[k]) }
for k in 0 .. GEAR_COUNT { sv_put_int(lv, GearKinds[k].key, gear_st.gear__lv[k]) }
Value.put(v, "levels", lv)
let ch = Value.object()
for c in 0 .. CHARGE_COUNT { sv_put_float(ch, GearCharges[c].key, gear__left[c]) }
for c in 0 .. CHARGE_COUNT { sv_put_float(ch, GearCharges[c].key, gear_st.gear__left[c]) }
Value.put(v, "charges", ch)
return v
}
# a kind the file does not name starts where a new trip does; then what the pack carries counts
export function gear_load(v: Val, version: int) -> void {
gear_reset()
export function gear_load(base_st: mut BaseState, gear_st: mut GearState, v: Val, version: int) -> void {
gear_reset(base_st, gear_st)
if Value.has(v, "levels") != 0 {
let lv = Value.get(v, "levels")
for k in 0 .. GEAR_COUNT { gear__lv[k] = sv_int(lv, GearKinds[k].key, GearKinds[k].start) }
for k in 0 .. GEAR_COUNT { gear_st.gear__lv[k] = sv_int(lv, GearKinds[k].key, GearKinds[k].start) }
}
if Value.has(v, "charges") != 0 {
let ch = Value.get(v, "charges")
for c in 0 .. CHARGE_COUNT { gear_charge_set(c, sv_float(ch, GearCharges[c].key, GearCharges[c].full)) }
for c in 0 .. CHARGE_COUNT { gear_charge_set(gear_st, c, sv_float(ch, GearCharges[c].key, GearCharges[c].full)) }
}
gear_sync()
gear_sync(gear_st)
}
function gear__tick(t: Tick) -> void { gear__burn(t.hours) }
function gear__tick(base_st: mut BaseState, gear_st: mut GearState, t: Tick) -> void { gear__burn(base_st, gear_st, t.hours) }
export function gear_system() -> System {
let s = system_new("gear", PH_SIMULATE)