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:
parent
5ffe50ed02
commit
19fcf60599
459 changed files with 17862 additions and 17603 deletions
|
|
@ -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() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue