Fixed core selection in preset sectors

This commit is contained in:
Anuken
2020-05-18 15:38:56 -04:00
parent a12ff624e5
commit 530ff9761b
13 changed files with 57 additions and 92 deletions

View File

@@ -233,11 +233,11 @@ project(":core"){
def androidLogList = loglines.findAll{ line -> !line.endsWith("]") || line.endsWith("[Mobile]") || line.endsWith("[Android]")} def androidLogList = loglines.findAll{ line -> !line.endsWith("]") || line.endsWith("[Mobile]") || line.endsWith("[Android]")}
def result = "" def result = ""
androidLogList.forEach({line -> androidLogList.forEach{line ->
if(result.length() + line.length() + 1 < maxLength){ if(result.length() + line.length() + 1 < maxLength){
result += line + "\n" result += line + "\n"
} }
}) }
def changelogs = file("../fastlane/metadata/android/en-US/changelogs/") def changelogs = file("../fastlane/metadata/android/en-US/changelogs/")
new File(changelogs, buildVersion + ".txt").text = (result) new File(changelogs, buildVersion + ".txt").text = (result)
new File(changelogs, androidVersion + ".txt").text = (result) new File(changelogs, androidVersion + ".txt").text = (result)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 KiB

After

Width:  |  Height:  |  Size: 735 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

@@ -1,9 +1,11 @@
package mindustry.content; package mindustry.content;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.Objectives.*;
import mindustry.type.*; import mindustry.type.*;
import static mindustry.content.Items.copper; import static arc.struct.Array.with;
import static mindustry.content.Items.*;
import static mindustry.content.Planets.starter; import static mindustry.content.Planets.starter;
import static mindustry.type.ItemStack.list; import static mindustry.type.ItemStack.list;
@@ -25,62 +27,8 @@ public class SectorPresets implements ContentList{
launchPeriod = 5; launchPeriod = 5;
}}; }};
//TODO remove saltFlats = new SectorPreset("saltFlats", starter, 16){{
/* startingItems = list(copper, 200, silicon, 200, lead, 200);
desertWastes = new Zone("desertWastes", starter){{
startingItems = list(copper, 120);
conditionWave = 20;
launchPeriod = 10;
loadout = Loadouts.advancedShard;
resources = with(copper, lead, coal, sand);
rules = r -> {
r.waves = true;
r.waveTimer = true;
r.launchWaveMultiplier = 3f;
r.waveSpacing = 60 * 50f;
r.spawns = with(
new SpawnGroup(UnitTypes.crawler){{
unitScaling = 3f;
}},
new SpawnGroup(UnitTypes.dagger){{
unitScaling = 4f;
begin = 2;
spacing = 2;
}},
new SpawnGroup(UnitTypes.wraith){{
unitScaling = 3f;
begin = 11;
spacing = 3;
}},
new SpawnGroup(UnitTypes.eruptor){{
unitScaling = 3f;
begin = 22;
unitAmount = 1;
spacing = 4;
}},
new SpawnGroup(UnitTypes.titan){{
unitScaling = 3f;
begin = 37;
unitAmount = 2;
spacing = 4;
}},
new SpawnGroup(UnitTypes.fortress){{
unitScaling = 2f;
effect = StatusEffects.boss;
begin = 41;
spacing = 20;
}}
);
};
requirements = with(
new ZoneWave(groundZero, 20),
new Unlock(Blocks.combustionGenerator)
);
}};*/
/*
saltFlats = new SectorPreset("saltFlats", starter){{
startingItems = list(copper, 200, Items.silicon, 200, lead, 200);
loadout = Loadouts.basicFoundation; loadout = Loadouts.basicFoundation;
conditionWave = 10; conditionWave = 10;
launchPeriod = 5; launchPeriod = 5;
@@ -93,7 +41,7 @@ public class SectorPresets implements ContentList{
); );
}}; }};
frozenForest = new SectorPreset("frozenForest", starter){{ frozenForest = new SectorPreset("frozenForest", starter, 17){{
loadout = Loadouts.basicFoundation; loadout = Loadouts.basicFoundation;
startingItems = list(copper, 250); startingItems = list(copper, 250);
conditionWave = 10; conditionWave = 10;
@@ -104,7 +52,7 @@ public class SectorPresets implements ContentList{
); );
}}; }};
craters = new SectorPreset("craters", starter){{ craters = new SectorPreset("craters", starter, 18){{
startingItems = list(copper, 100); startingItems = list(copper, 100);
conditionWave = 10; conditionWave = 10;
requirements = with( requirements = with(
@@ -114,7 +62,7 @@ public class SectorPresets implements ContentList{
); );
}}; }};
ruinousShores = new SectorPreset("ruinousShores", starter){{ ruinousShores = new SectorPreset("ruinousShores", starter, 19){{
loadout = Loadouts.basicFoundation; loadout = Loadouts.basicFoundation;
startingItems = list(copper, 140, lead, 50); startingItems = list(copper, 140, lead, 50);
conditionWave = 20; conditionWave = 20;
@@ -129,7 +77,7 @@ public class SectorPresets implements ContentList{
); );
}}; }};
stainedMountains = new SectorPreset("stainedMountains", starter){{ stainedMountains = new SectorPreset("stainedMountains", starter, 20){{
loadout = Loadouts.basicFoundation; loadout = Loadouts.basicFoundation;
startingItems = list(copper, 200, lead, 50); startingItems = list(copper, 200, lead, 50);
conditionWave = 10; conditionWave = 10;
@@ -142,7 +90,7 @@ public class SectorPresets implements ContentList{
); );
}}; }};
fungalPass = new SectorPreset("fungalPass", starter){{ fungalPass = new SectorPreset("fungalPass", starter, 21){{
startingItems = list(copper, 250, lead, 250, Items.metaglass, 100, Items.graphite, 100); startingItems = list(copper, 250, lead, 250, Items.metaglass, 100, Items.graphite, 100);
requirements = with( requirements = with(
new ZoneWave(stainedMountains, 15), new ZoneWave(stainedMountains, 15),
@@ -153,7 +101,7 @@ public class SectorPresets implements ContentList{
); );
}}; }};
overgrowth = new SectorPreset("overgrowth", starter){{ overgrowth = new SectorPreset("overgrowth", starter, 22){{
startingItems = list(copper, 1500, lead, 1000, Items.silicon, 500, Items.metaglass, 250); startingItems = list(copper, 1500, lead, 1000, Items.silicon, 500, Items.metaglass, 250);
conditionWave = 12; conditionWave = 12;
launchPeriod = 4; launchPeriod = 4;
@@ -168,7 +116,7 @@ public class SectorPresets implements ContentList{
); );
}}; }};
tarFields = new SectorPreset("tarFields", starter){{ tarFields = new SectorPreset("tarFields", starter, 23){{
loadout = Loadouts.basicFoundation; loadout = Loadouts.basicFoundation;
startingItems = list(copper, 250, lead, 100); startingItems = list(copper, 250, lead, 100);
conditionWave = 15; conditionWave = 15;
@@ -181,7 +129,7 @@ public class SectorPresets implements ContentList{
); );
}}; }};
desolateRift = new SectorPreset("desolateRift", starter){{ desolateRift = new SectorPreset("desolateRift", starter, 24){{
loadout = Loadouts.basicNucleus; loadout = Loadouts.basicNucleus;
startingItems = list(copper, 1000, lead, 1000, Items.graphite, 250, titanium, 250, Items.silicon, 250); startingItems = list(copper, 1000, lead, 1000, Items.graphite, 250, titanium, 250, Items.silicon, 250);
conditionWave = 3; conditionWave = 3;
@@ -194,18 +142,7 @@ public class SectorPresets implements ContentList{
}}; }};
crags = new Zone("crags", new MapGenerator("crags").dist(2f)){{ nuclearComplex = new SectorPreset("nuclearComplex", starter, 25){{
loadout = Loadouts.basicFoundation;
baseLaunchCost = ItemStack.with();
startingItems = ItemStack.list(Items.copper, 2000, Items.lead, 2000, Items.graphite, 500, Items.titanium, 500, Items.silicon, 500);
conditionWave = 3;
launchPeriod = 2;
requirements = with(stainedMountains, 40);
blockRequirements = new Block[]{Blocks.thermalGenerator};
resources = Array.with(Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
}};
nuclearComplex = new SectorPreset("nuclearComplex", starter){{
loadout = Loadouts.basicNucleus; loadout = Loadouts.basicNucleus;
startingItems = list(copper, 1250, lead, 1500, Items.silicon, 400, Items.metaglass, 250); startingItems = list(copper, 1250, lead, 1500, Items.silicon, 400, Items.metaglass, 250);
conditionWave = 30; conditionWave = 30;
@@ -217,6 +154,18 @@ public class SectorPresets implements ContentList{
); );
}}; }};
/*
crags = new Zone("crags", new MapGenerator("crags").dist(2f)){{
loadout = Loadouts.basicFoundation;
baseLaunchCost = ItemStack.with();
startingItems = ItemStack.list(Items.copper, 2000, Items.lead, 2000, Items.graphite, 500, Items.titanium, 500, Items.silicon, 500);
conditionWave = 3;
launchPeriod = 2;
requirements = with(stainedMountains, 40);
blockRequirements = new Block[]{Blocks.thermalGenerator};
resources = Array.with(Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
}};
impact0078 = new SectorPreset("impact0078"){{ impact0078 = new SectorPreset("impact0078"){{
loadout = Loadouts.basicNucleus; loadout = Loadouts.basicNucleus;

View File

@@ -240,6 +240,10 @@ public class World{
} }
} }
public Context filterContext(Map map){
return new FilterContext(map);
}
public void loadMap(Map map){ public void loadMap(Map map){
loadMap(map, new Rules()); loadMap(map, new Rules());
} }
@@ -472,6 +476,7 @@ public class World{
@Override @Override
public void end(){ public void end(){
Array<GenerateFilter> filters = map.filters(); Array<GenerateFilter> filters = map.filters();
if(!filters.isEmpty()){ if(!filters.isEmpty()){
//input for filter queries //input for filter queries
GenerateInput input = new GenerateInput(); GenerateInput input = new GenerateInput();

View File

@@ -330,7 +330,7 @@ public class Maps{
}else{ }else{
try{ try{
return JsonIO.read(Array.class, str); return JsonIO.read(Array.class, str);
}catch(Exception e){ }catch(Throwable e){
e.printStackTrace(); e.printStackTrace();
return readFilters(""); return readFilters("");
} }

View File

@@ -2,11 +2,10 @@ package mindustry.maps.filters;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.maps.filters.FilterOption.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.storage.*; import mindustry.world.blocks.storage.*;
import static mindustry.Vars.*; import static mindustry.Vars.state;
/** Selects X spawns from the core spawn pool.*/ /** Selects X spawns from the core spawn pool.*/
public class CoreSpawnFilter extends GenerateFilter{ public class CoreSpawnFilter extends GenerateFilter{
@@ -15,7 +14,8 @@ public class CoreSpawnFilter extends GenerateFilter{
@Override @Override
public FilterOption[] options(){ public FilterOption[] options(){
return Structs.arr( return Structs.arr(
new SliderOption("amount", () -> amount, f -> amount = (int)f, 1, 10).display() //disabled until necessary
// SliderOption("amount", () -> amount, f -> amount = (int)f, 1, 10).display()
); );
} }
@@ -23,7 +23,7 @@ public class CoreSpawnFilter extends GenerateFilter{
public void apply(Tiles tiles, GenerateInput in){ public void apply(Tiles tiles, GenerateInput in){
IntArray spawns = new IntArray(); IntArray spawns = new IntArray();
for(Tile tile : tiles){ for(Tile tile : tiles){
if(tile.team() == state.rules.defaultTeam && tile.block() instanceof CoreBlock){ if(tile.team() == state.rules.defaultTeam && tile.block() instanceof CoreBlock && tile.isCenter()){
spawns.add(tile.pos()); spawns.add(tile.pos());
} }
} }

View File

@@ -24,8 +24,9 @@ public class FileMapGenerator implements WorldGenerator{
public void generate(Tiles tiles){ public void generate(Tiles tiles){
if(map == null) throw new RuntimeException("Generator has null map, cannot be used."); if(map == null) throw new RuntimeException("Generator has null map, cannot be used.");
SaveIO.load(map.file); world.setGenerating(false);
world.beginMapLoad(); SaveIO.load(map.file, world.filterContext(map));
world.setGenerating(true);
tiles = world.tiles; tiles = world.tiles;
@@ -52,14 +53,14 @@ public class FileMapGenerator implements WorldGenerator{
}); });
} }
if(tile.block() instanceof CoreBlock && tile.team() == state.rules.defaultTeam && !anyCores){ if(tile.isCenter() && tile.block() instanceof CoreBlock && tile.team() == state.rules.defaultTeam && !anyCores){
//TODO PLACE THE (CORRECT) LOADOUT //TODO PLACE THE (CORRECT) LOADOUT
Schematics.placeLoadout(Loadouts.basicShard, tile.x, tile.y); Schematics.placeLoadout(Loadouts.basicShard, tile.x, tile.y);
anyCores = true; anyCores = true;
} }
//add random decoration //add random decoration
if(Mathf.chance(0.01) && !tile.floor().isLiquid && tile.block() == Blocks.air){ if(Mathf.chance(0.015) && !tile.floor().isLiquid && tile.block() == Blocks.air){
tile.setBlock(tile.floor().decoration); tile.setBlock(tile.floor().decoration);
} }
} }

View File

@@ -58,7 +58,7 @@ public class Sector{
return Vars.state.isGame() && Vars.state.rules.sector == this && !Vars.state.launched && !Vars.state.gameOver; return Vars.state.isGame() && Vars.state.rules.sector == this && !Vars.state.launched && !Vars.state.gameOver;
} }
/** @return whether waves are present, e.g. any bases here will be attacked. */ /** @return whether waves are present - if true, any bases here will be attacked. */
public boolean hasWaves(){ public boolean hasWaves(){
return save != null && save.meta.rules.waves; return save != null && save.meta.rules.waves;
} }

View File

@@ -285,6 +285,8 @@ public class PlanetDialog extends FloatingDialog{
float stroke = 0.026f; float stroke = 0.026f;
if(sec.hasBase()){ if(sec.hasBase()){
drawSelection(sec, Tmp.c1.set(Team.sharded.color).mul(0.8f).a(selectAlpha), stroke, -0.01f); drawSelection(sec, Tmp.c1.set(Team.sharded.color).mul(0.8f).a(selectAlpha), stroke, -0.01f);
}else if(sec.preset != null){
drawSelection(sec, Tmp.c1.set(Team.derelict.color).mul(0.8f).a(selectAlpha), stroke, -0.02f);
}else if(sec.hasEnemyBase()){ }else if(sec.hasEnemyBase()){
drawSelection(sec, Tmp.c1.set(Team.crux.color).mul(0.8f).a(selectAlpha), stroke, -0.02f); drawSelection(sec, Tmp.c1.set(Team.crux.color).mul(0.8f).a(selectAlpha), stroke, -0.02f);
} }

View File

@@ -49,6 +49,7 @@ public class HudFragment extends Fragment{
showToast("New turn: [accent]" + universe.getTurn() + "[]" + (attacked > 0 ? "\n[scarlet]" + Iconc.warning + " " + attacked + " sectors attacked!": "")); showToast("New turn: [accent]" + universe.getTurn() + "[]" + (attacked > 0 ? "\n[scarlet]" + Iconc.warning + " " + attacked + " sectors attacked!": ""));
}); });
//TODO tear this all down
//menu at top left //menu at top left
parent.fill(cont -> { parent.fill(cont -> {
cont.setName("overlaymarker"); cont.setName("overlaymarker");
@@ -133,6 +134,13 @@ public class HudFragment extends Fragment{
cont.row(); cont.row();
} }
//TODO BUTTONS FOR VIEWING EXPORTS/IMPORTS/RESEARCH
/*
cont.table(t -> {
});
cont.row();*/
cont.update(() -> { cont.update(() -> {
if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.shown() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){ if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.shown() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){
toggleMenus(); toggleMenus();

View File

@@ -36,7 +36,7 @@ def transformColors = { List<List<String>> list ->
transformColors([["6e7080", "989aa4", "b0bac0"], ["bc5452", "ea8878", "feb380"], ["de9458", "f8c266", "ffe18f"], ["feb380", "ea8878", "bc5452"]]) transformColors([["6e7080", "989aa4", "b0bac0"], ["bc5452", "ea8878", "feb380"], ["de9458", "f8c266", "ffe18f"], ["feb380", "ea8878", "bc5452"]])
def antialias = { File file -> def antialias = { File file ->
if(!doAntialias || file.lastModified() <= 1000) return if(!doAntialias) return
def image = ImageIO.read(file) def image = ImageIO.read(file)
def out = ImageIO.read(file) def out = ImageIO.read(file)
@@ -319,9 +319,9 @@ task pack(dependsOn: classes){
} }
} }
executor.shutdown(); executor.shutdown()
try{ try{
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)
}catch(InterruptedException e){ }catch(InterruptedException e){
e.printStackTrace() e.printStackTrace()
} }