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