v0.9.1: added some checks to ensure things can't spawn inside of doors

This commit is contained in:
Evan Debenham 2020-12-02 19:27:59 -05:00
parent bfda32620a
commit 04addf7cbb

View File

@ -216,7 +216,7 @@ public abstract class RegularLevel extends Level {
do {
mob.pos = pointToCell(roomToSpawn.random());
tries--;
} while (tries >= 0 && (findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit
} while (tries >= 0 && (findMob(mob.pos) != null || !passable[mob.pos] || solid[mob.pos] || mob.pos == exit
|| (!openSpace[mob.pos] && mob.properties().contains(Char.Property.LARGE))));
if (tries >= 0) {
@ -231,7 +231,7 @@ public abstract class RegularLevel extends Level {
do {
mob.pos = pointToCell(roomToSpawn.random());
tries--;
} while (tries >= 0 && (findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit
} while (tries >= 0 && (findMob(mob.pos) != null || !passable[mob.pos] || solid[mob.pos] || mob.pos == exit
|| (!openSpace[mob.pos] && mob.properties().contains(Char.Property.LARGE))));
if (tries >= 0) {
@ -272,6 +272,7 @@ public abstract class RegularLevel extends Level {
if (!heroFOV[cell]
&& Actor.findChar( cell ) == null
&& passable[cell]
&& !solid[cell]
&& (!Char.hasProp(ch, Char.Property.LARGE) || openSpace[cell])
&& room.canPlaceCharacter(cellToPoint(cell), this)
&& cell != exit) {
@ -505,7 +506,7 @@ public abstract class RegularLevel extends Level {
Room room = randomRoom( roomType );
if (room != null && room != roomEntrance) {
int pos = pointToCell(room.random());
if (passable[pos]
if (passable[pos] && !solid[pos]
&& pos != exit
&& heaps.get(pos) == null
&& findMob(pos) == null) {