47 lines
1.5 KiB
Text
47 lines
1.5 KiB
Text
# state.ludic - what is running, how many may, and the facts the package reports
|
|
export property Effect {
|
|
kind: int = 0
|
|
mag: float = 0.0
|
|
left: float = 0.0
|
|
delay: float = 0.0
|
|
bonus: bool = false
|
|
label: string = ""
|
|
}
|
|
|
|
# why an effect ended: it ran out, a newer bonus pushed it past the cap, or the ring was full
|
|
export const EFFECT_RAN_OUT: int = 0
|
|
export const EFFECT_PUSHED_OUT: int = 1
|
|
export const EFFECT_CROWDED_OUT: int = 2
|
|
|
|
export property EffectEnded {
|
|
kind: int = 0
|
|
label: string = ""
|
|
why: int = 0
|
|
bonus: bool = false
|
|
}
|
|
|
|
export state EffectsState {
|
|
ef_list: []Effect = new []Effect
|
|
ef_max: int = 8
|
|
ef_bonus_max: int = 3
|
|
ef_ended: Queue<EffectEnded> = ef_ended__new()
|
|
}
|
|
|
|
function ef_all(effects_st: EffectsState) -> []Effect {
|
|
return effects_st.ef_list
|
|
}
|
|
|
|
# the facts: what ended and why, oldest first; the game drains it
|
|
export function effects_ended(effects_st: EffectsState) -> Queue<EffectEnded> {
|
|
return effects_st.ef_ended
|
|
}
|
|
|
|
# how many may run at once, and how many of those may be bonuses
|
|
export function effects_config(effects_st: mut EffectsState, max: int, bonus_max: int) -> void {
|
|
effects_st.ef_max = max
|
|
effects_st.ef_bonus_max = bonus_max
|
|
}
|
|
|
|
export function effects_capacity(effects_st: EffectsState) -> int { return effects_st.ef_max }
|
|
export function effects_bonus_capacity(effects_st: EffectsState) -> int { return effects_st.ef_bonus_max }
|
|
function ef_ended__new() -> Queue<EffectEnded> { return queue_new("effects.ended") }
|