ludic.wildlife, ludic.npc (18.3): a crowd walker carries its walker's id (set_crowd(a, id), -1 off)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
24c16ebee4
commit
9ec1b3a9bf
6 changed files with 13 additions and 5 deletions
|
|
@ -53,6 +53,7 @@ export property NpcPerson {
|
|||
wtz: float = 0.0
|
||||
way_t: float = 0.0 # seconds until it asks the way again
|
||||
crowd: bool = false # walked by the world's crowd (phase 18): it decides, the crowd moves it
|
||||
crowd_id: int = -1 # its walker in that crowd, the world's number for it
|
||||
goal_x: float = 0.0 # where it walks this tick and how fast (0 standing): what a crowd is handed
|
||||
goal_z: float = 0.0
|
||||
goal_speed: float = 0.0
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ program NpcWayTest {
|
|||
npc_tests_fake_st.fk_want = 1
|
||||
let p = npc_spawn(npc_st, NPCK_HIKER)
|
||||
npc_set_at(p, 0.0, 0.0)
|
||||
npc_set_crowd(p, true)
|
||||
npc_set_crowd(p, 0)
|
||||
npc_go(npc_st, p, 38.0, -25.0, NPCA_SIT, 30.0)
|
||||
for k in 0 .. 60 { npc_tick(npc_st, 0.05) }
|
||||
expect_eq(p.x, 0.0)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,10 @@ function np_crowd_want(p: NpcPerson, speed: float) -> void {
|
|||
p.goal_z = p.tz
|
||||
p.goal_speed = speed
|
||||
}
|
||||
export function npc_set_crowd(p: NpcPerson, on: bool) -> void { p.crowd = on }
|
||||
export function npc_set_crowd(p: NpcPerson, id: int) -> void {
|
||||
p.crowd_id = id
|
||||
p.crowd = id >= 0
|
||||
}
|
||||
export function npc_moved(p: NpcPerson, x: float, z: float, vx: float, vz: float) -> void {
|
||||
let dx = x - p.x
|
||||
let dz = z - p.z
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ export property WildAnimal {
|
|||
wz: float = 0.0
|
||||
way_t: float = 0.0 # seconds until it asks the way again; 0 asks at once
|
||||
crowd: bool = false # walked by the world's crowd (phase 18): it decides, the crowd moves it
|
||||
crowd_id: int = -1 # its walker in that crowd, the world's number for it
|
||||
goal_x: float = 0.0 # where it walks this tick and how fast: what a crowd is handed
|
||||
goal_z: float = 0.0
|
||||
goal_speed: float = 0.0
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ program WildCrowdTest {
|
|||
wildlife_tests_fake_st.fk_px[0] = 400.0
|
||||
wildlife_tests_fake_st.fk_pz[0] = 0.0
|
||||
wildlife_tests_fake_st.fk_hidden = true
|
||||
wildlife_set_crowd(a, true)
|
||||
wildlife_set_crowd(a, 0)
|
||||
return a
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,11 @@ function wl_crowd_step(a: WildAnimal) -> bool {
|
|||
return true
|
||||
}
|
||||
|
||||
# walked by a crowd, or by its own step again (off, it keeps where the crowd left it)
|
||||
export function wildlife_set_crowd(a: WildAnimal, on: bool) -> void { a.crowd = on }
|
||||
# walked by a crowd as its walker `id`, or by its own step again with -1 (it keeps where it was left)
|
||||
export function wildlife_set_crowd(a: WildAnimal, id: int) -> void {
|
||||
a.crowd_id = id
|
||||
a.crowd = id >= 0
|
||||
}
|
||||
|
||||
# where the crowd put a walker, and how fast it went: its place, its heading from its velocity, its
|
||||
# ground from the world's, and its prints as it goes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue