Campaign changes

This commit is contained in:
Anuken
2020-11-13 11:33:31 -05:00
parent 4e7d6e9a9d
commit 0908176079
76 changed files with 137 additions and 49 deletions

View File

@@ -13,6 +13,7 @@ import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.defense.*;
import mindustry.world.blocks.distribution.*;
import mindustry.world.blocks.power.*;
import mindustry.world.blocks.production.*;
import mindustry.world.meta.*;
@@ -38,9 +39,6 @@ public class BaseGenerator{
Mathf.rand.setSeed(sector.id);
//TODO limit base size
float costBudget = 1000;
Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1 && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
Seq<Block> wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2 && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
@@ -51,10 +49,12 @@ public class BaseGenerator{
//TODO proper difficulty selection
float bracket = difficulty;
float bracketRange = 0.2f;
float baseChance = Mathf.lerp(0.7f, 1.9f, difficulty);
int wallAngle = 70; //180 for full coverage
double resourceChance = 0.5;
double nonResourceChance = 0.0005;
double resourceChance = 0.5 * baseChance;
double nonResourceChance = 0.0005 * baseChance;
BasePart coreschem = bases.cores.getFrac(bracket);
int passes = difficulty < 0.4 ? 1 : difficulty < 0.8 ? 2 : 3;
Block wall = wallsSmall.getFrac(bracket), wallLarge = wallsLarge.getFrac(bracket);
@@ -69,20 +69,22 @@ public class BaseGenerator{
}
}
//random schematics
pass(tile -> {
if(!tile.block().alwaysReplace) return;
for(int i = 0; i < passes; i++){
//random schematics
pass(tile -> {
if(!tile.block().alwaysReplace) return;
if(((tile.overlay().asFloor().itemDrop != null || (tile.drop() != null && Mathf.chance(nonResourceChance)))
if(((tile.overlay().asFloor().itemDrop != null || (tile.drop() != null && Mathf.chance(nonResourceChance)))
|| (tile.floor().liquidDrop != null && Mathf.chance(nonResourceChance * 2))) && Mathf.chance(resourceChance)){
Seq<BasePart> parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop);
if(!parts.isEmpty()){
tryPlace(parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team);
Seq<BasePart> parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop);
if(!parts.isEmpty()){
tryPlace(parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team);
}
}else if(Mathf.chance(nonResourceChance)){
tryPlace(bases.parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team);
}
}else if(Mathf.chance(nonResourceChance)){
tryPlace(bases.parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team);
}
});
});
}
//replace walls with the correct type (disabled)
if(false)
@@ -100,6 +102,15 @@ public class BaseGenerator{
if(tile.block().alwaysReplace){
boolean any = false;
for(Point2 p : Geometry.d4){
Tile o = tiles.get(tile.x + p.x, tile.y + p.y);
//do not block payloads
if(o != null && (o.block() instanceof PayloadConveyor || o.block() instanceof PayloadAcceptor)){
return;
}
}
for(Point2 p : Geometry.d8){
if(Angles.angleDist(Angles.angle(p.x, p.y), spawn.angleTo(tile)) > wallAngle){
continue;

View File

@@ -19,7 +19,7 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
boolean any = false;
float noise = Noise.snoise3(tile.v.x, tile.v.y, tile.v.z, 0.001f, 0.5f);
if(noise > 0.028){
if(noise > 0.027){
any = true;
}