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 makemon.c $NHDT-Date: 1646694721 2022/03/07 23:12:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.199 $ */
/* NetHack 3.7 makemon.c $NHDT-Date: 1651886995 2022/05/07 01:29:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.204 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1456,6 +1456,10 @@ makemon(
: "",
exclaim ? '!' : '.');
}
/* if discernable and a threat, stop fiddling while Rome burns */
if (g.occupation)
(void) dochugw(mtmp, TRUE);
/* TODO: unify with teleport appears msg */
}