ludic/packages/ludic.shop/system.ludic

16 lines
598 B
Text

# system.ludic - the shop as a system: a reset and nothing saved (the week's demand follows from
# the day, and nobody is at a counter across a save)
export function shop_reset(shop_st: mut ShopState) -> void {
shop_st.shop_at = -1
shop_demand_reset(shop_st)
q_clear(shop_trades(shop_st))
}
export function shop_system() -> System {
let s = system_new("shop", PH_COMMIT)
s.reset = fn shop_reset
s.tick = fn shop_tick
return s
}
# the week's demand, rolled when the week turns - the questions read it
function shop_tick(shop_st: mut ShopState, t: Tick) -> void { shop_roll(shop_st) }