Loadout env fixes

This commit is contained in:
Anuken
2022-01-26 14:01:38 -05:00
parent 06a4f65728
commit f97d7edffb
9 changed files with 28 additions and 18 deletions

View File

@@ -1,6 +1,5 @@
package mindustry.maps.generators;
import arc.math.*;
import arc.math.geom.*;
import mindustry.content.*;
import mindustry.game.*;
@@ -35,25 +34,19 @@ public class FileMapGenerator implements WorldGenerator{
public void generate(Tiles tiles){
if(map == null) throw new RuntimeException("Generator has null map, cannot be used.");
Sector sector = state.rules.sector;
world.setGenerating(false);
SaveIO.load(map.file, world.filterContext(map));
world.setGenerating(true);
tiles = world.tiles;
//TODO why is this hardcoded into the map generator
Item[] items = {Items.blastCompound, Items.pyratite, Items.copper, Items.thorium, Items.copper, Items.lead};
for(Tile tile : tiles){
if(tile.block() instanceof StorageBlock && !(tile.block() instanceof CoreBlock) && state.hasSector()){
for(Item content : items){
if(Mathf.chance(0.2)){
tile.build.items.add(content, Math.min(Mathf.random(500), tile.block().itemCapacity));
}
}
}
//make sure sector is maintained - don't reset it after map load.
if(sector != null){
state.rules.sector = sector;
}
tiles = world.tiles;
boolean anyCores = false;
for(Tile tile : tiles){

View File

@@ -351,7 +351,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
//it is very hot
state.rules.attributes.set(Attribute.heat, 0.8f);
state.rules.environment = Env.scorching | Env.terrestrial;
state.rules.environment = sector.planet.defaultEnv;
Schematics.placeLaunchLoadout(spawnX, spawnY);
//all sectors are wave sectors

View File

@@ -645,6 +645,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
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.environment = sector.planet.defaultEnv;
state.rules.enemyCoreBuildRadius = 600f;
//spawn air only when spawn is blocked