Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

This commit is contained in:
Anuken
2021-09-13 20:52:41 -04:00
82 changed files with 1517 additions and 1114 deletions

View File

@@ -272,16 +272,22 @@ public class SectorDamage{
float e = build.efficiency();
if(e > 0.08f){
if(build.team == state.rules.defaultTeam && build instanceof Ranged ranged && sparse.contains(t -> t.within(build, ranged.range() + 4*tilesize))){
//TODO make sure power turret network supports the turrets?
if(build.block instanceof Turret t && build instanceof TurretBuild b && b.hasAmmo()){
sumDps += t.shots / t.reloadTime * 60f * b.peekAmmo().estimateDPS() * e;
sumDps += t.shots / t.reloadTime * 60f * b.peekAmmo().estimateDPS() * e * build.timeScale;
}
if(build.block instanceof MendProjector m){
sumRps += m.healPercent / m.reload * avgHealth * 60f / 100f * e;
sumRps += m.healPercent / m.reload * avgHealth * 60f / 100f * e * build.timeScale;
}
//point defense turrets act as flat health right now
if(build.block instanceof PointDefenseTurret && build.consValid()){
sumHealth += 150f * build.timeScale;
}
if(build.block instanceof ForceProjector f){
sumHealth += f.shieldHealth * e;
sumHealth += f.shieldHealth * e * build.timeScale;
sumRps += e;
}
}
@@ -315,14 +321,20 @@ public class SectorDamage{
var reg = new LinearRegression();
SpawnGroup bossGroup = null;
Seq<Vec2> waveDps = new Seq<>(), waveHealth = new Seq<>();
int groundSpawns = Math.max(spawner.countFlyerSpawns(), 1), airSpawns = Math.max(spawner.countGroundSpawns(), 1);
for(int wave = state.wave; wave < state.wave + 10; wave ++){
float sumWaveDps = 0f, sumWaveHealth = 0f;
for(SpawnGroup group : state.rules.spawns){
//calculate the amount of spawn points used
//if there's a spawn position override, there is only one potential place they spawn
//assume that all overridden positions are valid, should always be true in properly designed campaign maps
int spawnCount = group.spawn != -1 ? 1 : group.type.flying ? airSpawns : groundSpawns;
float healthMult = 1f + Mathf.clamp(group.type.armor / 20f);
StatusEffect effect = (group.effect == null ? StatusEffects.none : group.effect);
int spawned = group.getSpawned(wave);
int spawned = group.getSpawned(wave) * spawnCount;
//save the boss group
if(group.effect == StatusEffects.boss){
bossGroup = group;

View File

@@ -8,7 +8,7 @@ import static mindustry.maps.filters.FilterOption.*;
public class BlendFilter extends GenerateFilter{
float radius = 2f;
Block block = Blocks.stone, floor = Blocks.ice, ignore = Blocks.air;
Block block = Blocks.sand, floor = Blocks.sandWater, ignore = Blocks.air;
@Override
public FilterOption[] options(){
@@ -16,7 +16,7 @@ public class BlendFilter extends GenerateFilter{
new SliderOption("radius", () -> radius, f -> radius = f, 1f, 10f),
new BlockOption("block", () -> block, b -> block = b, anyOptional),
new BlockOption("floor", () -> floor, b -> floor = b, anyOptional),
new BlockOption("ignore", () -> ignore, b -> ignore = b, floorsOptional)
new BlockOption("ignore", () -> ignore, b -> ignore = b, anyOptional)
};
}

View File

@@ -27,7 +27,7 @@ public class DistortFilter extends GenerateFilter{
@Override
public void apply(GenerateInput in){
Tile tile = in.tile(in.x + noise(in, scl, mag) - mag / 2f, in.y + noise(in, scl, mag) - mag / 2f);
Tile tile = in.tile(in.x + noise(in, scl, mag) - mag / 2f, in.y + noise(1, in, scl, mag) - mag / 2f);
in.floor = tile.floor();
if(!tile.block().synthetic() && !in.block.synthetic()) in.block = tile.block();

View File

@@ -99,6 +99,10 @@ public abstract class GenerateFilter{
//utility generation functions
protected float noise(int seedOffset, GenerateInput in, float scl, float mag){
return Simplex.noise2d(seedOffset + seed, 1f, 0f, 1f / scl, in.x, in.y) * mag;
}
protected float noise(GenerateInput in, float scl, float mag){
return Simplex.noise2d(seed, 1f, 0f, 1f / scl, in.x, in.y) * mag;
}

View File

@@ -8,7 +8,7 @@ import static mindustry.maps.filters.FilterOption.*;
public class RiverNoiseFilter extends GenerateFilter{
float scl = 40, threshold = 0f, threshold2 = 0.1f, octaves = 1, falloff = 0.5f;
Block floor = Blocks.water, floor2 = Blocks.deepwater, block = Blocks.sandWall;
Block floor = Blocks.water, floor2 = Blocks.deepwater, block = Blocks.sandWall, target = Blocks.air;
@Override
public FilterOption[] options(){
@@ -18,6 +18,7 @@ public class RiverNoiseFilter extends GenerateFilter{
new SliderOption("threshold2", () -> threshold2, f -> threshold2 = f, -1f, 1f),
new SliderOption("octaves", () -> octaves, f -> octaves = f, 1f, 10f),
new SliderOption("falloff", () -> falloff, f -> falloff = f, 0f, 1f),
new BlockOption("target", () -> target, b -> target = b, anyOptional),
new BlockOption("block", () -> block, b -> block = b, wallsOnly),
new BlockOption("floor", () -> floor, b -> floor = b, floorsOnly),
new BlockOption("floor2", () -> floor2, b -> floor2 = b, floorsOnly)
@@ -26,14 +27,14 @@ public class RiverNoiseFilter extends GenerateFilter{
@Override
public char icon(){
return Iconc.blockWater;
return Iconc.blockShallowWater;
}
@Override
public void apply(GenerateInput in){
float noise = rnoise(in.x, in.y, (int)octaves, scl, falloff, 1f);
if(noise >= threshold){
if(noise >= threshold && (target == Blocks.air || in.floor == target || in.block == target)){
in.floor = floor;
if(in.block.solid){

View File

@@ -30,6 +30,12 @@ public class BaseGenerator{
private Tiles tiles;
private Seq<Tile> cores;
public static Block getDifficultyWall(int size, float difficulty){
Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == size && !b.insulated && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
wallsSmall.sort(b -> b.buildCost);
return wallsSmall.getFrac(difficulty * 0.91f);
}
public void generate(Tiles tiles, Seq<Tile> cores, Tile spawn, Team team, Sector sector, float difficulty){
this.tiles = tiles;
this.cores = cores;
@@ -39,22 +45,15 @@ public class BaseGenerator{
Mathf.rand.setSeed(sector.id);
Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1 && !b.insulated && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
Seq<Block> wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2 && !b.insulated && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
//sort by cost for correct fraction
wallsSmall.sort(b -> b.buildCost);
wallsLarge.sort(b -> b.buildCost);
float bracketRange = 0.2f;
float baseChance = Mathf.lerp(0.7f, 1.9f, difficulty);
float bracketRange = 0.17f;
float baseChance = Mathf.lerp(0.7f, 2.1f, difficulty);
int wallAngle = 70; //180 for full coverage
double resourceChance = 0.5 * baseChance;
double nonResourceChance = 0.0005 * baseChance;
BasePart coreschem = bases.cores.getFrac(difficulty);
int passes = difficulty < 0.4 ? 1 : difficulty < 0.8 ? 2 : 3;
Block wall = wallsSmall.getFrac(difficulty * 0.91f), wallLarge = wallsLarge.getFrac(difficulty * 0.91f);
Block wall = getDifficultyWall(1, difficulty), wallLarge = getDifficultyWall(2, difficulty);
for(Tile tile : cores){
tile.clearOverlay();

View File

@@ -517,7 +517,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
float waveTimeDec = 0.4f;
state.rules.waveSpacing = Mathf.lerp(60 * 65 * 2, 60f * 60f * 1f, Math.max(difficulty - waveTimeDec, 0f) / 0.8f);
state.rules.waveSpacing = Mathf.lerp(60 * 65 * 2, 60f * 60f * 1f, Math.max(difficulty - waveTimeDec, 0f));
state.rules.waves = sector.info.waves = true;
state.rules.enemyCoreBuildRadius = 600f;