feat(senses): walkers slide round still things, and lines of sight are the world's to answer
- ludic.wildlife: WildlifeWorld.push / pushed_x / pushed_z (defaults change nothing); a ground walker's step is slid clear of a still thing with a body from its species' size and scale, and a step that gets nowhere turns away as the water does. Birds are not pushed; no dice added. - ludic.npc: NpcWorld.push / pushed_x / pushed_z (a person 0.35 m round) in npc_walk, and NpcWorld.clear (default true), which npc_line_ok asks at 1 m so a detour does not cut a trunk. - ludic.aim: AimView.clear replaces AimView.ground and the ground march; the pick asks the line a body's width short of where the ray enters the thing (aim_clear_at(t, back)), so a solid thing does not hide itself. probe.ludic (the ground-agreement probe) and AimView.dry are gone. - ludic.photo: PhotoLens.clear replaces PhotoLens.ground, PhotoLens.trunk and the march. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d2cd775309
commit
56e4b6d688
24 changed files with 230 additions and 152 deletions
|
|
@ -10,6 +10,10 @@ program NpcTest {
|
|||
ground: fn fk_ground
|
||||
water: fn fk_water
|
||||
allowed: fn fk_allowed
|
||||
push: fn fk_push
|
||||
pushed_x: fn fk_pushed_x
|
||||
pushed_z: fn fk_pushed_z
|
||||
clear: fn fk_clear
|
||||
hour: fn fk_hour_now
|
||||
day: fn fk_day_now
|
||||
players: fn fk_players
|
||||
|
|
@ -95,6 +99,21 @@ program NpcTest {
|
|||
expect_near(p.fx, 30.0, 0.01)
|
||||
}
|
||||
|
||||
test "a trunk in the way is walked round, and a line through it is not a clear walk" (npc_st: mut NpcState, npc_tests_fake_st: mut NpcTestsFakeState) {
|
||||
let p = one(npc_st, npc_tests_fake_st, NPCK_HIKER)
|
||||
npc_tests_fake_st.fk_trunk = true
|
||||
expect(not npc_line_ok(0.0, 0.0, 20.0, 0.0))
|
||||
expect(npc_line_ok(0.0, 5.0, 20.0, 5.0))
|
||||
npc_go(npc_st, p, 20.0, 0.0, NPCA_SIT, 30.0)
|
||||
var closest = 100.0
|
||||
for k in 0 .. 600 {
|
||||
npc_tick(npc_st, 0.05)
|
||||
closest = Math.min(closest, npc_d(p.x, p.z, 10.0, 0.3))
|
||||
}
|
||||
expect(closest > 1.3)
|
||||
expect_eq(p.act, NPCA_SIT)
|
||||
}
|
||||
|
||||
test "nobody walks into the lake" (npc_st: mut NpcState, npc_tests_fake_st: mut NpcTestsFakeState) {
|
||||
let p = one(npc_st, npc_tests_fake_st, NPCK_HIKER)
|
||||
npc_go(npc_st, p, -80.0, 0.0, NPCA_SIT, 30.0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue