use of com.nyrds.pixeldungeon.mechanics.actors.ScriptedActor in project pixel-dungeon-remix by NYRDS.
the class Level method activateScripts.
public void activateScripts() {
for (ScriptedActor scriptedActor : scripts) {
Actor.add(scriptedActor);
scriptedActor.activate();
}
}
use of com.nyrds.pixeldungeon.mechanics.actors.ScriptedActor in project pixel-dungeon-remix by NYRDS.
the class Level method restoreFromBundle.
@Override
public void restoreFromBundle(Bundle bundle) {
scripts = new HashSet<>();
mobs = new HashSet<>();
heaps = new SparseArray<>();
blobs = new HashMap<>();
plants = new SparseArray<>();
// old levels compat
width = bundle.optInt(WIDTH, 32);
height = bundle.optInt(HEIGHT, 32);
initSizeDependentStuff();
map = bundle.getIntArray(MAP);
for (LayerId layerId : LayerId.values()) {
int[] layer = bundle.getIntArray(layerId.name());
if (layer.length == map.length) {
customLayers.put(layerId, layer);
}
}
visited = bundle.getBooleanArray(VISITED);
mapped = bundle.getBooleanArray(MAPPED);
entrance = bundle.getInt(ENTRANCE);
compassTarget = bundle.optInt(COMPASS_TARGET, INVALID_CELL);
int[] exits = bundle.getIntArray(EXIT);
if (exits.length > 0) {
for (int i = 0; i < exits.length; ++i) {
setExit(exits[i], i);
}
} else {
setExit(bundle.getInt(EXIT), 0);
int secondaryExit = bundle.optInt(SECONDARY_EXIT, INVALID_CELL);
if (cellValid(secondaryExit)) {
setExit(secondaryExit, 1);
}
}
weakFloorCreated = false;
for (Heap heap : bundle.getCollection(HEAPS, Heap.class)) {
heaps.put(heap.pos, heap);
}
for (Plant plant : bundle.getCollection(PLANTS, Plant.class)) {
plants.put(plant.pos, plant);
}
for (LevelObject object : bundle.getCollection(OBJECTS, LevelObject.class)) {
putLevelObject(object);
}
for (Mob mob : bundle.getCollection(MOBS, Mob.class)) {
if (mob != null && mob.getPos() != INVALID_CELL) {
mobs.add(mob);
}
}
for (Blob blob : bundle.getCollection(BLOBS, Blob.class)) {
blobs.put(blob.getClass(), blob);
}
for (ScriptedActor actor : bundle.getCollection(SCRIPTS, ScriptedActor.class)) {
addScriptedActor(actor);
}
buildFlagMaps();
cleanWalls();
}
Aggregations