Loadout env fixes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user