v0.7.4: improved how position swapping with characters works with doors
This commit is contained in:
parent
0f3a6c8fa2
commit
2b743b1f15
|
@ -23,6 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.features;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
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.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
|
@ -41,7 +43,14 @@ public class Door {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void leave( int pos ) {
|
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 );
|
Level.set( pos, Terrain.DOOR );
|
||||||
GameScene.updateMap( pos );
|
GameScene.updateMap( pos );
|
||||||
if (Dungeon.level.heroFOV[pos])
|
if (Dungeon.level.heroFOV[pos])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user