merge lang/foundations into lang/native-jolt (seeds regenerated)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
b247603b7e
62 changed files with 41302 additions and 40864 deletions
|
|
@ -41,37 +41,30 @@ function np_fact(npc_st: NpcState, what: int, p: NpcPerson, player: int) -> NpcF
|
|||
return f
|
||||
}
|
||||
|
||||
function np_ensure() -> void {
|
||||
}
|
||||
|
||||
# how many walkers the place can hold at once
|
||||
export function npc_config(npc_st: mut NpcState, max: int) -> void { npc_st.np_max = max }
|
||||
|
||||
export function npc_seed(npc_st: NpcState, n: int) -> void {
|
||||
np_ensure()
|
||||
rng_seed(npc_st.np_dice, n)
|
||||
}
|
||||
|
||||
# 0 .. 1, and whole seconds lo .. hi, off the package's dice
|
||||
export function npc_rnd(npc_st: NpcState) -> float {
|
||||
np_ensure()
|
||||
return rng_float(npc_st.np_dice)
|
||||
}
|
||||
|
||||
export function npc_between(npc_st: NpcState, lo: int, hi: int) -> int {
|
||||
np_ensure()
|
||||
return rng_between(npc_st.np_dice, lo, hi)
|
||||
}
|
||||
|
||||
export function npc_secs(npc_st: NpcState, lo: int, hi: int) -> float { return float(npc_between(npc_st, lo, np_hi(lo, hi))) }
|
||||
|
||||
export function npc_walkers(npc_st: NpcState) -> []NpcPerson {
|
||||
np_ensure()
|
||||
return npc_st.np_walkers
|
||||
}
|
||||
|
||||
export function npc_posts(npc_st: NpcState) -> []NpcPerson {
|
||||
np_ensure()
|
||||
return npc_st.np_posts
|
||||
}
|
||||
|
||||
|
|
@ -81,19 +74,16 @@ export function npc_max(npc_st: NpcState) -> int { return npc_st.np_max }
|
|||
|
||||
# a walker's slot or a post, and anyone by id
|
||||
export function npc_at(npc_st: NpcState, slot: int) -> NpcPerson {
|
||||
np_ensure()
|
||||
if slot < 0 or slot >= len(npc_st.np_walkers) { return null }
|
||||
return npc_st.np_walkers[slot]
|
||||
}
|
||||
|
||||
export function npc_post(npc_st: NpcState, i: int) -> NpcPerson {
|
||||
np_ensure()
|
||||
if i < 0 or i >= len(npc_st.np_posts) { return null }
|
||||
return npc_st.np_posts[i]
|
||||
}
|
||||
|
||||
export function npc_by_id(npc_st: NpcState, id: int) -> NpcPerson {
|
||||
np_ensure()
|
||||
for i in 0 .. len(npc_st.np_walkers) { if npc_st.np_walkers[i].active and npc_st.np_walkers[i].id == id { return npc_st.np_walkers[i] } }
|
||||
for i in 0 .. len(npc_st.np_posts) { if npc_st.np_posts[i].active and npc_st.np_posts[i].id == id { return npc_st.np_posts[i] } }
|
||||
return null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue