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

@ -10,23 +10,25 @@ export function char_stand_at(x: float, z: float, from_y: float) -> float {
# A step up and a slope up are different refusals. Within CHAR_STEP of the feet is a step, taken
# whatever the gradient into it (a 45 cm deck arrives in one frame); above that the boots decide,
# measured over CHAR_SLOPE_PROBE, so the frame rate never changes the answer.
export function char_slope_blocks(character_st: CharacterState, nh: float, fx: float, fz: float) -> bool {
if nh - character_st.chr_y > CHAR_STEP { return true }
let sx = character_st.chr_x + fx * CHAR_SLOPE_PROBE
let sz = character_st.chr_z + fz * CHAR_SLOPE_PROBE
return CharacterGround.height(sx, sz) - character_st.chr_y > CHAR_SLOPE_PROBE * CharacterGround.slope_limit()
export function char_slope_blocks(nh: float, fx: float, fz: float) -> bool {
if nh - chr_y > CHAR_STEP { return true }
let sx = chr_x + fx * CHAR_SLOPE_PROBE
let sz = chr_z + fz * CHAR_SLOPE_PROBE
return CharacterGround.height(sx, sz) - chr_y > CHAR_SLOPE_PROBE * CharacterGround.slope_limit()
}
# a body of radius r at (x, z) from y0 to y1, out of every collider: the resolved point is chr_out_*
function chr_push(character_st: mut CharacterState, x: float, z: float, r: float, y0: float, y1: float) -> bool {
character_st.chr_ask_x = x
character_st.chr_ask_z = z
var chr_out_x: float = 0.0
var chr_out_z: float = 0.0
function chr_push(x: float, z: float, r: float, y0: float, y1: float) -> bool {
chr_ask_x = x
chr_ask_z = z
let hit = CharacterGround.push(x, z, r, y0, y1)
character_st.chr_out_x = x
character_st.chr_out_z = z
chr_out_x = x
chr_out_z = z
if hit {
character_st.chr_out_x = CharacterGround.pushed_x()
character_st.chr_out_z = CharacterGround.pushed_z()
chr_out_x = CharacterGround.pushed_x()
chr_out_z = CharacterGround.pushed_z()
}
return hit
}