wip(0.S3): the packages migrated by ludic migrate state packages - every package test green

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 14:02:21 +03:00
parent 1e8b5b0523
commit 07505e7ef2
294 changed files with 14996 additions and 14675 deletions

View file

@ -16,14 +16,13 @@ export property System {
# fishing_tick }` from its own module; the runner starts from these, then core_add appends
export open registry Systems of System as SYS
var cs_list: []System = null
function cs_all() -> []System {
if cs_list == null {
cs_list = new []System
for i in 0 .. SYS_COUNT { push(cs_list, Systems[i]) }
function cs_all(base_st: mut BaseState) -> []System {
if base_st.cs_list == null {
base_st.cs_list = new []System
for i in 0 .. SYS_COUNT { push(base_st.cs_list, Systems[i]) }
}
return cs_list
return base_st.cs_list
}
export function system_new(key: string, phase: int) -> System {
@ -34,8 +33,8 @@ export function system_new(key: string, phase: int) -> System {
}
# a key is a save section's name, so two systems may not share one
export function core_add(s: System) -> void {
let all = cs_all()
export function core_add(base_st: mut BaseState, s: System) -> void {
let all = cs_all(base_st)
for i in 0 .. len(all) {
if all[i].key == s.key {
print(`ludic.base: two systems are keyed "{s.key}"`)
@ -45,21 +44,21 @@ export function core_add(s: System) -> void {
push(all, s)
}
export function core_clear() -> void { cs_list = new []System }
export function core_count() -> int { return len(cs_all()) }
export function core_clear(base_st: mut BaseState) -> void { base_st.cs_list = new []System }
export function core_count(base_st: mut BaseState) -> int { return len(cs_all(base_st)) }
export function core_init_all() -> void {
let all = cs_all()
export function core_init_all(base_st: mut BaseState) -> void {
let all = cs_all(base_st)
for i in 0 .. len(all) { if all[i].init != null { all[i].init() } }
}
export function core_reset_all() -> void {
let all = cs_all()
export function core_reset_all(base_st: mut BaseState) -> void {
let all = cs_all(base_st)
for i in 0 .. len(all) { if all[i].reset != null { all[i].reset() } }
}
export function core_tick_all(t: Tick) -> void {
let all = cs_all()
export function core_tick_all(base_st: mut BaseState, t: Tick) -> void {
let all = cs_all(base_st)
for ph in 0 .. PH_COUNT {
for i in 0 .. len(all) {
if all[i].phase == ph and all[i].tick != null { all[i].tick(t) }
@ -68,9 +67,9 @@ export function core_tick_all(t: Tick) -> void {
}
# every system that saves, under its key with its version
export function core_save_all() -> Val {
export function core_save_all(base_st: mut BaseState) -> Val {
let root = save_tree()
let all = cs_all()
let all = cs_all(base_st)
for i in 0 .. len(all) {
if all[i].save != null { save_section(root, all[i].key, all[i].version, all[i].save()) }
}
@ -78,8 +77,8 @@ export function core_save_all() -> Val {
}
# each system its own section; one with no section (or no load) is reset instead
export function core_load_all(root: Val) -> void {
let all = cs_all()
export function core_load_all(base_st: mut BaseState, root: Val) -> void {
let all = cs_all(base_st)
for i in 0 .. len(all) {
let n = load_section(root, all[i].key)
if n.found and all[i].load != null { all[i].load(n.data, n.version) } else if all[i].reset != null { all[i].reset() }