feat(npc, nav): 17.5 - a person walks by the world's way where it has one (NpcWorld.way: the next corner toward the target, asked every half second, on reaching it or for a new target; the errand begins only at the target itself; the step round and the give-up stay the fallback), way_test round a wall; and ludic.nav reads a mesh file into the shim's own memory and frees it once parsed, so loading a map leaves nothing in Ludic's never-freed heap
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4add35b4ca
commit
ee0768bf3e
12 changed files with 184 additions and 39 deletions
|
|
@ -25,6 +25,11 @@ export port NpcWorld {
|
|||
taken: fn(string) -> bool = fn nw_free # a name the place already uses
|
||||
born: fn(NpcPerson) -> void = fn nw_nothing # a new one (or a slot reused): draw it
|
||||
gone: fn(NpcPerson) -> void = fn nw_nothing # left: stop drawing it
|
||||
# (p, x, z): the next corner of this person's way toward (x, z) into way_x / _z; false, the
|
||||
# straight line with its steps round (a navmesh's path by a person's taste, in Maroon Lake)
|
||||
way: fn(NpcPerson, float, float) -> bool = fn nw_no_way
|
||||
way_x: fn() -> float = fn nw_asked_x
|
||||
way_z: fn() -> float = fn nw_asked_z
|
||||
}
|
||||
|
||||
# what the story says through them: the words of a line whose `fill` is set ("" when it has nothing
|
||||
|
|
@ -76,3 +81,4 @@ export function npc_near(npc_st: mut NpcState, x: float, z: float) -> float {
|
|||
}
|
||||
|
||||
export function npc_near_i(npc_st: NpcState) -> int { return npc_st.np_near_i }
|
||||
function nw_no_way(p: NpcPerson, x: float, z: float) -> bool { return false }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue