ludic.npc (17.7): a person's fallback is a fact
A step round what is in the way, a target planned again after twenty seconds without progress, and a target given up are each pushed as NPC_F_STUCK (how, x, z), so the game can see where the way failed a person. The lake test expects one when a walker turns back from the water; the way test expects none when the world gives the way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
61f802e9ad
commit
ab84a5f936
6 changed files with 30 additions and 4 deletions
|
|
@ -114,7 +114,7 @@ program NpcTest {
|
|||
expect_eq(p.act, NPCA_SIT)
|
||||
}
|
||||
|
||||
test "nobody walks into the lake" (npc_st: mut NpcState, npc_tests_fake_st: mut NpcTestsFakeState) {
|
||||
test "nobody walks into the lake, and turning back from it is told as a fallback" (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)
|
||||
var west = 0.0
|
||||
|
|
@ -123,6 +123,12 @@ program NpcTest {
|
|||
west = Math.min(west, p.x)
|
||||
}
|
||||
expect(west > -50.5)
|
||||
var fell = 0
|
||||
let fs = q_drain(npc_facts(npc_st))
|
||||
for i in 0 .. len(fs) {
|
||||
if fs[i].what == NPC_F_STUCK and fs[i].x > -52.0 { fell += 1 }
|
||||
}
|
||||
expect(fell >= 1)
|
||||
}
|
||||
|
||||
test "a step's spot is where its hours say: the shore by day, home by night" (npc_st: mut NpcState, npc_tests_fake_st: mut NpcTestsFakeState) {
|
||||
|
|
|
|||
|
|
@ -78,5 +78,7 @@ program NpcWayTest {
|
|||
expect_eq(p.act, NPCA_SIT)
|
||||
expect(npc_d(p.x, p.z, 38.0, -25.0) < 1.3)
|
||||
expect(way_test_st.asked > 5)
|
||||
let fs = q_drain(npc_facts(npc_st))
|
||||
for i in 0 .. len(fs) { expect(fs[i].what != NPC_F_STUCK) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue