wip(0.S2): migrate - a var nothing writes becomes a let; a state is keyed by its module, directory or program, so every program's plan agrees; paths normalized; program states named SceneDemoState / scene_demo_st; the LSP reads state, mut and entry/handler parameters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3eda72e8c2
commit
5ffe50ed02
463 changed files with 72045 additions and 67421 deletions
|
|
@ -1,13 +1,9 @@
|
|||
# verbs.ludic - can it be made, taking and giving back its makings, and making it
|
||||
export state CraftingState {
|
||||
craft_hold_i: int = -1
|
||||
craft_hold_t: float = 0.0
|
||||
craft_fact_q: Queue<Crafted> = null
|
||||
}
|
||||
var craft_fact_q: Queue<Crafted> = null
|
||||
|
||||
export function craft_facts(base_st: mut BaseState, crafting_st: mut CraftingState) -> Queue<Crafted> {
|
||||
if crafting_st.craft_fact_q == null { crafting_st.craft_fact_q = queue_new(base_st, "crafting.crafted") }
|
||||
return crafting_st.craft_fact_q
|
||||
export function craft_facts() -> Queue<Crafted> {
|
||||
if craft_fact_q == null { craft_fact_q = queue_new("crafting.crafted") }
|
||||
return craft_fact_q
|
||||
}
|
||||
|
||||
# every making is in the pack
|
||||
|
|
@ -50,7 +46,7 @@ export function craft_refund(i: int) -> void {
|
|||
}
|
||||
}
|
||||
|
||||
function craft_fact_push(base_st: mut BaseState, crafting_st: mut CraftingState, i: int, queued: bool) -> void {
|
||||
function craft_fact_push(i: int, queued: bool) -> void {
|
||||
let r = CraftRecipes[i]
|
||||
let c = new Crafted
|
||||
c.recipe = i
|
||||
|
|
@ -58,12 +54,12 @@ function craft_fact_push(base_st: mut BaseState, crafting_st: mut CraftingState,
|
|||
c.n = r.n
|
||||
c.station = r.station
|
||||
c.queued = queued
|
||||
q_push(base_st, craft_facts(base_st, crafting_st), c)
|
||||
q_push(craft_facts(), c)
|
||||
}
|
||||
|
||||
# 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(base_st: mut BaseState, crafting_st: mut CraftingState, i: int) -> bool {
|
||||
export function craft_make(i: int) -> bool {
|
||||
if not craft_can(i) { return false }
|
||||
let r = CraftRecipes[i]
|
||||
craft_take(i)
|
||||
|
|
@ -72,10 +68,10 @@ export function craft_make(base_st: mut BaseState, crafting_st: mut CraftingStat
|
|||
craft_refund(i)
|
||||
return false
|
||||
}
|
||||
craft_fact_push(base_st, crafting_st, i, true)
|
||||
craft_fact_push(i, true)
|
||||
return true
|
||||
}
|
||||
CraftPack.add(r.out, r.n)
|
||||
craft_fact_push(base_st, crafting_st, i, false)
|
||||
craft_fact_push(i, false)
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue