refactor(packages): 0.R5 - a question no longer starts its state - 64 lazy starts ('if st.x == null { st.x = ... }' inside a getter) are the state's defaults, gear__ensure is gone, and ludic migrate state --tighten took mut off 208 package parameters: things_all, thing_find, gear_charge, gear_level, jobs_state and the rest read

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 00:51:03 +03:00
parent 54f5efb23f
commit 9862ec82e3
102 changed files with 320 additions and 351 deletions

View file

@ -1,7 +1,7 @@
# tick.ludic - a step of everyone, on the machine that runs the place: the census on the half hour,
# the day's end (only ever out of every player's sight), the walk or the act, and who noticed whom
export function npc_tick(npc_st: mut NpcState, dt: float) -> void {
np_ensure(npc_st)
np_ensure()
for i in 0 .. len(npc_st.np_posts) { if npc_st.np_posts[i].active { np_step_post(npc_st, npc_st.np_posts[i], dt) } }
if npc_st.np_hold or npc_st.np_mirror { return }
np_census(npc_st)
@ -15,7 +15,7 @@ export function npc_tick(npc_st: mut NpcState, dt: float) -> void {
# the posts alone: a machine that does not run the place still turns its vendors to whoever comes
export function npc_posts_tick(npc_st: mut NpcState, dt: float) -> void {
np_ensure(npc_st)
np_ensure()
for i in 0 .. len(npc_st.np_posts) { if npc_st.np_posts[i].active { np_step_post(npc_st, npc_st.np_posts[i], dt) } }
}
@ -43,7 +43,7 @@ function np_census(npc_st: mut NpcState) -> void {
function np_is_night(h: float) -> bool { return h >= 21.0 or h < 5.0 }
function np_draw_kind(npc_st: mut NpcState, night: bool) -> int {
function np_draw_kind(npc_st: NpcState, night: bool) -> int {
var total = 0
for k in 0 .. NPCK_COUNT { if np_drawn(k, night) { total += NpcKinds[k].weight } }
if total <= 0 { return -1 }
@ -82,7 +82,7 @@ export function npc_hold(npc_st: mut NpcState, on: bool) -> void { npc_st.np_hol
# everyone gone, as a new trip starts; the posts are the place's and stay
export function npc_reset(npc_st: mut NpcState) -> void {
np_ensure(npc_st)
np_ensure()
for i in 0 .. len(npc_st.np_walkers) { npc_retire(npc_st, npc_st.np_walkers[i]) }
npc_st.np_n = 0
npc_st.np_next_h = 0.0