mirror of
https://github.com/array-in-a-matrix/brainwine.git
synced 2025-04-02 11:11:58 -04:00
Support for spawn buildings in deep biomes
This commit is contained in:
parent
3b88a8012c
commit
70bfa214c7
1 changed files with 4 additions and 1 deletions
|
@ -13,6 +13,7 @@ public class StructureGenerator implements GeneratorTask {
|
||||||
private final WeightedMap<Prefab> spawnTowers;
|
private final WeightedMap<Prefab> spawnTowers;
|
||||||
private final Vector2i dungeonRegion;
|
private final Vector2i dungeonRegion;
|
||||||
private final double dungeonRate;
|
private final double dungeonRate;
|
||||||
|
private final boolean surface;
|
||||||
|
|
||||||
public StructureGenerator(GeneratorConfig config) {
|
public StructureGenerator(GeneratorConfig config) {
|
||||||
uniqueStructures = config.getUniqueStructures();
|
uniqueStructures = config.getUniqueStructures();
|
||||||
|
@ -20,6 +21,7 @@ public class StructureGenerator implements GeneratorTask {
|
||||||
spawnTowers = config.getSpawnTowers();
|
spawnTowers = config.getSpawnTowers();
|
||||||
dungeonRegion = config.getDungeonRegion();
|
dungeonRegion = config.getDungeonRegion();
|
||||||
dungeonRate = config.getDungeonRate();
|
dungeonRate = config.getDungeonRate();
|
||||||
|
surface = config.getSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,7 +61,8 @@ public class StructureGenerator implements GeneratorTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeRandomSpawnTower(GeneratorContext ctx, int x) {
|
private void placeRandomSpawnTower(GeneratorContext ctx, int x) {
|
||||||
int surface = ctx.getZone().getSurface()[x];
|
int surface = this.surface ? ctx.getZone().getSurface()[x]
|
||||||
|
: ctx.getHeight() / 8 + ctx.nextInt(Math.max(1, ctx.nextInt(ctx.getHeight() / 8)));
|
||||||
|
|
||||||
if(!spawnTowers.isEmpty()) {
|
if(!spawnTowers.isEmpty()) {
|
||||||
Prefab spawnTower = spawnTowers.next(ctx.getRandom());
|
Prefab spawnTower = spawnTowers.next(ctx.getRandom());
|
||||||
|
|
Loading…
Add table
Reference in a new issue