part of pull request #737 - pets approach \

hero when hero is [impatiently waiting...] on stairs

My attempts to cherry-pick this failed, so this was done manually.
It is a reimplementation of
NullCGT:feature/monster-item-use:dc2cef0562542fece1732dd2d4c4f0775308faff

] Pets approach the player if they are standing on the stairs.
]
] One of the most frequent complaints I have seen is that pets refuse
] to follow their owners down the stairs. While this can be resolved by
] waiting, most players, especially new ones, are not willing to spend
] multiple dozens of turns waiting for their pets to approach closely
] enough to follow them. This simple commit makes pets react to a player
] standing on stairs as if the player is holding a tripe ration. Simple,
] non-disruptive, and should solve many headaches.
This commit is contained in:
PatR
2022-04-19 18:21:26 -07:00
parent 49b046f2e5
commit d6ab241b8c
2 changed files with 16 additions and 8 deletions

View File

@@ -593,13 +593,19 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
|| (dog_has_minvent && rn2(edog->apport)))
appr = 1;
}
/* if you have dog food it'll follow you more closely */
if (appr == 0)
for (obj = g.invent; obj; obj = obj->nobj)
if (dogfood(mtmp, obj) == DOGFOOD) {
appr = 1;
break;
}
/* if you have dog food it'll follow you more closely; if you are
on stairs (or ladder), it will behave as if you have dog food */
if (appr == 0) {
if (On_stairs(u.ux, u.uy)) {
appr = 1;
} else {
for (obj = g.invent; obj; obj = obj->nobj)
if (dogfood(mtmp, obj) == DOGFOOD) {
appr = 1;
break;
}
}
}
} else
appr = 1; /* gtyp != UNDEF */
if (mtmp->mconf)