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:
parent
1e8b5b0523
commit
07505e7ef2
294 changed files with 14996 additions and 14675 deletions
|
|
@ -1,9 +1,13 @@
|
|||
# verbs.ludic - can it be made, taking and giving back its makings, and making it
|
||||
var craft_fact_q: Queue<Crafted> = null
|
||||
export state CraftingState {
|
||||
craft_hold_i: int = -1
|
||||
craft_hold_t: float = 0.0
|
||||
craft_fact_q: Queue<Crafted> = null
|
||||
}
|
||||
|
||||
export function craft_facts() -> Queue<Crafted> {
|
||||
if craft_fact_q == null { craft_fact_q = queue_new("crafting.crafted") }
|
||||
return craft_fact_q
|
||||
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
|
||||
}
|
||||
|
||||
# every making is in the pack
|
||||
|
|
@ -46,7 +50,7 @@ export function craft_refund(i: int) -> void {
|
|||
}
|
||||
}
|
||||
|
||||
function craft_fact_push(i: int, queued: bool) -> void {
|
||||
function craft_fact_push(base_st: mut BaseState, crafting_st: mut CraftingState, i: int, queued: bool) -> void {
|
||||
let r = CraftRecipes[i]
|
||||
let c = new Crafted
|
||||
c.recipe = i
|
||||
|
|
@ -54,12 +58,12 @@ function craft_fact_push(i: int, queued: bool) -> void {
|
|||
c.n = r.n
|
||||
c.station = r.station
|
||||
c.queued = queued
|
||||
q_push(craft_facts(), c)
|
||||
q_push(base_st, craft_facts(base_st, crafting_st), 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(i: int) -> bool {
|
||||
export function craft_make(base_st: mut BaseState, crafting_st: mut CraftingState, i: int) -> bool {
|
||||
if not craft_can(i) { return false }
|
||||
let r = CraftRecipes[i]
|
||||
craft_take(i)
|
||||
|
|
@ -68,10 +72,10 @@ export function craft_make(i: int) -> bool {
|
|||
craft_refund(i)
|
||||
return false
|
||||
}
|
||||
craft_fact_push(i, true)
|
||||
craft_fact_push(base_st, crafting_st, i, true)
|
||||
return true
|
||||
}
|
||||
CraftPack.add(r.out, r.n)
|
||||
craft_fact_push(i, false)
|
||||
craft_fact_push(base_st, crafting_st, i, false)
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue