use of com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Dungeon method switchLevel.
@SuppressWarnings("deprecation")
public static void switchLevel(final Level level, int pos) {
if (pos < 0 || pos >= level.length()) {
pos = level.exit;
}
PathFinder.setMapSize(level.width(), level.height());
Dungeon.level = level;
DriedRose.restoreGhostHero(level, pos);
Actor.init();
Actor respawner = level.respawner();
if (respawner != null) {
Actor.add(level.respawner());
}
hero.pos = pos;
Light light = hero.buff(Light.class);
hero.viewDistance = light == null ? level.viewDistance : Math.max(Light.DISTANCE, level.viewDistance);
hero.curAction = hero.lastAction = null;
observe();
try {
saveAll();
} catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
/*This only catches IO errors. Yes, this means things can go wrong, and they can go wrong catastrophically.
But when they do the user will get a nice 'report this issue' dialogue, and I can fix the bug.*/
}
}
Aggregations