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
|
|
@ -1,20 +1,20 @@
|
|||
# run.ludic - `dt` real seconds of a line in the water: the wait, the bite, and the fight
|
||||
function fishing_run_wait(base_st: mut BaseState, fishing_st: mut FishingState) -> void {
|
||||
function fishing_run_wait(fishing_st: mut FishingState) -> void {
|
||||
if fishing_st.fishing_t >= 0.0 { return }
|
||||
fishing_st.fishing_st = FISHING_BITE_ON
|
||||
fishing_st.fishing_t = 1.6
|
||||
fishing_st.fishing_sp = fishing_pick(fishing_st)
|
||||
fishing_say(base_st, fishing_st, FISHING_BITE)
|
||||
fishing_say(fishing_st, FISHING_BITE)
|
||||
}
|
||||
|
||||
# a fish that runs: the marker is all over the bar and nothing done with it helps
|
||||
function fishing_run_runs(base_st: mut BaseState, fishing_st: mut FishingState, dt: float) -> float {
|
||||
function fishing_run_runs(fishing_st: mut FishingState, dt: float) -> float {
|
||||
let k = FishSpecies[fishing_st.fishing_sp]
|
||||
if fishing_st.fishing_run_t > 0.0 {
|
||||
fishing_st.fishing_run_t = fishing_st.fishing_run_t - dt
|
||||
if fishing_st.fishing_run_t <= 0.0 {
|
||||
fishing_st.fishing_run_t = 0.0
|
||||
fishing_say(base_st, fishing_st, FISHING_TIRED)
|
||||
fishing_say(fishing_st, FISHING_TIRED)
|
||||
}
|
||||
return 4.2
|
||||
}
|
||||
|
|
@ -24,17 +24,17 @@ function fishing_run_runs(base_st: mut BaseState, fishing_st: mut FishingState,
|
|||
fishing_st.fishing_run_left -= 1
|
||||
fishing_st.fishing_run_t = 2.2
|
||||
fishing_st.fishing_run_next = 4.0 + fishing_rand(fishing_st) * 4.0
|
||||
fishing_say(base_st, fishing_st, FISHING_RUNS)
|
||||
fishing_say(fishing_st, FISHING_RUNS)
|
||||
}
|
||||
}
|
||||
return k.speed + k.speed_per_hit * float(fishing_st.fishing_won)
|
||||
}
|
||||
|
||||
function fishing_run_reel(base_st: mut BaseState, fishing_st: mut FishingState, dt: float) -> void {
|
||||
let sp = fishing_run_runs(base_st, fishing_st, dt)
|
||||
function fishing_run_reel(fishing_st: mut FishingState, dt: float) -> void {
|
||||
let sp = fishing_run_runs(fishing_st, dt)
|
||||
if fishing_st.fishing_gentle_on {
|
||||
fishing_st.fishing_ring_t = fishing_st.fishing_ring_t - dt
|
||||
if fishing_st.fishing_ring_t <= 0.0 { fishing_lost(base_st, fishing_st, FISHING_LINE_SNAPPED) }
|
||||
if fishing_st.fishing_ring_t <= 0.0 { fishing_lost(fishing_st, FISHING_LINE_SNAPPED) }
|
||||
return
|
||||
}
|
||||
fishing_st.fishing_mark = fishing_st.fishing_mark + sp * fishing_st.fishing_dir * dt
|
||||
|
|
@ -46,19 +46,19 @@ function fishing_run_reel(base_st: mut BaseState, fishing_st: mut FishingState,
|
|||
fishing_st.fishing_mark = 0.0
|
||||
fishing_st.fishing_dir = 1.0
|
||||
}
|
||||
if fishing_st.fishing_t < 0.0 { fishing_lost(base_st, fishing_st, FISHING_SLACK) }
|
||||
if fishing_st.fishing_t < 0.0 { fishing_lost(fishing_st, FISHING_SLACK) }
|
||||
}
|
||||
|
||||
export function fishing_run(base_st: mut BaseState, fishing_st: mut FishingState, dt: float) -> void {
|
||||
export function fishing_run(fishing_st: mut FishingState, dt: float) -> void {
|
||||
if fishing_st.fishing_st == FISHING_OFF { return }
|
||||
fishing_st.fishing_t = fishing_st.fishing_t - dt
|
||||
if fishing_st.fishing_st == FISHING_WAIT {
|
||||
fishing_run_wait(base_st, fishing_st)
|
||||
fishing_run_wait(fishing_st)
|
||||
return
|
||||
}
|
||||
if fishing_st.fishing_st == FISHING_BITE_ON {
|
||||
if fishing_st.fishing_t < 0.0 { fishing_lost(base_st, fishing_st, FISHING_MISSED) }
|
||||
if fishing_st.fishing_t < 0.0 { fishing_lost(fishing_st, FISHING_MISSED) }
|
||||
return
|
||||
}
|
||||
fishing_run_reel(base_st, fishing_st, dt)
|
||||
fishing_run_reel(fishing_st, dt)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue