ludic.wildlife (17.6): a fleeing or wary animal goes by the world's way

It sets a target straight away from the threat (40 m when it flees, 20 m when it is wary) and heads for it with wl_head, so the way port takes it round water and cliffs. Where the world gives no way, it still runs straight away as before. way_test now has a flee round the wall's end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 22:31:07 +03:00
parent f1153f59a2
commit 61f802e9ad
3 changed files with 40 additions and 2 deletions

View file

@ -9,14 +9,16 @@ function wl_react(wildlife_st: mut WildlifeState, a: WildAnimal, np: int, dt: fl
return true
}
if a.state == WILD_WARY {
wl_face(a, a.x + (a.x - a.sus_x), a.z + (a.z - a.sus_z), 2.6, dt)
wl_away(a, a.sus_x, a.sus_z, 20.0)
wl_head(a, a.tx, a.tz, 2.6, dt)
a.speed = s.walk * 0.8
wl_step(wildlife_st, a, dt)
if a.timer < 0.0 { wl_wander(wildlife_st, a, 3.0 + wl_rnd(wildlife_st) * 4.0) }
return true
}
if a.state == WILD_FLEE {
wl_face(a, a.x + (a.x - WildlifeWorld.player_x(np)), a.z + (a.z - WildlifeWorld.player_z(np)), 5.0, dt)
wl_away(a, WildlifeWorld.player_x(np), WildlifeWorld.player_z(np), 40.0)
wl_head(a, a.tx, a.tz, 5.0, dt)
a.speed = s.run
wl_step(wildlife_st, a, dt)
if a.timer < 0.0 {