New generation
This commit is contained in:
@@ -34,6 +34,8 @@ public class Blocks implements ContentList{
|
||||
holostone, rocks, sporerocks, icerocks, cliffs, sporePine, pine, whiteTree, whiteTreeDead, sporeCluster,
|
||||
iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, grass, salt,
|
||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock,
|
||||
creeptree,
|
||||
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
||||
|
||||
//ores
|
||||
oreCopper, oreLead, oreScrap, oreCoal, oreTitanium, oreThorium,
|
||||
@@ -312,6 +314,10 @@ public class Blocks implements ContentList{
|
||||
whiteTree = new TreeBlock("white-tree"){{
|
||||
}};
|
||||
|
||||
creeptree = new TreeBlock("creeptree"){{
|
||||
}};
|
||||
|
||||
|
||||
sporeCluster = new Rock("spore-cluster"){{
|
||||
variants = 3;
|
||||
}};
|
||||
@@ -360,6 +366,16 @@ public class Blocks implements ContentList{
|
||||
variants = 0;
|
||||
}};
|
||||
|
||||
darkPanel1 = new Floor("dark-panel-1"){{ variants = 0; }};
|
||||
darkPanel2 = new Floor("dark-panel-2"){{ variants = 0; }};
|
||||
darkPanel3 = new Floor("dark-panel-3"){{ variants = 0; }};
|
||||
darkPanel4 = new Floor("dark-panel-4"){{ variants = 0; }};
|
||||
darkPanel5 = new Floor("dark-panel-5"){{ variants = 0; }};
|
||||
darkPanel6 = new Floor("dark-panel-6"){{ variants = 0; }};
|
||||
|
||||
darkMetal = new StaticWall("dark-metal"){{
|
||||
}};
|
||||
|
||||
//endregion
|
||||
//region ore
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.anuke.arc.graphics.Color;
|
||||
|
||||
public enum Team{
|
||||
none(Color.valueOf("4d4e58")),
|
||||
blue(Color.ROYAL),
|
||||
blue(Color.valueOf("4169e1")),
|
||||
red(Color.valueOf("e84737")),
|
||||
green(Color.valueOf("1dc645")),
|
||||
purple(Color.valueOf("ba5bd9")),
|
||||
|
||||
@@ -143,7 +143,7 @@ public class Shaders{
|
||||
|
||||
public static class LoadShader extends Shader{
|
||||
public LoadShader(String frag, String vert){
|
||||
super(Core.files.internal("shaders/" + vert + ".vertex"), Core.files.internal("shaders/" + frag + ".fragment"));
|
||||
super(Core.files.internal("shaders/" + vert + ".vertex.glsl"), Core.files.internal("shaders/" + frag + ".fragment.glsl"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ public abstract class BasicGenerator extends RandomGenerator{
|
||||
}
|
||||
|
||||
public void noise(Tile[][] tiles, Block floor, Block block, int octaves, float falloff, float scl, float threshold){
|
||||
sim.setSeed(Mathf.random(99999));
|
||||
pass(tiles, (x, y) -> {
|
||||
if(sim.octaveNoise2D(octaves, falloff, 1f / scl, x, y) > threshold){
|
||||
Tile tile = tiles[x][y];
|
||||
@@ -78,6 +79,27 @@ public abstract class BasicGenerator extends RandomGenerator{
|
||||
});
|
||||
}
|
||||
|
||||
public void tech(Tile[][] tiles){
|
||||
Block[] blocks = {Blocks.darkPanel3};
|
||||
int secSize = 20;
|
||||
pass(tiles, (x, y) -> {
|
||||
int mx = x % secSize, my = y % secSize;
|
||||
int sclx = x / secSize, scly = y / secSize;
|
||||
if(noise(sclx, scly, 10f, 1f) > 0.63f && (mx == 0 || my == 0 || mx == secSize - 1 || my == secSize - 1)){
|
||||
if(Mathf.chance(noise(x + 0x231523, y, 40f, 1f))){
|
||||
floor = Structs.random(blocks);
|
||||
if(Mathf.dst(mx, my, secSize/2, secSize/2) > secSize/2f + 2){
|
||||
floor = Blocks.darkPanel5;
|
||||
}
|
||||
}
|
||||
|
||||
if(block.solid && Mathf.chance(0.7)){
|
||||
block = Blocks.darkMetal;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void distort(Tile[][] tiles, float scl, float mag){
|
||||
Block[][] blocks = new Block[width][height];
|
||||
Floor[][] floors = new Floor[width][height];
|
||||
@@ -95,6 +117,17 @@ public abstract class BasicGenerator extends RandomGenerator{
|
||||
});
|
||||
}
|
||||
|
||||
public void scatter(Tile[][] tiles, Block target, Block dst, float chance){
|
||||
pass(tiles, (x, y) -> {
|
||||
if(!Mathf.chance(chance)) return;
|
||||
if(floor == target){
|
||||
floor = dst;
|
||||
}else if(block == target){
|
||||
block = dst;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void each(IntPositionConsumer r){
|
||||
for(int x = 0; x < width; x++){
|
||||
for(int y = 0; y < height; y++){
|
||||
|
||||
@@ -34,8 +34,12 @@ public class DesertWastesGenerator extends BasicGenerator{
|
||||
distort(tiles, 20f, 4f);
|
||||
inverseFloodFill(tiles, tiles[spawnX][spawnY], Blocks.sandRocks);
|
||||
|
||||
noise(tiles, Blocks.salt, Blocks.sandRocks, 5, 0.6f, 200f, 0.55f);
|
||||
noise(tiles, Blocks.darksand, Blocks.duneRocks, 5, 0.7f, 120f, 0.5f);
|
||||
|
||||
tech(tiles);
|
||||
//scatter(tiles, Blocks.sandRocks, Blocks.creeptree, 1f);
|
||||
|
||||
tiles[endX][endY].setBlock(Blocks.spawn);
|
||||
loadout.setup(spawnX, spawnY);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class OvergrowthGenerator extends BasicGenerator{
|
||||
inverseFloodFill(tiles, tiles[spawnX][spawnY], Blocks.sporerocks);
|
||||
|
||||
noise(tiles, Blocks.darksandTaintedWater, Blocks.duneRocks, 4, 0.7f, 120f, 0.64f);
|
||||
//scatter(tiles, Blocks.sporePine, Blocks.whiteTreeDead, 1f);
|
||||
|
||||
tiles[endX][endY].setBlock(Blocks.spawn);
|
||||
loadout.setup(spawnX, spawnY);
|
||||
|
||||
@@ -18,6 +18,7 @@ public class StaticWall extends Rock{
|
||||
super(name);
|
||||
breakable = alwaysReplace = false;
|
||||
solid = true;
|
||||
variants = 2;
|
||||
cacheLayer = CacheLayer.walls;
|
||||
}
|
||||
|
||||
@@ -43,15 +44,6 @@ public class StaticWall extends Rock{
|
||||
large = Core.atlas.find(name + "-large");
|
||||
}
|
||||
|
||||
//two functions for calculating 2x2 tile brightness
|
||||
int min(int rx, int ry){
|
||||
return Math.min(world.tile(rx + 1, ry).getRotation(), Math.min(world.tile(rx, ry).getRotation(), Math.min(world.tile(rx + 1, ry + 1).getRotation(), world.tile(rx, ry + 1).getRotation())));
|
||||
}
|
||||
|
||||
int avg(int rx, int ry){
|
||||
return (world.tile(rx + 1, ry).getRotation() + world.tile(rx, ry).getRotation() + world.tile(rx + 1, ry + 1).getRotation() + world.tile(rx, ry + 1).getRotation()) / 4;
|
||||
}
|
||||
|
||||
boolean eq(int rx, int ry){
|
||||
return world.tile(rx + 1, ry).block() == this
|
||||
&& world.tile(rx, ry + 1).block() == this
|
||||
|
||||
@@ -7,21 +7,19 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class TreeBlock extends Block{
|
||||
static final float shadowOffset = 10f;
|
||||
|
||||
public TreeBlock(String name){
|
||||
super(name);
|
||||
solid = true;
|
||||
layer = Layer.power;
|
||||
//cacheLayer = CacheLayer.walls;
|
||||
expanded = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
Draw.colorl(1f - tile.getRotation() / 4f);
|
||||
Draw.rect(region, tile.drawx(), tile.drawy(), Mathf.randomSeed(tile.pos(), 0, 4) * 90);
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user