Better naval check

This commit is contained in:
Anuken
2020-03-22 11:30:15 -04:00
parent ea3e16ee16
commit 53a6297b59
4 changed files with 10 additions and 4 deletions
Binary file not shown.
+1 -1
View File
@@ -36,7 +36,7 @@ public class Planets implements ContentList{
}}; }};
starter = new Planet("TODO", sun, 3, 1){{ starter = new Planet("TODO", sun, 3, 1){{
generator = new TestPlanetGenerator(); generator = new TODOPlanetGenerator();
meshLoader = () -> new HexMesh(this, 6); meshLoader = () -> new HexMesh(this, 6);
}}; }};
} }
@@ -12,7 +12,7 @@ import mindustry.world.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class TestPlanetGenerator extends PlanetGenerator{ public class TODOPlanetGenerator extends PlanetGenerator{
Simplex noise = new Simplex(); Simplex noise = new Simplex();
RidgedPerlin rid = new RidgedPerlin(1, 2); RidgedPerlin rid = new RidgedPerlin(1, 2);
float scl = 5f; float scl = 5f;
@@ -51,6 +51,7 @@ public class SectorDataGenerator{
ObjectIntMap<Block> floors = new ObjectIntMap<>(); ObjectIntMap<Block> floors = new ObjectIntMap<>();
ObjectSet<Content> content = new ObjectSet<>(); ObjectSet<Content> content = new ObjectSet<>();
logic.reset();
world.loadSector(sector); world.loadSector(sector);
float waterFloors = 0, totalFloors = 0; float waterFloors = 0, totalFloors = 0;
state.rules.sector = sector; state.rules.sector = sector;
@@ -68,7 +69,7 @@ public class SectorDataGenerator{
if(!tile.block().isStatic()){ if(!tile.block().isStatic()){
totalFloors ++; totalFloors ++;
if(liquid == Liquids.water){ if(liquid == Liquids.water){
waterFloors += tile.floor().isDeep() ? 1f : 0.5f; waterFloors += tile.floor().isDeep() ? 1f : 0.7f;
} }
floors.increment(tile.floor()); floors.increment(tile.floor());
if(tile.overlay() != Blocks.air){ if(tile.overlay() != Blocks.air){
@@ -93,8 +94,13 @@ public class SectorDataGenerator{
} }
} }
if(waterFloors / totalFloors >= 0.6f){
Log.info("Sector {0} has {1}/{2} water -> naval", sector.id, waterFloors, totalFloors);
}
//naval sector guaranteed //naval sector guaranteed
if(nearTiles >= 4){ if(nearTiles > 4){
Log.info("Sector {0} has {1} water tiles at {2} {3} -> naval", sector.id, nearTiles, cx, cy);
waterFloors = totalFloors; waterFloors = totalFloors;
} }