ludic.wildlife (18.3): wildlife_listed - still one of this state's animals, so a crowd lets go of one a load or a clear removed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9ec1b3a9bf
commit
95f2087148
4 changed files with 10 additions and 3 deletions
BIN
packages/ludic.nav/lib/macos-arm64/libludicnav.dylib
(Stored with Git LFS)
BIN
packages/ludic.nav/lib/macos-arm64/libludicnav.dylib
(Stored with Git LFS)
Binary file not shown.
|
|
@ -58,11 +58,12 @@ NAV_SHIM int nav_crowd_target(void *p, int i, float x, float y, float z) {
|
|||
if (!ref) return 0;
|
||||
return c->crowd->requestMoveTarget(i, ref, near) ? 1 : 0;
|
||||
}
|
||||
// a new top speed, as a walker goes from a walk to a run
|
||||
// a new top speed, as a walker goes from a walk to a run; 0 stands it still (a new target moves it again)
|
||||
NAV_SHIM void nav_crowd_speed(void *p, int i, float speed) {
|
||||
Crowd *c = static_cast<Crowd *>(p);
|
||||
const dtCrowdAgent *a = c->crowd->getAgent(i);
|
||||
if (!a || !a->active) return;
|
||||
if (speed < 0.01f) { c->crowd->resetMoveTarget(i); return; } // standing: no target, not no acceleration
|
||||
dtCrowdAgentParams ap = a->params;
|
||||
ap.maxSpeed = speed;
|
||||
ap.maxAcceleration = speed * 4.0f;
|
||||
|
|
|
|||
|
|
@ -79,5 +79,8 @@ program WildCrowdTest {
|
|||
let out = new []WildAnimal
|
||||
expect_eq(wildlife_near(wildlife_st, 0.0, -4.0, 1.0, out), 1)
|
||||
expect_eq(wildlife_near(wildlife_st, 0.0, 0.0, 1.0, out), 0)
|
||||
expect(wildlife_listed(wildlife_st, a))
|
||||
wildlife_clear(wildlife_st)
|
||||
expect(not wildlife_listed(wildlife_st, a))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,3 +43,6 @@ export function wildlife_moved(wildlife_st: mut WildlifeState, a: WildAnimal, x:
|
|||
if r >= 0 { tb_set_xz(a.tab, WA_X, WA_Z, r, x, z) }
|
||||
wl_walked(wildlife_st, a, wl_sp(wildlife_st, a.sp), d)
|
||||
}
|
||||
|
||||
# still one of this state's animals: false once cleared, reloaded or removed (a crowd lets it go)
|
||||
export function wildlife_listed(wildlife_st: WildlifeState, a: WildAnimal) -> bool { return a != null and a.tab == wildlife_st.wl.tab and wl_row(a) >= 0 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue