busy hero ignoring monster threat

Fix the problem reported by entrez of a zombie corpse reviving and
crawling out of the ground while the hero was busy doing something
(searching, digging, &c) and having the hero fail to react and just
keep doing whatever the thing was because the zombie was already
inside the range where a monster changes from no-threat to threat.

Done in the monster creation routine so any new monster (including
one revived from a corpse) that is visible,&c will cause the hero's
action to be interrupted.  Teleport arrival probably needs this too.

Only interrupts an occupation, not other voluntary multi-turn
actitivy such as running or traveling.  That would be trivial to
change ['if (g.occupation...' to 'if ((g.occupation || multi > 0)...']
but I'm not sure whether it ought to be extended to that.
This commit is contained in:
PatR
2022-05-06 18:30:06 -07:00
parent 02207b967a
commit f2f2644e30
5 changed files with 29 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 extern.h $NHDT-Date: 1650875486 2022/04/25 08:31:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1109 $ */
/* NetHack 3.7 extern.h $NHDT-Date: 1651886993 2022/05/07 01:29:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1112 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1622,7 +1622,7 @@ extern boolean itsstuck(struct monst *);
extern boolean mb_trapped(struct monst *, boolean);
extern boolean monhaskey(struct monst *, boolean);
extern void mon_regen(struct monst *, boolean);
extern int dochugw(struct monst *);
extern int dochugw(struct monst *, boolean);
extern boolean onscary(int, int, struct monst *);
extern struct monst *find_pmmonst(int);
extern int bee_eat_jelly(struct monst *, struct obj *);