Erekir generation improvements

This commit is contained in:
Anuken
2021-12-02 13:25:43 -05:00
parent f754dd1373
commit fff492d89d
9 changed files with 132 additions and 37 deletions

View File

@@ -46,7 +46,7 @@ public class Blocks{
regolithWall, yellowStoneWall, rhyoliteWall, steamVent, carbonWall, redIceWall, ferricStoneWall, beryllicStoneWall,
ferricStone, ferricCraters, carbonStone, beryllicStone,
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, grass, salt,
shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, carbonBoulder, ferricBoulder, beryllicBoulder,
shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, carbonBoulder, ferricBoulder, beryllicBoulder, yellowStoneBoulder,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, basalt, magmarock, hotrock, snowWall, saltWall,
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
pebbles, tendrils,
@@ -97,7 +97,8 @@ public class Blocks{
impactReactor, battery, batteryLarge, powerNode, powerNodeLarge, surgeTower, diode,
//power - erekir
turbineCondenser, chemicalCombustionChamber,
//TODO rename chemicalCombustionChamber
turbineCondenser, chemicalCombustionChamber, pyrolysisGenerator,
beamNode, beamTower,
//production
@@ -105,7 +106,7 @@ public class Blocks{
cliffCrusher, plasmaBore, largePlasmaBore, impactDrill,
//storage
coreShard, coreFoundation, coreNucleus, vault, container, unloader,
coreShard, coreFoundation, /*TODO core foundation is a bad name, rename to fragment */ coreNucleus, vault, container, unloader,
//storage - erekir
coreBastion, coreCitadel, coreAcropolis, reinforcedContainer, reinforcedVault,
@@ -612,6 +613,11 @@ public class Blocks{
beryllicStone.asFloor().decoration = this;
}};
yellowStoneBoulder = new Prop("yellow-stone-boulder"){{
variants = 2;
yellowStone.asFloor().decoration = this;
}};
metalFloor = new Floor("metal-floor", 0);
metalFloorDamaged = new Floor("metal-floor-damaged", 3);
@@ -1952,13 +1958,12 @@ public class Blocks{
//erekir
//TODO work on sprite, green bits?
turbineCondenser = new ThermalGenerator("turbine-condenser"){{
requirements(Category.power, with(Items.graphite, 40, Items.beryllium, 40));
attribute = Attribute.vent;
displayEfficiencyScale = 1f / 9f;
minEfficiency = 9f - 0.0001f;
powerProduction = 4f / 9f;
powerProduction = 3f / 9f;
displayEfficiency = false;
generateEffect = Fx.turbinegenerate;
effectChance = 0.04f;
@@ -1972,6 +1977,7 @@ public class Blocks{
liquidCapacity = 20f;
}};
//TODO rename
chemicalCombustionChamber = new SingleTypeGenerator("chemical-combustion-chamber"){{
requirements(Category.power, with(Items.graphite, 40, Items.tungsten, 40, Items.oxide, 40f, Items.silicon, 30));
powerProduction = 6f;
@@ -1993,6 +1999,30 @@ public class Blocks{
ambientSoundVolume = 0.06f;
}};
if(false)
pyrolysisGenerator = new SingleTypeGenerator("pyrolysis-generator"){{
//TODO requirements
requirements(Category.power, with(Items.graphite, 50, Items.carbide, 50, Items.oxide, 60f, Items.silicon, 40));
powerProduction = 12f;
//TODO ratios, extra requirements
consumes.liquids(LiquidStack.with(Liquids.slag, 20f / 60f, Liquids.arkycite, 20f / 60f));
size = 3;
useItems = false;
//TODO water output? hydrogen??
iconOverride = new String[]{"-bottom", ""};
generateEffect = Fx.none;
ambientSound = Sounds.smelter;
ambientSoundVolume = 0.06f;
}};
//TODO volatile reactor;
//- input arkycite, ozone(?), some item(?), maybe slag or heat?
//- output water, power
//endregion power
//region production

View File

@@ -16,7 +16,8 @@ public enum ContentType{
typeid_UNUSED,
error,
planet,
ammo_UNUSED;
ammo_UNUSED,
team;
public static final ContentType[] all = values();
}

View File

@@ -11,6 +11,7 @@ import mindustry.ai.Astar.*;
import mindustry.content.*;
import mindustry.game.*;
import mindustry.world.*;
import mindustry.world.blocks.environment.*;
import static mindustry.Vars.*;
@@ -343,6 +344,26 @@ public abstract class BasicGenerator implements WorldGenerator{
}
}
public boolean nearWall(int x, int y){
for(Point2 p : Geometry.d8){
Tile other = tiles.get(x + p.x, y + p.y);
if(other != null && other.block() != Blocks.air){
return true;
}
}
return false;
}
public boolean nearAir(int x, int y){
for(Point2 p : Geometry.d4){
Tile other = tiles.get(x + p.x, y + p.y);
if(other != null && other.block() == Blocks.air){
return true;
}
}
return false;
}
public void decoration(float chance){
pass((x, y) -> {
for(int i = 0; i < 4; i++){
@@ -358,6 +379,30 @@ public abstract class BasicGenerator implements WorldGenerator{
});
}
public void blend(Block floor, Block around, float radius){
float r2 = radius*radius;
int cap = Mathf.ceil(radius);
int max = tiles.width * tiles.height;
Floor dest = around.asFloor();
for(int i = 0; i < max; i++){
Tile tile = tiles.geti(i);
if(tile.floor() == floor){
for(int cx = -cap; cx <= cap; cx++){
for(int cy = -cap; cy <= cap; cy++){
if(cx*cx + cy*cy <= r2){
Tile other = tiles.get(tile.x + cx, tile.y + cy);
if(other != null && other.floor() != floor){
other.setFloor(dest);
}
}
}
}
}
}
}
public void brush(Seq<Tile> path, int rad){
path.each(tile -> erase(tile.x, tile.y, rad));
}

View File

@@ -92,11 +92,11 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
tile.block = tile.floor.asFloor().wall;
if(Ridged.noise3d(1, position.x, position.y, position.z, 2, 25) > 0.2){
if(Ridged.noise3d(1, position.x, position.y, position.z, 2, 25) > 0.19){
tile.block = Blocks.air;
}
if(Ridged.noise3d(2, position.x, position.y + 4f, position.z, 3, 7f) > 0.7){
if(Ridged.noise3d(2, position.x, position.y + 4f, position.z, 3, 6f) > 0.65){
tile.floor = Blocks.carbonStone;
}
}
@@ -136,25 +136,29 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
//arkycite
pass((x, y) -> {
if(nearWall(x, y)) return;
float noise = noise(x + 300, y - x*1.6f + 100, 4, 0.81f, 96f, 1f);
float noise = noise(x + 300, y - x*1.6f + 100, 4, 0.8f, 120f, 1f);
if(noise > 0.71f){
floor = Blocks.arkyciteFloor;
}else if(noise > 0.65){
floor = Blocks.arkyicStone;
}
});
median(2, 0.6, Blocks.arkyciteFloor);
//TODO arkycite walls
blend(Blocks.arkyciteFloor, Blocks.arkyicStone, 4);
distort(10f, 12f);
distort(5f, 7f);
//does arkycite need smoothing?
median(2, 0.6, Blocks.arkyciteFloor);
//smooth out slag to prevent random 1-tile patches
median(3, 0.6, Blocks.slag);
//does arkycite need smoothing?
//median(3, 0.6, Blocks.arkyciteFloor);
pass((x, y) -> {
float max = 0;
for(Point2 p : Geometry.d8){
@@ -171,42 +175,29 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
tiles.getn(endX, endY).setOverlay(Blocks.spawn);
//TODO tech is lazy and boring
tech(Blocks.darkPanel3, Blocks.darkPanel5, Blocks.darkMetal);
//ores
pass((x, y) -> {
if(block != Blocks.air){
boolean empty = false;
for(Point2 p : Geometry.d8){
Tile other = tiles.get(x + p.x, y + p.y);
if(other != null && other.block() == Blocks.air){
empty = true;
break;
//TODO use d4 instead of d8 for no out-of-reach ores?
if(nearAir(x, y)){
if(noise(x + 78, y, 4, 0.7f, 35f, 1f) > 0.67f && block == Blocks.carbonWall){
block = Blocks.graphiticWall;
}else if(noise(x + 782, y, 4, 0.8f, 40f, 1f) > 0.7f && block != Blocks.carbonWall){
ore = Blocks.wallOreBeryl;
}
}
}else if(!nearWall(x, y)){
if(empty && noise(x + 78, y, 4, 0.7f, 35f, 1f) > 0.67f && block == Blocks.carbonWall){
block = Blocks.graphiticWall;
}else if(empty && noise(x + 782, y, 4, 0.8f, 40f, 1f) > 0.7f && block != Blocks.carbonWall){
ore = Blocks.wallOreBeryl;
}
}else{
boolean empty = true;
for(Point2 p : Geometry.d8){
Tile other = tiles.get(x + p.x, y + p.y);
if(other != null && other.block() != Blocks.air){
empty = false;
break;
}
}
if(empty && noise(x + 150, y + x*2 + 100, 4, 0.8f, 40f, 1f) > 0.71f/* && floor == Blocks.yellowStone*/){
if(noise(x + 150, y + x*2 + 100, 4, 0.8f, 40f, 1f) > 0.71f/* && floor == Blocks.yellowStone*/){
ore = Blocks.oreTungsten;
}
//TODO design ore generation so it doesn't overlap
if(empty && noise(x + 999, y + 600, 4, 0.63f, 37f, 1f) < 0.25f/* && floor == Blocks.yellowStone*/){
if(noise(x + 999, y + 600, 4, 0.63f, 37f, 1f) < 0.25f/* && floor == Blocks.yellowStone*/){
ore = Blocks.oreThorium;
}
}
@@ -239,6 +230,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
}
}
decoration(0.015f);
//not allowed
state.rules.hiddenBuildItems.addAll(Items.copper, Items.titanium, Items.coal, Items.lead, Items.blastCompound, Items.pyratite, Items.sporePod, Items.metaglass, Items.plastanium);

View File

@@ -0,0 +1,20 @@
package mindustry.type;
import mindustry.ctype.*;
import mindustry.game.*;
/** This class is only for displaying team lore in the content database. */
//TODO
public class TeamEntry extends UnlockableContent{
public final Team team;
public TeamEntry(Team team){
super(team.name);
this.team = team;
}
@Override
public ContentType getContentType(){
return ContentType.team;
}
}

View File

@@ -115,6 +115,11 @@ public class Floor extends Block{
//keep default value if not found...
if(wall == null) wall = Blocks.air;
//try to load the default boulder
if(decoration == null){
decoration = content.block(name + "-boulder");
}
if(isLiquid && walkEffect == Fx.none){
walkEffect = Fx.ripple;
}