Campaign changes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -232,6 +232,10 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
ores.add(Blocks.oreThorium);
|
||||
}
|
||||
|
||||
if(rand.chance(0.25)){
|
||||
ores.add(Blocks.oreScrap);
|
||||
}
|
||||
|
||||
FloatSeq frequencies = new FloatSeq();
|
||||
for(int i = 0; i < ores.size; i++){
|
||||
frequencies.add(rand.random(-0.09f, 0.01f) - i * 0.01f);
|
||||
@@ -250,6 +254,10 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(ore == Blocks.oreScrap && rand.chance(0.33)){
|
||||
floor = Blocks.metalFloorDamaged;
|
||||
}
|
||||
});
|
||||
|
||||
trimDark();
|
||||
@@ -326,7 +334,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
}
|
||||
});
|
||||
|
||||
float difficulty = sector.baseCoverage;
|
||||
float difficulty = sector.threat;
|
||||
ints.clear();
|
||||
ints.ensureCapacity(width * height / 4);
|
||||
|
||||
@@ -417,7 +425,11 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
state.rules.winWave = sector.info.winWave = 10 + 5 * (int)Math.max(difficulty * 10, 1);
|
||||
}
|
||||
|
||||
float waveTimeDec = 0.4f;
|
||||
|
||||
state.rules.waveSpacing = Mathf.lerp(60 * 65 * 2, 60f * 60f * 1f, Math.max(difficulty - waveTimeDec, 0f) / 0.8f);
|
||||
state.rules.waves = sector.info.waves = true;
|
||||
state.rules.enemyCoreBuildRadius = 600f;
|
||||
|
||||
//TODO better waves
|
||||
state.rules.spawns = Waves.generate(difficulty);
|
||||
|
||||
Reference in New Issue
Block a user