refactor(packages): 0.R5 - a question no longer starts its state - 64 lazy starts ('if st.x == null { st.x = ... }' inside a getter) are the state's defaults, gear__ensure is gone, and ludic migrate state --tighten took mut off 208 package parameters: things_all, thing_find, gear_charge, gear_level, jobs_state and the rest read

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 00:51:03 +03:00
parent 54f5efb23f
commit 9862ec82e3
102 changed files with 320 additions and 351 deletions

View file

@ -2,11 +2,10 @@
export state CraftingState {
craft_hold_i: int = -1
craft_hold_t: float = 0.0
craft_fact_q: Queue<Crafted> = null
craft_fact_q: Queue<Crafted> = craft_fact_q__new()
}
export function craft_facts(crafting_st: mut CraftingState) -> Queue<Crafted> {
if crafting_st.craft_fact_q == null { crafting_st.craft_fact_q = queue_new("crafting.crafted") }
export function craft_facts(crafting_st: CraftingState) -> Queue<Crafted> {
return crafting_st.craft_fact_q
}
@ -50,7 +49,7 @@ export function craft_refund(i: int) -> void {
}
}
function craft_fact_push(crafting_st: mut CraftingState, i: int, queued: bool) -> void {
function craft_fact_push(crafting_st: CraftingState, i: int, queued: bool) -> void {
let r = CraftRecipes[i]
let c = new Crafted
c.recipe = i
@ -63,7 +62,7 @@ function craft_fact_push(crafting_st: mut CraftingState, i: int, queued: bool) -
# make it: a timed recipe at a station goes into the station (given back if it will not take it),
# anything else is handed over at once. False, and the pack untouched, when it cannot be made.
export function craft_make(crafting_st: mut CraftingState, i: int) -> bool {
export function craft_make(crafting_st: CraftingState, i: int) -> bool {
if not craft_can(i) { return false }
let r = CraftRecipes[i]
craft_take(i)
@ -79,3 +78,4 @@ export function craft_make(crafting_st: mut CraftingState, i: int) -> bool {
craft_fact_push(crafting_st, i, false)
return true
}
function craft_fact_q__new() -> Queue<Crafted> { return queue_new("crafting.crafted") }