WIP crystal biome
This commit is contained in:
@@ -45,10 +45,11 @@ public class Blocks{
|
||||
redmat, bluemat,
|
||||
stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
|
||||
redweed, purbush, coralChunk, yellowCoral,
|
||||
regolithWall, yellowStoneWall, rhyoliteWall, steamVent, carbonWall, redIceWall, ferricStoneWall, beryllicStoneWall, arkyicWall,
|
||||
ferricStone, ferricCraters, carbonStone, beryllicStone,
|
||||
regolithWall, yellowStoneWall, rhyoliteWall, steamVent, carbonWall, redIceWall, ferricStoneWall, beryllicStoneWall, arkyicWall, crystallineStoneWall,
|
||||
ferricStone, ferricCraters, carbonStone, beryllicStone, crystallineStone, crystalFloor,
|
||||
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, grass, salt,
|
||||
shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, carbonBoulder, ferricBoulder, beryllicBoulder, yellowStoneBoulder,
|
||||
//boulders
|
||||
shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, carbonBoulder, ferricBoulder, beryllicBoulder, yellowStoneBoulder, arkyicBoulder, crystalCluster, crystallineBoulder,
|
||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, basalt, magmarock, hotrock, snowWall, saltWall,
|
||||
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
||||
pebbles, tendrils,
|
||||
@@ -398,6 +399,14 @@ public class Blocks{
|
||||
variants = 4;
|
||||
}};
|
||||
|
||||
crystallineStone = new Floor("crystalline-stone"){{
|
||||
variants = 5;
|
||||
}};
|
||||
|
||||
crystalFloor = new Floor("crystal-floor"){{
|
||||
variants = 4;
|
||||
}};
|
||||
|
||||
redIce = new Floor("red-ice"){{
|
||||
//TODO red ice boulder
|
||||
dragMultiplier = 0.4f;
|
||||
@@ -530,6 +539,11 @@ public class Blocks{
|
||||
arkyciteFloor.asFloor().wall = arkyicStone.asFloor().wall = this;
|
||||
}};
|
||||
|
||||
crystallineStoneWall = new StaticWall("crystalline-stone-wall"){{
|
||||
variants = 4;
|
||||
crystallineStone.asFloor().wall = crystalFloor.asFloor().wall = this;
|
||||
}};
|
||||
|
||||
redIceWall = new StaticWall("red-ice-wall"){{
|
||||
redIce.asFloor().wall = this;
|
||||
}};
|
||||
@@ -636,6 +650,24 @@ public class Blocks{
|
||||
yellowStone.asFloor().decoration = regolith.asFloor().decoration = this;
|
||||
}};
|
||||
|
||||
//1px outline + 4.50 gaussian shadow in gimp
|
||||
arkyicBoulder = new Prop("arkyic-boulder"){{
|
||||
variants = 3;
|
||||
customShadow = true;
|
||||
arkyicStone.asFloor().decoration = this;
|
||||
}};
|
||||
|
||||
//TODO better visuals, maybe make tree
|
||||
crystalCluster = new TallBlock("crystal-cluster"){{
|
||||
variants = 3;
|
||||
clipSize = 128f;
|
||||
}};
|
||||
|
||||
crystallineBoulder = new Prop("crystalline-boulder"){{
|
||||
variants = 2;
|
||||
crystallineStone.asFloor().decoration = this;
|
||||
}};
|
||||
|
||||
metalFloor = new Floor("metal-floor", 0);
|
||||
metalFloorDamaged = new Floor("metal-floor-damaged", 3);
|
||||
|
||||
|
||||
@@ -1031,12 +1031,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
}
|
||||
}
|
||||
|
||||
public void drawCustomShadow(){
|
||||
Draw.color(0f, 0f, 0f, BlockRenderer.shadowColor.a);
|
||||
Draw.rect(block.customShadowRegion, x, y, drawrot());
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public void drawCracks(){
|
||||
if(!damaged() || block.size > BlockRenderer.maxCrackSize) return;
|
||||
int id = pos();
|
||||
|
||||
@@ -368,12 +368,13 @@ public class BlockRenderer{
|
||||
Draw.reset();
|
||||
Draw.z(Layer.block);
|
||||
|
||||
if(block.customShadow){
|
||||
Draw.z(Layer.block - 1);
|
||||
block.drawShadow(tile);
|
||||
Draw.z(Layer.block);
|
||||
}
|
||||
|
||||
if(entity != null){
|
||||
if(block.customShadow){
|
||||
Draw.z(Layer.block - 1);
|
||||
entity.drawCustomShadow();
|
||||
Draw.z(Layer.block);
|
||||
}
|
||||
|
||||
if(entity.damaged()){
|
||||
entity.drawCracks();
|
||||
|
||||
@@ -364,6 +364,21 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean near(int cx, int cy, int rad, Block block){
|
||||
for(int x = -rad; x <= rad; x++){
|
||||
for(int y = -rad; y <= rad; y++){
|
||||
int wx = cx + x, wy = cy + y;
|
||||
if(Structs.inBounds(wx, wy, width, height) && Mathf.within(x, y, rad)){
|
||||
Tile other = tiles.getn(wx, wy);
|
||||
if(other.block() == block){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void decoration(float chance){
|
||||
pass((x, y) -> {
|
||||
for(int i = 0; i < 4; i++){
|
||||
|
||||
@@ -24,7 +24,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
||||
public float heightScl = 0.9f, octaves = 8, persistence = 0.7f, heightPow = 3f, heightMult = 1.6f;
|
||||
|
||||
Block[][] arr = {
|
||||
{Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.rhyolite, Blocks.basalt}
|
||||
//{Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.rhyolite, Blocks.basalt}
|
||||
{Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.crystallineStone, Blocks.basalt}
|
||||
};
|
||||
|
||||
@Override
|
||||
@@ -210,9 +211,17 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
||||
}
|
||||
|
||||
//TODO design ore generation so it doesn't overlap
|
||||
if(noise(x + 999, y + 600, 4, 0.63f, 50f, 1f) < 0.2f/* && floor == Blocks.yellowStone*/){
|
||||
ore = Blocks.oreThorium;
|
||||
if(noise(x + 999, y + 600 - x, 4, 0.63f, 50f, 1f) < 0.25f && floor == Blocks.crystallineStone){
|
||||
ore = Blocks.oreCrystalThorium;
|
||||
}
|
||||
|
||||
if(noise(x + 999, y + 600 - x, 5, 0.8f, 50f, 1f) < 0.38f && floor == Blocks.crystallineStone){
|
||||
floor = Blocks.crystalFloor;
|
||||
}
|
||||
}
|
||||
|
||||
if(block == Blocks.air && floor == Blocks.crystallineStone && rand.chance(0.08) && nearWall(x, y) && !near(x, y, 4, Blocks.crystalCluster)){
|
||||
block = Blocks.crystalCluster;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ public class Block extends UnlockableContent{
|
||||
public TextureRegion region, editorIcon;
|
||||
public @Load("@-shadow") TextureRegion customShadowRegion;
|
||||
public @Load("@-team") TextureRegion teamRegion;
|
||||
public TextureRegion[] teamRegions, variantRegions;
|
||||
public TextureRegion[] teamRegions, variantRegions, variantShadowRegions;
|
||||
|
||||
protected static final Seq<Tile> tempTiles = new Seq<>();
|
||||
protected static final Seq<Building> tempTileEnts = new Seq<>();
|
||||
@@ -314,14 +314,22 @@ public class Block extends UnlockableContent{
|
||||
if(tile.build != null){
|
||||
tile.build.draw();
|
||||
}else{
|
||||
if(variants == 0){
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
}else{
|
||||
Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], tile.drawx(), tile.drawy());
|
||||
}
|
||||
Draw.rect(
|
||||
variants == 0 ? region :
|
||||
variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))],
|
||||
tile.drawx(), tile.drawy());
|
||||
}
|
||||
}
|
||||
|
||||
public void drawShadow(Tile tile){
|
||||
Draw.color(0f, 0f, 0f, BlockRenderer.shadowColor.a);
|
||||
Draw.rect(
|
||||
variants == 0 ? customShadowRegion :
|
||||
variantShadowRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantShadowRegions.length - 1))],
|
||||
tile.drawx(), tile.drawy(), tile.build == null ? 0f : tile.build.drawrot());
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public float percentSolid(int x, int y){
|
||||
Tile tile = world.tile(x, y);
|
||||
if(tile == null) return 0;
|
||||
@@ -1019,6 +1027,13 @@ public class Block extends UnlockableContent{
|
||||
variantRegions[i] = Core.atlas.find(name + (i + 1));
|
||||
}
|
||||
region = variantRegions[0];
|
||||
|
||||
if(customShadow){
|
||||
variantShadowRegions = new TextureRegion[variants];
|
||||
for(int i = 0; i < variants; i++){
|
||||
variantShadowRegions[i] = Core.atlas.find(name + "-shadow" + (i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
53
core/src/mindustry/world/blocks/environment/TallBlock.java
Normal file
53
core/src/mindustry/world/blocks/environment/TallBlock.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package mindustry.world.blocks.environment;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
//I don't know what else to call this. It's not a prop, it's not a tree.
|
||||
public class TallBlock extends Block{
|
||||
public float shadowOffset = -3f;
|
||||
public float layer = Layer.power + 1;
|
||||
public float rotationRand = 20f;
|
||||
|
||||
public TallBlock(String name){
|
||||
super(name);
|
||||
solid = true;
|
||||
clipSize = 90;
|
||||
customShadow = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
hasShadow = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBase(Tile tile){
|
||||
float rot = Mathf.randomSeedRange(tile.pos() + 1, rotationRand);
|
||||
|
||||
Draw.z(Layer.power - 1);
|
||||
Draw.color(0f, 0f, 0f, 0.6f);
|
||||
Draw.rect(variants > 0 ? variantShadowRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantShadowRegions.length - 1))] : customShadowRegion,
|
||||
tile.worldx() + shadowOffset, tile.worldy() + shadowOffset, rot);
|
||||
|
||||
Draw.color();
|
||||
|
||||
Draw.z(Layer.power + 1);
|
||||
Draw.rect(variants > 0 ? variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))] : region,
|
||||
tile.worldx(), tile.worldy(), rot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawShadow(Tile tile){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(){
|
||||
return variants == 0 ? super.icons() : new TextureRegion[]{Core.atlas.find(name + "1")};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user