Bugfixes / Sector preset cleanup
This commit is contained in:
@@ -1836,13 +1836,15 @@ public class Blocks implements ContentList{
|
||||
consumes.power(6f);
|
||||
}};
|
||||
|
||||
//TODO remove later
|
||||
/*
|
||||
coreSilo = new CoreLauncher("core-silo"){{
|
||||
requirements(Category.effect, BuildVisibility.campaignOnly, ItemStack.with(Items.copper, 350, Items.silicon, 140, Items.lead, 200, Items.titanium, 150));
|
||||
size = 5;
|
||||
itemCapacity = 500;
|
||||
|
||||
consumes.items(ItemStack.with(Items.copper, 500));
|
||||
}};
|
||||
}};*/
|
||||
|
||||
dataProcessor = new ResearchBlock("data-processor"){{
|
||||
requirements(Category.effect, BuildVisibility.campaignOnly, ItemStack.with(Items.copper, 200, Items.lead, 100));
|
||||
|
||||
@@ -4,10 +4,8 @@ import mindustry.ctype.*;
|
||||
import mindustry.game.Objectives.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
import static arc.struct.Seq.with;
|
||||
import static mindustry.content.Items.*;
|
||||
import static mindustry.content.Planets.starter;
|
||||
import static mindustry.type.ItemStack.list;
|
||||
import static arc.struct.Seq.*;
|
||||
import static mindustry.content.Planets.*;
|
||||
|
||||
public class SectorPresets implements ContentList{
|
||||
public static SectorPreset
|
||||
@@ -20,8 +18,6 @@ public class SectorPresets implements ContentList{
|
||||
public void load(){
|
||||
|
||||
groundZero = new SectorPreset("groundZero", starter, 15){{
|
||||
baseLaunchCost = list(copper, -60);
|
||||
startingItems = list(copper, 60);
|
||||
alwaysUnlocked = true;
|
||||
conditionWave = 5;
|
||||
launchPeriod = 5;
|
||||
@@ -31,8 +27,6 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
saltFlats = new SectorPreset("saltFlats", starter, 101){{
|
||||
startingItems = list(copper, 200, silicon, 200, lead, 200);
|
||||
loadout = Loadouts.basicFoundation;
|
||||
conditionWave = 10;
|
||||
launchPeriod = 5;
|
||||
requirements = with(
|
||||
@@ -45,8 +39,6 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
frozenForest = new SectorPreset("frozenForest", starter, 86){{
|
||||
loadout = Loadouts.basicFoundation;
|
||||
startingItems = list(copper, 250);
|
||||
conditionWave = 10;
|
||||
requirements = with(
|
||||
new SectorWave(groundZero, 10),
|
||||
@@ -56,7 +48,6 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
craters = new SectorPreset("craters", starter, 18){{
|
||||
startingItems = list(copper, 100);
|
||||
conditionWave = 10;
|
||||
requirements = with(
|
||||
new SectorWave(frozenForest, 10),
|
||||
@@ -66,8 +57,6 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
ruinousShores = new SectorPreset("ruinousShores", starter, 19){{
|
||||
loadout = Loadouts.basicFoundation;
|
||||
startingItems = list(copper, 140, lead, 50);
|
||||
conditionWave = 20;
|
||||
launchPeriod = 20;
|
||||
requirements = with(
|
||||
@@ -81,8 +70,6 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
stainedMountains = new SectorPreset("stainedMountains", starter, 20){{
|
||||
loadout = Loadouts.basicFoundation;
|
||||
startingItems = list(copper, 200, lead, 50);
|
||||
conditionWave = 10;
|
||||
launchPeriod = 10;
|
||||
requirements = with(
|
||||
@@ -94,7 +81,6 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
fungalPass = new SectorPreset("fungalPass", starter, 21){{
|
||||
startingItems = list(copper, 250, lead, 250, Items.metaglass, 100, Items.graphite, 100);
|
||||
requirements = with(
|
||||
new SectorWave(stainedMountains, 15),
|
||||
//new Unlock(Blocks.daggerFactory),
|
||||
@@ -105,10 +91,8 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
overgrowth = new SectorPreset("overgrowth", starter, 22){{
|
||||
startingItems = list(copper, 1500, lead, 1000, Items.silicon, 500, Items.metaglass, 250);
|
||||
conditionWave = 12;
|
||||
launchPeriod = 4;
|
||||
loadout = Loadouts.basicNucleus;
|
||||
requirements = with(
|
||||
new SectorWave(craters, 40),
|
||||
new Launched(fungalPass),
|
||||
@@ -120,8 +104,6 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
tarFields = new SectorPreset("tarFields", starter, 23){{
|
||||
loadout = Loadouts.basicFoundation;
|
||||
startingItems = list(copper, 250, lead, 100);
|
||||
conditionWave = 15;
|
||||
launchPeriod = 10;
|
||||
requirements = with(
|
||||
@@ -133,8 +115,6 @@ public class SectorPresets implements ContentList{
|
||||
}};
|
||||
|
||||
desolateRift = new SectorPreset("desolateRift", starter, 123){{
|
||||
loadout = Loadouts.basicNucleus;
|
||||
startingItems = list(copper, 1000, lead, 1000, Items.graphite, 250, titanium, 250, Items.silicon, 250);
|
||||
conditionWave = 3;
|
||||
launchPeriod = 2;
|
||||
requirements = with(
|
||||
@@ -146,8 +126,6 @@ public class SectorPresets implements ContentList{
|
||||
|
||||
|
||||
nuclearComplex = new SectorPreset("nuclearComplex", starter, 130){{
|
||||
loadout = Loadouts.basicNucleus;
|
||||
startingItems = list(copper, 1250, lead, 1500, Items.silicon, 400, Items.metaglass, 250);
|
||||
conditionWave = 30;
|
||||
launchPeriod = 15;
|
||||
requirements = with(
|
||||
|
||||
@@ -71,6 +71,12 @@ public class TechTree implements ContentList{
|
||||
});
|
||||
});
|
||||
|
||||
node(coreFoundation, () -> {
|
||||
node(coreNucleus, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
node(duo, () -> {
|
||||
node(scatter, () -> {
|
||||
node(hail, () -> {
|
||||
|
||||
@@ -5,11 +5,10 @@ import arc.func.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Objectives.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.maps.generators.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@@ -23,12 +22,6 @@ public class SectorPreset extends UnlockableContent{
|
||||
public Cons<Rules> rules = rules -> {};
|
||||
public int conditionWave = Integer.MAX_VALUE;
|
||||
public int launchPeriod = 10;
|
||||
public Schematic loadout = Loadouts.basicShard;
|
||||
|
||||
protected Seq<ItemStack> baseLaunchCost = new Seq<>();
|
||||
protected Seq<ItemStack> startingItems = new Seq<>();
|
||||
protected Seq<ItemStack> launchCost;
|
||||
protected Seq<ItemStack> defaultStartingItems = new Seq<>();
|
||||
|
||||
public SectorPreset(String name, Planet planet, int sector){
|
||||
super(name);
|
||||
@@ -51,42 +44,11 @@ public class SectorPreset extends UnlockableContent{
|
||||
return unlocked() || !requirements.contains(r -> !r.complete());
|
||||
}
|
||||
|
||||
public Seq<ItemStack> getLaunchCost(){
|
||||
if(launchCost == null){
|
||||
updateLaunchCost();
|
||||
}
|
||||
return launchCost;
|
||||
}
|
||||
|
||||
public Seq<ItemStack> getStartingItems(){
|
||||
return startingItems;
|
||||
}
|
||||
|
||||
public void resetStartingItems(){
|
||||
startingItems.clear();
|
||||
defaultStartingItems.each(stack -> startingItems.add(new ItemStack(stack.item, stack.amount)));
|
||||
}
|
||||
|
||||
public boolean hasLaunched(){
|
||||
//TODO implement
|
||||
return Core.settings.getBool(name + "-launched", false);
|
||||
}
|
||||
|
||||
public void setLaunched(){
|
||||
updateObjectives(() -> {
|
||||
Core.settings.put(name + "-launched", true);
|
||||
});
|
||||
}
|
||||
|
||||
public void updateWave(int wave){
|
||||
int value = Core.settings.getInt(name + "-wave", 0);
|
||||
|
||||
if(value < wave){
|
||||
updateObjectives(() -> {
|
||||
Core.settings.put(name + "-wave", wave);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void updateObjectives(Runnable closure){
|
||||
Seq<SectorObjective> incomplete = content.sectors()
|
||||
.flatMap(z -> z.requirements)
|
||||
@@ -101,6 +63,7 @@ public class SectorPreset extends UnlockableContent{
|
||||
}
|
||||
|
||||
public int bestWave(){
|
||||
//TODO implement
|
||||
return Core.settings.getInt(name + "-wave", 0);
|
||||
}
|
||||
|
||||
@@ -109,30 +72,6 @@ public class SectorPreset extends UnlockableContent{
|
||||
return bestWave() >= conditionWave;
|
||||
}
|
||||
|
||||
public void updateLaunchCost(){
|
||||
Seq<ItemStack> stacks = new Seq<>();
|
||||
|
||||
Cons<ItemStack> adder = stack -> {
|
||||
for(ItemStack other : stacks){
|
||||
if(other.item == stack.item){
|
||||
other.amount += stack.amount;
|
||||
return;
|
||||
}
|
||||
}
|
||||
stacks.add(new ItemStack(stack.item, stack.amount));
|
||||
};
|
||||
|
||||
for(ItemStack stack : baseLaunchCost) adder.get(stack);
|
||||
for(ItemStack stack : startingItems) adder.get(stack);
|
||||
|
||||
for(ItemStack stack : stacks){
|
||||
if(stack.amount < 0) stack.amount = 0;
|
||||
}
|
||||
|
||||
stacks.sort();
|
||||
launchCost = stacks;
|
||||
}
|
||||
|
||||
/** Whether this zone has met its condition; if true, the player can leave. */
|
||||
public boolean metCondition(){
|
||||
//players can't leave in attack mode.
|
||||
@@ -143,13 +82,6 @@ public class SectorPreset extends UnlockableContent{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
for(ItemStack stack : startingItems){
|
||||
defaultStartingItems.add(new ItemStack(stack.item, stack.amount));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden(){
|
||||
return true;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ResearchBlock extends Block{
|
||||
|
||||
//check if it has been researched
|
||||
if(researching.progress >= researching.time){
|
||||
researching.content.unlocked();
|
||||
researching.content.unlock();
|
||||
|
||||
setTo(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user