Serpulo light coverage update fixes
This commit is contained in:
@@ -182,15 +182,6 @@ public class SectorInfo{
|
||||
winWave = state.rules.sector.preset.captureWave;
|
||||
}
|
||||
|
||||
lightCoverage = 0f;
|
||||
for(var build : state.rules.defaultTeam.data().buildings){
|
||||
if(build.block.emitLight){
|
||||
lightCoverage += build.block.lightRadius * build.efficiency;
|
||||
}
|
||||
}
|
||||
|
||||
lightCoverage += state.rules.defaultTeam.data().units.sumf(u -> u.type.lightRadius/2f);
|
||||
|
||||
state.wave = wave;
|
||||
state.rules.waves = waves;
|
||||
state.rules.waveSpacing = waveSpacing;
|
||||
@@ -236,6 +227,15 @@ public class SectorInfo{
|
||||
damage = 0;
|
||||
hasSpawns = spawner.countSpawns() > 0;
|
||||
|
||||
lightCoverage = 0f;
|
||||
for(var build : state.rules.defaultTeam.data().buildings){
|
||||
if(build.block.emitLight){
|
||||
lightCoverage += build.block.lightRadius * build.efficiency;
|
||||
}
|
||||
}
|
||||
|
||||
lightCoverage += state.rules.defaultTeam.data().units.sumf(u -> u.type.lightRadius/2f);
|
||||
|
||||
//cap production at raw production.
|
||||
production.each((item, stat) -> {
|
||||
stat.mean = Math.min(stat.mean, rawProduction.get(item, ExportStat::new).mean);
|
||||
@@ -253,6 +253,10 @@ public class SectorInfo{
|
||||
if(sector.planet.allowWaveSimulation){
|
||||
SectorDamage.writeParameters(sector);
|
||||
}
|
||||
|
||||
if(sector.planet.generator != null){
|
||||
sector.planet.generator.beforeSaveWrite(sector);
|
||||
}
|
||||
}
|
||||
|
||||
/** Update averages of various stats, updates some special sector logic.
|
||||
|
||||
@@ -37,6 +37,10 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
|
||||
|
||||
}
|
||||
|
||||
public void beforeSaveWrite(Sector sector){
|
||||
|
||||
}
|
||||
|
||||
public void getLockedText(Sector hovered, StringBuilder out){
|
||||
out.append("[gray]").append(Iconc.lock).append(" ").append(Core.bundle.get("locked"));
|
||||
}
|
||||
|
||||
@@ -20,13 +20,14 @@ import mindustry.world.blocks.environment.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
//alternate, less direct generation (wip)
|
||||
public static boolean alt = false;
|
||||
//alternate, less direct generation
|
||||
public static boolean indirectPaths = false;
|
||||
//random water patches
|
||||
public static boolean genLakes = false;
|
||||
|
||||
BaseGenerator basegen = new BaseGenerator();
|
||||
float scl = 5f;
|
||||
float waterOffset = 0.05f;
|
||||
boolean genLakes = false;
|
||||
|
||||
Block[][] arr =
|
||||
{
|
||||
@@ -74,6 +75,11 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
sector.planet.reloadMeshAsync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeSaveWrite(Sector sector){
|
||||
sector.planet.reloadMeshAsync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowLanding(Sector sector){
|
||||
return sector.planet.allowLaunchToNumbered && (sector.hasBase() || sector.near().contains(s -> s.hasBase() &&
|
||||
@@ -234,7 +240,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
Vec2 midpoint = Tmp.v1.set(to.x, to.y).add(x, y).scl(0.5f);
|
||||
rand.nextFloat();
|
||||
|
||||
if(alt){
|
||||
if(indirectPaths){
|
||||
midpoint.add(Tmp.v2.set(1, 0f).setAngle(Angles.angle(to.x, to.y, x, y) + 90f * (rand.chance(0.5) ? 1f : -1f)).scl(Tmp.v1.dst(x, y) * 2f));
|
||||
}else{
|
||||
//add randomized offset to avoid straight lines
|
||||
|
||||
Reference in New Issue
Block a user