wip(0.S2): migrate - a var nothing writes becomes a let; a state is keyed by its module, directory or program, so every program's plan agrees; paths normalized; program states named SceneDemoState / scene_demo_st; the LSP reads state, mut and entry/handler parameters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 15:31:34 +03:00
parent 3eda72e8c2
commit 5ffe50ed02
463 changed files with 72045 additions and 67421 deletions

View file

@ -45,25 +45,27 @@ function nw_free(n: string) -> bool { return false }
function nw_nothing(p: NpcPerson) -> void { }
function nw_silent(p: NpcPerson, line: int) -> string { return "" }
function nw_hello(p: NpcPerson) -> string { return "" }
function nw_next_id(npc_st: mut NpcState) -> int {
npc_st.nw_ids += 1
return npc_st.nw_ids
var nw_ids: int = 0
function nw_next_id() -> int {
nw_ids += 1
return nw_ids
}
# the nearest player on and their distance (npc_near_i: -1 when nobody is on)
var np_near_i: int = -1
export function npc_near(npc_st: mut NpcState, x: float, z: float) -> float {
export function npc_near(x: float, z: float) -> float {
var bd = 1000000.0
npc_st.np_near_i = -1
np_near_i = -1
for i in 0 .. NpcWorld.players() {
if not NpcWorld.player_on(i) { continue }
let d = npc_d(x, z, NpcWorld.player_x(i), NpcWorld.player_z(i))
if d < bd {
bd = d
npc_st.np_near_i = i
np_near_i = i
}
}
return bd
}
export function npc_near_i(npc_st: NpcState) -> int { return npc_st.np_near_i }
export function npc_near_i() -> int { return np_near_i }