-
Notifications
You must be signed in to change notification settings - Fork 139
Description
The reported issue is the player being pushed into a machine room due to many jellies coming down the stairs. Since the machine room is locked, this ended the run.
ANALYSIS
When monsters enter a level, the function monsterEntersLevel() is called:
Line 1871 in 2e0ea9a
| static void monsterEntersLevel(creature *monst, short n) { |
If another creature is already there, they are pushed into a nearby space:
Lines 1899 to 1904 in 2e0ea9a
| // Monsters using the stairs will displace any creatures already located there, to thwart stair-dancing. | |
| creature *prevMonst = monsterAtLoc(monst->loc); | |
| brogueAssert(prevMonst); | |
| prevMonst->loc = getQualifyingPathLocNear(monst->loc, true, | |
| T_DIVIDES_LEVEL & avoidedFlagsForMonster(&(prevMonst->info)), 0, | |
| avoidedFlagsForMonster(&(prevMonst->info)), (HAS_MONSTER | HAS_PLAYER | HAS_STAIRS), false); |
The call to getQualifyingPathLocNear() selects a spot based on the provided flags. The forbiddenMapFlags parameter says not to choose a spot with a monster, player, or stairs.
Unfortunately, it does allow spaces that are in machines.
RECOMMENDED FIX
Adjust the forbiddenMapFlags to exclude machine rooms:
(IS_IN_MACHINE | HAS_MONSTER | HAS_PLAYER | HAS_STAIRS)