diff --git a/core/assets/maps/aware.msav b/core/assets/maps/aware.msav index 52425db1b5..9885b2c33f 100644 Binary files a/core/assets/maps/aware.msav and b/core/assets/maps/aware.msav differ diff --git a/core/src/mindustry/content/Planets.java b/core/src/mindustry/content/Planets.java index c7fac78826..c6226ee929 100644 --- a/core/src/mindustry/content/Planets.java +++ b/core/src/mindustry/content/Planets.java @@ -12,6 +12,7 @@ import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.maps.planet.*; import mindustry.type.*; import mindustry.world.*; +import mindustry.world.meta.*; public class Planets{ public static Planet @@ -50,6 +51,8 @@ public class Planets{ ); landCloudColor = Color.valueOf("ed6542"); atmosphereColor = Color.valueOf("f07218"); + defaultEnv = Env.scorching | Env.terrestrial; + drillOverlay = Blocks.air; startSector = 10; atmosphereRadIn = 0.02f; atmosphereRadOut = 0.3f; diff --git a/core/src/mindustry/game/Schematics.java b/core/src/mindustry/game/Schematics.java index 9e6d726180..bf8c67ec70 100644 --- a/core/src/mindustry/game/Schematics.java +++ b/core/src/mindustry/game/Schematics.java @@ -411,7 +411,7 @@ public class Schematics implements Loadable{ /** Places the last launch loadout at the coordinates and fills it with the launch resources. */ public static void placeLaunchLoadout(int x, int y){ - placeLoadout(universe.getLastLoadout(), x, y); + placeLoadout(universe.getLastLoadout(), x, y, state.rules.defaultTeam, state.rules.sector == null ? Blocks.air : state.rules.sector.planet.drillOverlay); if(world.tile(x, y).build == null) throw new RuntimeException("No core at loadout coordinates!"); world.tile(x, y).build.items.add(universe.getLaunchResources()); } @@ -455,7 +455,7 @@ public class Schematics implements Loadable{ tile.build.configureAny(config); } - if(st.block instanceof Drill){ + if(st.block instanceof Drill && resource != Blocks.air){ tile.getLinkedTiles(t -> t.setOverlay(resource)); } diff --git a/core/src/mindustry/maps/generators/FileMapGenerator.java b/core/src/mindustry/maps/generators/FileMapGenerator.java index 0639fd439f..4bcb35208a 100644 --- a/core/src/mindustry/maps/generators/FileMapGenerator.java +++ b/core/src/mindustry/maps/generators/FileMapGenerator.java @@ -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){ diff --git a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java index bb09ce8d85..58b21ef21d 100644 --- a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java @@ -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 diff --git a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java index 90c29872f4..e0a2079372 100644 --- a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java @@ -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 diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index 520f51d2ea..c6fde63745 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -9,12 +9,15 @@ import arc.math.geom.*; import arc.struct.*; import arc.util.*; import arc.util.noise.*; +import mindustry.content.*; import mindustry.content.TechTree.*; import mindustry.ctype.*; import mindustry.graphics.*; import mindustry.graphics.g3d.*; import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.maps.generators.*; +import mindustry.world.*; +import mindustry.world.meta.*; import static mindustry.Vars.*; @@ -63,6 +66,10 @@ public class Planet extends UnlockableContent{ public boolean tidalLock = false; /** Whether this planet is listed in the planet access UI. **/ public boolean accessible = true; + /** Environment flags for sectors on this planet. */ + public int defaultEnv = Env.terrestrial | Env.spores | Env.groundOil | Env.groundWater | Env.oxygen; + /** Default block placed under drills upon launching. */ + public Block drillOverlay = Blocks.oreCopper; /** If true, a day/night cycle is simulated. */ public boolean updateLighting = true; /** Day/night cycle parameters. */ diff --git a/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java b/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java index 30175e874c..98a803e292 100644 --- a/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java +++ b/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java @@ -5,6 +5,7 @@ import arc.func.*; import arc.scene.ui.*; import arc.scene.ui.layout.*; import arc.struct.*; +import arc.util.*; import mindustry.content.*; import mindustry.ctype.*; import mindustry.game.*; @@ -116,6 +117,11 @@ public class LaunchLoadoutDialog extends BaseDialog{ for(var entry : schematics.getLoadouts()){ if(entry.key.size <= core.size){ for(Schematic s : entry.value){ + if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) || + //make sure block can be built here. + (!state.rules.hiddenBuildItems.isEmpty() && Structs.contains(tile.block.requirements, stack -> state.rules.hiddenBuildItems.contains(stack.item))))){ + continue; + } t.button(b -> b.add(new SchematicImage(s)), Styles.togglet, () -> { selected = s; diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index f7a6a4775a..65439b000a 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -50,9 +50,9 @@ public class CoreBlock extends StorageBlock{ loopSoundVolume = 1f; drawDisabled = false; canOverdrive = false; + envEnabled |= Env.space; //support everything - envEnabled = Env.any; replaceable = false; rebuildable = false; }