feat(base): 0.R4 - a queue keeps its own count, so every package verb takes only its own state; ludic migrate state --prune
ludic.base's Queue<T> carries a QueueTag (its name and pending count): queue_new(name), q_push(q, v), q_drain(q), q_clear(q) take no BaseState, and core_undrained(tags) names the given queues still holding facts. A reducer on a package's state can now call that package's verbs (wallet_earn(wallet_st, n)). ludic migrate state --prune (ludicc --migrate-prune) takes out each state parameter a function no longer uses, nor anything it calls, and the argument that fills it - including an argument for a parameter the callee has dropped, which is taken out before the call is checked, so a generic's T is told by the argument that says it. A reducer keeps its state. --dry-run now counts the edits it would make. Every package was moved with it: 608 base_st parameters and their arguments, 1889 edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8cf4b3fed6
commit
71735b10a2
151 changed files with 58668 additions and 54719 deletions
|
|
@ -5,14 +5,14 @@ function wx_front_kind() -> int {
|
|||
return WeatherWorld.front()
|
||||
}
|
||||
|
||||
function wx_want_wet(base_st: mut BaseState, weather_st: mut WeatherState) -> void {
|
||||
function wx_want_wet(weather_st: mut WeatherState) -> void {
|
||||
if weather_st.wx_kinds[weather_st.wx_state].wet or weather_st.wx_forced { return }
|
||||
let front = wx_front_kind()
|
||||
weather_st.wx_next = front
|
||||
weather_st.wx_forecast = front
|
||||
weather_st.wx_forced = true
|
||||
if weather_st.wx_left > 1.5 { weather_st.wx_left = 1.5 }
|
||||
wx_fact(base_st, weather_st, WEATHER_FRONT, front, weather_st.wx_state)
|
||||
wx_fact(weather_st, WEATHER_FRONT, front, weather_st.wx_state)
|
||||
}
|
||||
|
||||
function wx_hold(weather_st: mut WeatherState) -> void {
|
||||
|
|
@ -34,9 +34,9 @@ function wx_want_clear(weather_st: mut WeatherState) -> void {
|
|||
}
|
||||
}
|
||||
|
||||
function wx_apply_bias(base_st: mut BaseState, weather_st: mut WeatherState) -> void {
|
||||
function wx_apply_bias(weather_st: mut WeatherState) -> void {
|
||||
let b = wx_bias()
|
||||
if b == WEATHER_WANT_WET { wx_want_wet(base_st, weather_st) }
|
||||
if b == WEATHER_WANT_WET { wx_want_wet(weather_st) }
|
||||
if b == WEATHER_HOLD { wx_hold(weather_st) }
|
||||
if b == WEATHER_WANT_CLEAR { wx_want_clear(weather_st) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# run.ludic - the sky moving on. Only the machine that owns the world runs the spells; every
|
||||
# machine eases the ground's wetness and makes its own lightning out of a storm it is told of.
|
||||
function wx_turn(base_st: mut BaseState, weather_st: mut WeatherState) -> void {
|
||||
function wx_turn(weather_st: mut WeatherState) -> void {
|
||||
let was = weather_st.wx_state
|
||||
weather_st.wx_state = weather_st.wx_next
|
||||
weather_st.wx_next = wx_pick_next(weather_st, weather_st.wx_state)
|
||||
|
|
@ -14,9 +14,9 @@ function wx_turn(base_st: mut BaseState, weather_st: mut WeatherState) -> void {
|
|||
# a front going through and leaving clear sky behind it: the light people get up for
|
||||
if weather_st.wx_kinds[weather_st.wx_state].clear and weather_st.wx_kinds[was].wet and not wx_night() {
|
||||
weather_st.wx_clear_t = 0.6
|
||||
wx_fact(base_st, weather_st, WEATHER_CLEARED, weather_st.wx_state, was)
|
||||
wx_fact(weather_st, WEATHER_CLEARED, weather_st.wx_state, was)
|
||||
}
|
||||
wx_fact(base_st, weather_st, WEATHER_BEGAN, weather_st.wx_state, was)
|
||||
wx_fact(weather_st, WEATHER_BEGAN, weather_st.wx_state, was)
|
||||
}
|
||||
|
||||
function wx_wind_tick(weather_st: mut WeatherState, dt: float) -> void {
|
||||
|
|
@ -33,10 +33,10 @@ function wx_wind_tick(weather_st: mut WeatherState, dt: float) -> void {
|
|||
}
|
||||
|
||||
# the spells: the story's lean, the clock running down, the edges eased, the wind
|
||||
function wx_spells(base_st: mut BaseState, weather_st: mut WeatherState, dt: float, gh: float) -> void {
|
||||
wx_apply_bias(base_st, weather_st)
|
||||
function wx_spells(weather_st: mut WeatherState, dt: float, gh: float) -> void {
|
||||
wx_apply_bias(weather_st)
|
||||
weather_st.wx_left = weather_st.wx_left - gh
|
||||
if weather_st.wx_left < 0.0 { wx_turn(base_st, weather_st) }
|
||||
if weather_st.wx_left < 0.0 { wx_turn(weather_st) }
|
||||
var want = 1.0
|
||||
if weather_st.wx_kinds[weather_st.wx_state].clear { want = 0.0 }
|
||||
if weather_st.wx_left < 0.5 and weather_st.wx_kinds[weather_st.wx_next].clear { want = 0.0 }
|
||||
|
|
@ -54,22 +54,22 @@ function wx_ground_tick(weather_st: mut WeatherState, dt: float) -> void {
|
|||
weather_st.wx_ground = weather_st.wx_ground + (want - weather_st.wx_ground) * Math.clamp(k, 0.0, 1.0)
|
||||
}
|
||||
|
||||
function wx_storm_tick(base_st: mut BaseState, weather_st: mut WeatherState, dt: float) -> void {
|
||||
function wx_storm_tick(weather_st: mut WeatherState, dt: float) -> void {
|
||||
weather_st.wx_flash = weather_st.wx_flash * Math.max(0.0, 1.0 - dt * 9.0)
|
||||
if not weather_st.wx_kinds[weather_st.wx_state].thunder or weather_st.wx_amount < 0.5 { return }
|
||||
weather_st.wx_thunder_t = weather_st.wx_thunder_t - dt
|
||||
if weather_st.wx_thunder_t < 0.0 {
|
||||
weather_st.wx_thunder_t = rng_span(weather_st.wx_dice, 9.0, 34.0)
|
||||
weather_st.wx_flash = 1.0
|
||||
wx_fact(base_st, weather_st, WEATHER_THUNDER, weather_st.wx_state, weather_st.wx_state)
|
||||
wx_fact(weather_st, WEATHER_THUNDER, weather_st.wx_state, weather_st.wx_state)
|
||||
}
|
||||
}
|
||||
|
||||
# one step: `dt` real seconds and `gh` game hours
|
||||
export function weather_run(base_st: mut BaseState, weather_st: mut WeatherState, dt: float, gh: float) -> void {
|
||||
export function weather_run(weather_st: mut WeatherState, dt: float, gh: float) -> void {
|
||||
if weather_kind_count(weather_st) == 0 { return }
|
||||
if wx_owns() { wx_spells(base_st, weather_st, dt, gh) }
|
||||
if wx_owns() { wx_spells(weather_st, dt, gh) }
|
||||
wx_ground_tick(weather_st, dt)
|
||||
wx_storm_tick(base_st, weather_st, dt)
|
||||
wx_storm_tick(weather_st, dt)
|
||||
if weather_wet(weather_st) { weather_st.wx_wet_today = true }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,15 +78,15 @@ export state WeatherState {
|
|||
}
|
||||
|
||||
# the facts, oldest first; the game drains them into its notices and sounds
|
||||
export function weather_facts(base_st: mut BaseState, weather_st: mut WeatherState) -> Queue<WeatherFact> {
|
||||
if weather_st.wx_facts == null { weather_st.wx_facts = queue_new(base_st, "weather.facts") }
|
||||
export function weather_facts(weather_st: mut WeatherState) -> Queue<WeatherFact> {
|
||||
if weather_st.wx_facts == null { weather_st.wx_facts = queue_new("weather.facts") }
|
||||
return weather_st.wx_facts
|
||||
}
|
||||
|
||||
function wx_fact(base_st: mut BaseState, weather_st: mut WeatherState, what: int, kind: int, from: int) -> void {
|
||||
function wx_fact(weather_st: mut WeatherState, what: int, kind: int, from: int) -> void {
|
||||
let f = new WeatherFact
|
||||
f.what = what
|
||||
f.kind = kind
|
||||
f.from = from
|
||||
q_push(base_st, weather_facts(base_st, weather_st), f)
|
||||
q_push(weather_facts(weather_st), f)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# system.ludic - the weather as a system: PH_SIMULATE, and its own save section
|
||||
function weather_tick(base_st: mut BaseState, weather_st: mut WeatherState, t: Tick) -> void { weather_run(base_st, weather_st, t.dt, t.hours) }
|
||||
function weather_tick(weather_st: mut WeatherState, t: Tick) -> void { weather_run(weather_st, t.dt, t.hours) }
|
||||
|
||||
export function weather_save(weather_st: WeatherState) -> Val {
|
||||
let v = Value.object()
|
||||
|
|
@ -22,8 +22,8 @@ function wx_kind_ok(weather_st: WeatherState, k: int) -> int {
|
|||
return k
|
||||
}
|
||||
|
||||
export function weather_load(base_st: mut BaseState, weather_st: mut WeatherState, v: Val, version: int) -> void {
|
||||
weather_reset(base_st, weather_st)
|
||||
export function weather_load(weather_st: mut WeatherState, v: Val, version: int) -> void {
|
||||
weather_reset(weather_st)
|
||||
weather_st.wx_state = wx_kind_ok(weather_st, sv_int(v, "state", 0))
|
||||
weather_st.wx_next = wx_kind_ok(weather_st, sv_int(v, "next", 0))
|
||||
weather_st.wx_left = sv_float(v, "left", 10.0)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ program WeatherTest {
|
|||
}
|
||||
|
||||
# clear, rain and storm: clear always goes to rain, rain to storm, storm to clear
|
||||
function fresh(base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) -> void {
|
||||
function fresh(weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) -> void {
|
||||
weather_test_st.owns = true
|
||||
weather_test_st.hours = 12.0
|
||||
weather_test_st.bias = WEATHER_NO_BIAS
|
||||
|
|
@ -70,132 +70,132 @@ program WeatherTest {
|
|||
push(ks, kind("storm", true, true, odds3(1.0, 0.0, 0.0)))
|
||||
weather_kinds(weather_st, ks)
|
||||
weather_config_wind(weather_st, 0.5, 2.5, 10.0, 19.0)
|
||||
weather_reset(base_st, weather_st)
|
||||
weather_reset(weather_st)
|
||||
}
|
||||
|
||||
function facts(base_st: mut BaseState, weather_st: mut WeatherState) -> []WeatherFact { return q_drain(base_st, weather_facts(base_st, weather_st)) }
|
||||
function step(base_st: mut BaseState, weather_st: mut WeatherState, dt: float, gh: float, n: int) -> void { for i in 0 .. n { weather_run(base_st, weather_st, dt, gh) } }
|
||||
function facts(weather_st: mut WeatherState) -> []WeatherFact { return q_drain(weather_facts(weather_st)) }
|
||||
function step(weather_st: mut WeatherState, dt: float, gh: float, n: int) -> void { for i in 0 .. n { weather_run(weather_st, dt, gh) } }
|
||||
function count(fs: []WeatherFact, what: int) -> int {
|
||||
var n = 0
|
||||
for i in 0 .. len(fs) { if fs[i].what == what { n += 1 } }
|
||||
return n
|
||||
}
|
||||
|
||||
test "a new trip is clear, dry and forecast clear" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "a new trip is clear, dry and forecast clear" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
expect_eq(weather_state(weather_st), 0)
|
||||
expect_eq(weather_forecast(weather_st), 0)
|
||||
expect(not weather_wet(weather_st))
|
||||
expect(weather_cold(weather_st) == 0.0)
|
||||
}
|
||||
|
||||
test "a spell that runs out gives way to the next, as a fact" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "a spell that runs out gives way to the next, as a fact" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_set(weather_st, 0, 1, 0.1)
|
||||
step(base_st, weather_st, 0.1, 0.2, 1)
|
||||
step(weather_st, 0.1, 0.2, 1)
|
||||
expect_eq(weather_state(weather_st), 1)
|
||||
expect_eq(weather_next(weather_st), 2)
|
||||
let fs = facts(base_st, weather_st)
|
||||
let fs = facts(weather_st)
|
||||
expect_eq(count(fs, WEATHER_BEGAN), 1)
|
||||
expect(weather_left(weather_st) >= 1.0 and weather_left(weather_st) < 3.0)
|
||||
}
|
||||
|
||||
test "the amount eases in, and wet follows it" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "the amount eases in, and wet follows it" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_set(weather_st, 0, 1, 0.01)
|
||||
step(base_st, weather_st, 0.1, 0.02, 1)
|
||||
step(weather_st, 0.1, 0.02, 1)
|
||||
expect(not weather_wet(weather_st))
|
||||
step(base_st, weather_st, 0.1, 0.0, 200)
|
||||
step(weather_st, 0.1, 0.0, 200)
|
||||
expect(weather_wet(weather_st))
|
||||
expect(weather_cold(weather_st) > 4.0)
|
||||
expect(weather_ground_wet(weather_st) > 0.5)
|
||||
}
|
||||
|
||||
test "a storm throws lightning, and a clearing in daylight is a fact" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "a storm throws lightning, and a clearing in daylight is a fact" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_set(weather_st, 2, 0, 2.0)
|
||||
step(base_st, weather_st, 1.0, 0.0, 60)
|
||||
expect(count(facts(base_st, weather_st), WEATHER_THUNDER) > 0)
|
||||
step(weather_st, 1.0, 0.0, 60)
|
||||
expect(count(facts(weather_st), WEATHER_THUNDER) > 0)
|
||||
weather_set(weather_st, 2, 0, 0.05)
|
||||
step(base_st, weather_st, 0.1, 0.1, 1)
|
||||
step(weather_st, 0.1, 0.1, 1)
|
||||
expect_eq(weather_state(weather_st), 0)
|
||||
expect(weather_after_front(weather_st))
|
||||
expect_eq(count(facts(base_st, weather_st), WEATHER_CLEARED), 1)
|
||||
expect_eq(count(facts(weather_st), WEATHER_CLEARED), 1)
|
||||
}
|
||||
|
||||
test "the world's odds overrule the kind's" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "the world's odds overrule the kind's" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_test_st.lean = odds3(0.0, 0.0, 1.0)
|
||||
weather_set(weather_st, 0, 0, 0.01)
|
||||
step(base_st, weather_st, 0.1, 0.1, 1)
|
||||
step(weather_st, 0.1, 0.1, 1)
|
||||
expect_eq(weather_next(weather_st), 2)
|
||||
}
|
||||
|
||||
test "wanting rain forecasts a front and holds it long enough" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "wanting rain forecasts a front and holds it long enough" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_test_st.bias = WEATHER_WANT_WET
|
||||
step(base_st, weather_st, 0.1, 0.01, 1)
|
||||
step(weather_st, 0.1, 0.01, 1)
|
||||
expect(weather_forced(weather_st))
|
||||
expect_eq(weather_forecast(weather_st), 1)
|
||||
expect_eq(count(facts(base_st, weather_st), WEATHER_FRONT), 1)
|
||||
step(base_st, weather_st, 0.1, 2.0, 1)
|
||||
expect_eq(count(facts(weather_st), WEATHER_FRONT), 1)
|
||||
step(weather_st, 0.1, 2.0, 1)
|
||||
expect_eq(weather_state(weather_st), 1)
|
||||
expect(not weather_forced(weather_st))
|
||||
expect(weather_left(weather_st) >= 6.0)
|
||||
}
|
||||
|
||||
test "wanting clear sky clears it and keeps it" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "wanting clear sky clears it and keeps it" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_set(weather_st, 1, 1, 5.0)
|
||||
weather_test_st.bias = WEATHER_WANT_CLEAR
|
||||
step(base_st, weather_st, 0.1, 0.6, 1)
|
||||
step(weather_st, 0.1, 0.6, 1)
|
||||
expect_eq(weather_state(weather_st), 0)
|
||||
step(base_st, weather_st, 0.1, 0.9, 5)
|
||||
step(weather_st, 0.1, 0.9, 5)
|
||||
expect_eq(weather_state(weather_st), 0)
|
||||
}
|
||||
|
||||
test "a machine that does not own the world runs no spells, but is told them" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "a machine that does not own the world runs no spells, but is told them" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_test_st.owns = false
|
||||
weather_set(weather_st, 0, 1, 0.1)
|
||||
step(base_st, weather_st, 0.1, 5.0, 3)
|
||||
step(weather_st, 0.1, 5.0, 3)
|
||||
expect_eq(weather_state(weather_st), 0)
|
||||
weather_told(base_st, weather_st, 2, 0, 3.0, 1.0, 0.9, 1.0, 2)
|
||||
weather_told(weather_st, 2, 0, 3.0, 1.0, 0.9, 1.0, 2)
|
||||
expect_eq(weather_state(weather_st), 2)
|
||||
expect_eq(count(facts(base_st, weather_st), WEATHER_BEGAN), 1)
|
||||
step(base_st, weather_st, 1.0, 0.0, 60)
|
||||
expect(count(facts(base_st, weather_st), WEATHER_THUNDER) > 0)
|
||||
expect_eq(count(facts(weather_st), WEATHER_BEGAN), 1)
|
||||
step(weather_st, 1.0, 0.0, 60)
|
||||
expect(count(facts(weather_st), WEATHER_THUNDER) > 0)
|
||||
}
|
||||
|
||||
test "the wind turns with the hours" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "the wind turns with the hours" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_test_st.hours = 3.0
|
||||
step(base_st, weather_st, 1.0, 0.0, 100)
|
||||
step(weather_st, 1.0, 0.0, 100)
|
||||
expect(Math.abs(weather_dir(weather_st) - 0.5) < 0.01)
|
||||
weather_test_st.hours = 12.0
|
||||
step(base_st, weather_st, 1.0, 0.0, 100)
|
||||
step(weather_st, 1.0, 0.0, 100)
|
||||
expect(Math.abs(weather_dir(weather_st) - 2.5) < 0.01)
|
||||
}
|
||||
|
||||
test "a morning after rain remembers it was wet" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "a morning after rain remembers it was wet" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_set(weather_st, 1, 1, 5.0)
|
||||
step(base_st, weather_st, 0.1, 0.0, 1)
|
||||
step(weather_st, 0.1, 0.0, 1)
|
||||
weather_morning(weather_st)
|
||||
expect(weather_wet_yesterday(weather_st))
|
||||
}
|
||||
|
||||
test "a save section reads back the same sky" (base_st: mut BaseState, weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(base_st, weather_st, weather_test_st)
|
||||
test "a save section reads back the same sky" (weather_st: mut WeatherState, weather_test_st: mut WeatherTestState) {
|
||||
fresh(weather_st, weather_test_st)
|
||||
weather_set(weather_st, 1, 2, 4.25)
|
||||
weather_morning(weather_st)
|
||||
let fc = weather_forecast(weather_st)
|
||||
let root = save_tree()
|
||||
save_section(root, "weather", 1, weather_save(weather_st))
|
||||
let text = save_encode(root)
|
||||
weather_reset(base_st, weather_st)
|
||||
weather_reset(weather_st)
|
||||
let n = load_section(save_decode(text), "weather")
|
||||
weather_load(base_st, weather_st, n.data, n.version)
|
||||
weather_load(weather_st, n.data, n.version)
|
||||
expect_eq(weather_state(weather_st), 1)
|
||||
expect(weather_left(weather_st) == 4.25)
|
||||
expect_eq(weather_forecast(weather_st), fc)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# verbs.ludic - the only way the sky changes from outside: a morning, a reset, the host's word
|
||||
# a new trip: clear sky, a still-ish wind, nothing forecast; the dice from the world's seed
|
||||
export function weather_reset(base_st: mut BaseState, weather_st: mut WeatherState) -> void {
|
||||
export function weather_reset(weather_st: mut WeatherState) -> void {
|
||||
weather_st.wx_dice = rng_new(WeatherWorld.seed())
|
||||
let clear = wx_clear_kind(weather_st)
|
||||
weather_st.wx_state = clear
|
||||
|
|
@ -17,7 +17,7 @@ export function weather_reset(base_st: mut BaseState, weather_st: mut WeatherSta
|
|||
weather_st.wx_clear_t = 0.0
|
||||
weather_st.wx_wet_today = false
|
||||
weather_st.wx_wet_yesterday = false
|
||||
q_clear(base_st, weather_facts(base_st, weather_st))
|
||||
q_clear(weather_facts(weather_st))
|
||||
}
|
||||
|
||||
# a new day's forecast: seven times in ten it is the next spell. A front already on its way
|
||||
|
|
@ -45,7 +45,7 @@ export function weather_set(weather_st: mut WeatherState, kind: int, next: int,
|
|||
}
|
||||
|
||||
# what the machine that owns the world says the sky is; a new spell is a fact here too
|
||||
export function weather_told(base_st: mut BaseState, weather_st: mut WeatherState, kind: int, next: int, left: float, amount: float, wind: float, dir: float, forecast: int) -> void {
|
||||
export function weather_told(weather_st: mut WeatherState, kind: int, next: int, left: float, amount: float, wind: float, dir: float, forecast: int) -> void {
|
||||
let was = weather_st.wx_state
|
||||
weather_st.wx_state = kind
|
||||
weather_st.wx_next = next
|
||||
|
|
@ -54,7 +54,7 @@ export function weather_told(base_st: mut BaseState, weather_st: mut WeatherStat
|
|||
weather_st.wx_wind = wind
|
||||
weather_st.wx_dir = dir
|
||||
weather_st.wx_forecast = forecast
|
||||
if kind != was { wx_fact(base_st, weather_st, WEATHER_BEGAN, kind, was) }
|
||||
if kind != was { wx_fact(weather_st, WEATHER_BEGAN, kind, was) }
|
||||
}
|
||||
|
||||
export function weather_set_wind(weather_st: mut WeatherState, strength: float, dir: float) -> void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue