From 2b743b1f1503c98442cd910644c933c3c9a2e7ab Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 19 Jun 2019 22:21:30 -0400 Subject: [PATCH] v0.7.4: improved how position swapping with characters works with doors --- .../shatteredpixeldungeon/levels/features/Door.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Door.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Door.java index 97c525f47..b5400fca6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Door.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Door.java @@ -23,6 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.features; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -41,7 +43,14 @@ public class Door { } public static void leave( int pos ) { - if (Dungeon.level.heaps.get( pos ) == null) { + int chars = 0; + + for (Char ch : Actor.chars()){ + if (ch.pos == pos) chars++; + } + + //door does not shut if anything else is also on it + if (Dungeon.level.heaps.get( pos ) == null && chars <= 1) { Level.set( pos, Terrain.DOOR ); GameScene.updateMap( pos ); if (Dungeon.level.heroFOV[pos])