mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-19 18:46:43 +00:00
Added objective vault world & its exit portal
This commit is contained in:
parent
f35e6c5a9a
commit
0a75cb557d
@ -118,29 +118,45 @@ public class VaultDimension {
|
|||||||
vWorld.incUpdatable();
|
vWorld.incUpdatable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == layerCount - 1) {
|
if (key == layerCount) {
|
||||||
lastLayerWorlds.add(vWorld);
|
lastLayerWorlds.add(vWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == 0) {
|
if (key == 0) {
|
||||||
this.homeWorld = vWorld;
|
this.homeWorld = vWorld;
|
||||||
//TODO: generate exit door here and save the coords
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//4. Choose a random world from the last layer and create the vault box there (objective)
|
|
||||||
World objectiveWorld = lastLayerWorlds.get(random.nextInt(lastLayerWorlds.size()));
|
|
||||||
|
|
||||||
|
|
||||||
//5. Create an exit portal in the home World
|
|
||||||
Point homePortalPt = homeWorld.getRandomTileWithAdjacent(8, TileMap.VAULT_FLOOR);
|
|
||||||
if (homePortalPt != null) {
|
|
||||||
|
|
||||||
Point exitCoords = vaultDoor.getAdjacentTile();
|
Point exitCoords = vaultDoor.getAdjacentTile();
|
||||||
Location exitLocation = new Location(vaultDoor.getWorld().getX(), vaultDoor.getWorld().getY(), vaultDoor
|
Location exitLocation = new Location(vaultDoor.getWorld().getX(), vaultDoor.getWorld().getY(), vaultDoor
|
||||||
.getWorld().getDimension(), exitCoords.x, exitCoords.y);
|
.getWorld().getDimension(), exitCoords.x, exitCoords.y);
|
||||||
|
|
||||||
|
|
||||||
|
//4. Choose a random world from the last layer and create the vault box there (objective)
|
||||||
|
World objectiveWorld = lastLayerWorlds.get(random.nextInt(lastLayerWorlds.size()));
|
||||||
|
|
||||||
|
Point exitPortalPt = objectiveWorld.getRandomTileWithAdjacent(8, TileMap.VAULT_FLOOR);
|
||||||
|
|
||||||
|
if (exitPortalPt != null) {
|
||||||
|
|
||||||
|
Portal exitPortal = new Portal();
|
||||||
|
exitPortal.setDst(exitLocation);
|
||||||
|
exitPortal.setX(exitPortalPt.x);
|
||||||
|
exitPortal.setY(exitPortalPt.y);
|
||||||
|
exitPortal.setWorld(objectiveWorld);
|
||||||
|
objectiveWorld.addObject(exitPortal);
|
||||||
|
|
||||||
|
LogManager.LOGGER.severe("Objective: " + objectiveWorld.getId());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
LogManager.LOGGER.severe("FIXME: Couldn't create exit portal for world " + homeWorld.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
//5. Create an exit portal in the home World
|
||||||
|
Point homePortalPt = homeWorld.getRandomTileWithAdjacent(8, TileMap.VAULT_FLOOR);
|
||||||
|
if (homePortalPt != null) {
|
||||||
|
|
||||||
Portal homePortal = new Portal();
|
Portal homePortal = new Portal();
|
||||||
homePortal.setDst(exitLocation);
|
homePortal.setDst(exitLocation);
|
||||||
homePortal.setX(homePortalPt.x);
|
homePortal.setX(homePortalPt.x);
|
||||||
@ -156,7 +172,7 @@ public class VaultDimension {
|
|||||||
LogManager.LOGGER.severe("FIXME: Couldn't create home exit portal for world " + homeWorld.getId());
|
LogManager.LOGGER.severe("FIXME: Couldn't create home exit portal for world " + homeWorld.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
LogManager.LOGGER.severe("DONE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean worldExists(Point coords, HashMap<Integer, ArrayList<WorldBluePrint>> worldLayers) {
|
private boolean worldExists(Point coords, HashMap<Integer, ArrayList<WorldBluePrint>> worldLayers) {
|
||||||
|
@ -159,8 +159,6 @@ public class VaultWorldGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogManager.LOGGER.severe(world.toString());
|
|
||||||
|
|
||||||
//Connect rooms together, from bottom to top
|
//Connect rooms together, from bottom to top
|
||||||
roomCenters.sort(new RoomCenterComparator());
|
roomCenters.sort(new RoomCenterComparator());
|
||||||
boolean xFirst = true; //Start the tunnel horizontally
|
boolean xFirst = true; //Start the tunnel horizontally
|
||||||
|
Loading…
x
Reference in New Issue
Block a user