Added sectors to tech tree / Bugfixes
This commit is contained in:
@@ -466,6 +466,7 @@ complete = [lightgray]Complete:
|
|||||||
requirement.wave = Reach Wave {0} in {1}
|
requirement.wave = Reach Wave {0} in {1}
|
||||||
requirement.core = Destroy Enemy Core in {0}
|
requirement.core = Destroy Enemy Core in {0}
|
||||||
requirement.research = Research {0}
|
requirement.research = Research {0}
|
||||||
|
requirement.capture = Capture {0}
|
||||||
resume = Resume Zone:\n[lightgray]{0}
|
resume = Resume Zone:\n[lightgray]{0}
|
||||||
bestwave = [lightgray]Best Wave: {0}
|
bestwave = [lightgray]Best Wave: {0}
|
||||||
#TODO fix/remove this
|
#TODO fix/remove this
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package mindustry.content;
|
package mindustry.content;
|
||||||
|
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.Objectives.*;
|
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
import static arc.struct.Seq.*;
|
|
||||||
import static mindustry.content.Planets.*;
|
import static mindustry.content.Planets.*;
|
||||||
|
|
||||||
public class SectorPresets implements ContentList{
|
public class SectorPresets implements ContentList{
|
||||||
@@ -29,112 +27,52 @@ public class SectorPresets implements ContentList{
|
|||||||
saltFlats = new SectorPreset("saltFlats", serpulo, 101){{
|
saltFlats = new SectorPreset("saltFlats", serpulo, 101){{
|
||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
launchPeriod = 5;
|
launchPeriod = 5;
|
||||||
requirements = with(
|
|
||||||
new SectorWave(groundZero, 60),
|
|
||||||
//new Unlock(Blocks.daggerFactory),
|
|
||||||
//new Unlock(Blocks.draugFactory),
|
|
||||||
new Research(Blocks.door),
|
|
||||||
new Research(Blocks.waterExtractor)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
frozenForest = new SectorPreset("frozenForest", serpulo, 86){{
|
frozenForest = new SectorPreset("frozenForest", serpulo, 86){{
|
||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
requirements = with(
|
|
||||||
new SectorWave(groundZero, 10),
|
|
||||||
new Research(Blocks.junction),
|
|
||||||
new Research(Blocks.router)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
craters = new SectorPreset("craters", serpulo, 18){{
|
craters = new SectorPreset("craters", serpulo, 18){{
|
||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
requirements = with(
|
|
||||||
new SectorWave(frozenForest, 10),
|
|
||||||
new Research(Blocks.mender),
|
|
||||||
new Research(Blocks.combustionGenerator)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
ruinousShores = new SectorPreset("ruinousShores", serpulo, 19){{
|
ruinousShores = new SectorPreset("ruinousShores", serpulo, 19){{
|
||||||
conditionWave = 20;
|
conditionWave = 20;
|
||||||
launchPeriod = 20;
|
launchPeriod = 20;
|
||||||
requirements = with(
|
|
||||||
new SectorWave(groundZero, 20),
|
|
||||||
new SectorWave(craters, 15),
|
|
||||||
new Research(Blocks.graphitePress),
|
|
||||||
new Research(Blocks.combustionGenerator),
|
|
||||||
new Research(Blocks.kiln),
|
|
||||||
new Research(Blocks.mechanicalPump)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
stainedMountains = new SectorPreset("stainedMountains", serpulo, 20){{
|
stainedMountains = new SectorPreset("stainedMountains", serpulo, 20){{
|
||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
launchPeriod = 10;
|
launchPeriod = 10;
|
||||||
requirements = with(
|
|
||||||
new SectorWave(frozenForest, 15),
|
|
||||||
new Research(Blocks.pneumaticDrill),
|
|
||||||
new Research(Blocks.powerNode),
|
|
||||||
new Research(Blocks.turbineGenerator)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
fungalPass = new SectorPreset("fungalPass", serpulo, 21){{
|
fungalPass = new SectorPreset("fungalPass", serpulo, 21){{
|
||||||
requirements = with(
|
|
||||||
new SectorWave(stainedMountains, 15),
|
|
||||||
//new Unlock(Blocks.daggerFactory),
|
|
||||||
//new Unlock(Blocks.crawlerFactory),
|
|
||||||
new Research(Blocks.door),
|
|
||||||
new Research(Blocks.siliconSmelter)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
overgrowth = new SectorPreset("overgrowth", serpulo, 22){{
|
overgrowth = new SectorPreset("overgrowth", serpulo, 22){{
|
||||||
conditionWave = 12;
|
conditionWave = 12;
|
||||||
launchPeriod = 4;
|
launchPeriod = 4;
|
||||||
requirements = with(
|
|
||||||
new SectorWave(craters, 40),
|
|
||||||
new Launched(fungalPass),
|
|
||||||
new Research(Blocks.cultivator),
|
|
||||||
new Research(Blocks.sporePress)
|
|
||||||
//new Unlock(Blocks.titanFactory),
|
|
||||||
//new Unlock(Blocks.wraithFactory)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
tarFields = new SectorPreset("tarFields", serpulo, 23){{
|
tarFields = new SectorPreset("tarFields", serpulo, 23){{
|
||||||
conditionWave = 15;
|
conditionWave = 15;
|
||||||
launchPeriod = 10;
|
launchPeriod = 10;
|
||||||
requirements = with(
|
|
||||||
new SectorWave(ruinousShores, 20),
|
|
||||||
new Research(Blocks.coalCentrifuge),
|
|
||||||
new Research(Blocks.conduit),
|
|
||||||
new Research(Blocks.wave)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
desolateRift = new SectorPreset("desolateRift", serpulo, 123){{
|
desolateRift = new SectorPreset("desolateRift", serpulo, 123){{
|
||||||
conditionWave = 3;
|
conditionWave = 3;
|
||||||
launchPeriod = 2;
|
launchPeriod = 2;
|
||||||
requirements = with(
|
|
||||||
new SectorWave(tarFields, 20),
|
|
||||||
new Research(Blocks.thermalGenerator),
|
|
||||||
new Research(Blocks.thoriumReactor)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
||||||
nuclearComplex = new SectorPreset("nuclearComplex", serpulo, 130){{
|
nuclearComplex = new SectorPreset("nuclearComplex", serpulo, 130){{
|
||||||
conditionWave = 30;
|
conditionWave = 30;
|
||||||
launchPeriod = 15;
|
launchPeriod = 15;
|
||||||
requirements = with(
|
|
||||||
new Launched(fungalPass),
|
|
||||||
new Research(Blocks.thermalGenerator),
|
|
||||||
new Research(Blocks.laserDrill)
|
|
||||||
);
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
crags = new Zone("crags", new MapGenerator("crags").dist(2f)){{
|
crags = new Zone("crags", new MapGenerator("crags").dist(2f)){{
|
||||||
loadout = Loadouts.basicFoundation;
|
loadout = Loadouts.basicFoundation;
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import mindustry.type.*;
|
|||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
import static mindustry.content.Blocks.*;
|
import static mindustry.content.Blocks.*;
|
||||||
|
import static mindustry.content.SectorPresets.*;
|
||||||
|
import static mindustry.content.SectorPresets.craters;
|
||||||
import static mindustry.content.UnitTypes.*;
|
import static mindustry.content.UnitTypes.*;
|
||||||
import static mindustry.type.ItemStack.*;
|
import static mindustry.type.ItemStack.*;
|
||||||
|
|
||||||
@@ -405,17 +407,87 @@ public class TechTree implements ContentList{
|
|||||||
});
|
});
|
||||||
|
|
||||||
//TODO research sectors
|
//TODO research sectors
|
||||||
/*
|
|
||||||
node(SectorPresets.groundZero, () -> {
|
|
||||||
node(SectorPresets.nuclearComplex, () -> {
|
|
||||||
node(SectorPresets.craters, () -> {
|
|
||||||
node(SectorPresets.saltFlats, () -> {
|
|
||||||
|
|
||||||
|
node(groundZero, () -> {
|
||||||
|
node(frozenForest, Seq.with(
|
||||||
|
new SectorComplete(groundZero),
|
||||||
|
new Research(junction),
|
||||||
|
new Research(router)
|
||||||
|
), () -> {
|
||||||
|
node(craters, Seq.with(
|
||||||
|
new SectorComplete(frozenForest),
|
||||||
|
new Research(mender),
|
||||||
|
new Research(combustionGenerator)
|
||||||
|
), () -> {
|
||||||
|
node(ruinousShores, Seq.with(
|
||||||
|
new SectorComplete(craters),
|
||||||
|
new Research(graphitePress),
|
||||||
|
new Research(combustionGenerator),
|
||||||
|
new Research(kiln),
|
||||||
|
new Research(mechanicalPump)
|
||||||
|
), () -> {
|
||||||
|
|
||||||
|
node(tarFields, Seq.with(
|
||||||
|
new SectorComplete(ruinousShores),
|
||||||
|
new Research(coalCentrifuge),
|
||||||
|
new Research(conduit),
|
||||||
|
new Research(wave)
|
||||||
|
), () -> {
|
||||||
|
node(desolateRift, Seq.with(
|
||||||
|
new SectorComplete(tarFields),
|
||||||
|
new Research(thermalGenerator),
|
||||||
|
new Research(thoriumReactor)
|
||||||
|
), () -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
node(saltFlats, Seq.with(
|
||||||
|
new SectorComplete(ruinousShores),
|
||||||
|
new Research(groundFactory),
|
||||||
|
new Research(airFactory),
|
||||||
|
new Research(door),
|
||||||
|
new Research(waterExtractor)
|
||||||
|
), () -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
node(overgrowth, Seq.with(
|
||||||
|
new SectorComplete(craters),
|
||||||
|
new SectorComplete(fungalPass),
|
||||||
|
new Research(cultivator),
|
||||||
|
new Research(sporePress),
|
||||||
|
new Research(UnitTypes.mace),
|
||||||
|
new Research(UnitTypes.flare)
|
||||||
|
), () -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
node(stainedMountains, Seq.with(
|
||||||
|
new SectorComplete(frozenForest),
|
||||||
|
new Research(pneumaticDrill),
|
||||||
|
new Research(powerNode),
|
||||||
|
new Research(turbineGenerator)
|
||||||
|
), () -> {
|
||||||
|
node(fungalPass, Seq.with(
|
||||||
|
new SectorComplete(stainedMountains),
|
||||||
|
new Research(groundFactory),
|
||||||
|
new Research(door),
|
||||||
|
new Research(siliconSmelter)
|
||||||
|
), () -> {
|
||||||
|
node(nuclearComplex, Seq.with(
|
||||||
|
new SectorComplete(fungalPass),
|
||||||
|
new Research(thermalGenerator),
|
||||||
|
new Research(laserDrill)
|
||||||
|
), () -> {
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,6 +520,12 @@ public class TechTree implements ContentList{
|
|||||||
return new TechNode(content, requirements, children);
|
return new TechNode(content, requirements, children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static TechNode node(UnlockableContent content, Seq<Objective> objectives, Runnable children){
|
||||||
|
TechNode node = new TechNode(content, empty, children);
|
||||||
|
node.objectives = objectives;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
private static TechNode node(UnlockableContent block){
|
private static TechNode node(UnlockableContent block){
|
||||||
return node(block, () -> {});
|
return node(block, () -> {});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,25 @@ public class Objectives{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class SectorComplete extends SectorObjective{
|
||||||
|
|
||||||
|
public SectorComplete(SectorPreset zone){
|
||||||
|
this.preset = zone;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SectorComplete(){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean complete(){
|
||||||
|
return preset.sector.isCaptured();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String display(){
|
||||||
|
return Core.bundle.format("requirement.capture",preset.localizedName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class Launched extends SectorObjective{
|
public static class Launched extends SectorObjective{
|
||||||
|
|
||||||
public Launched(SectorPreset zone){
|
public Launched(SectorPreset zone){
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ public class TypeIO{
|
|||||||
write.b(9);
|
write.b(9);
|
||||||
write.b((byte)map.content.getContentType().ordinal());
|
write.b((byte)map.content.getContentType().ordinal());
|
||||||
write.s(map.content.id);
|
write.s(map.content.id);
|
||||||
|
}else if(object instanceof Boolean){
|
||||||
|
write.b((byte)10);
|
||||||
|
write.bool((Boolean)object);
|
||||||
}else{
|
}else{
|
||||||
throw new IllegalArgumentException("Unknown object type: " + object.getClass());
|
throw new IllegalArgumentException("Unknown object type: " + object.getClass());
|
||||||
}
|
}
|
||||||
@@ -92,6 +95,7 @@ public class TypeIO{
|
|||||||
case 7: return new Point2(read.i(), read.i());
|
case 7: return new Point2(read.i(), read.i());
|
||||||
case 8: byte len = read.b(); Point2[] out = new Point2[len]; for(int i = 0; i < len; i ++) out[i] = Point2.unpack(read.i()); return out;
|
case 8: byte len = read.b(); Point2[] out = new Point2[len]; for(int i = 0; i < len; i ++) out[i] = Point2.unpack(read.i()); return out;
|
||||||
case 9: return TechTree.getNotNull(content.getByID(ContentType.all[read.b()], read.s()));
|
case 9: return TechTree.getNotNull(content.getByID(ContentType.all[read.b()], read.s()));
|
||||||
|
case 10: return read.bool();
|
||||||
default: throw new IllegalArgumentException("Unknown object type: " + type);
|
default: throw new IllegalArgumentException("Unknown object type: " + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class ContentParser{
|
|||||||
return sound;
|
return sound;
|
||||||
});
|
});
|
||||||
put(Objectives.Objective.class, (type, data) -> {
|
put(Objectives.Objective.class, (type, data) -> {
|
||||||
Class<? extends Objectives.Objective> oc = data.has("type") ? resolve(data.getString("type"), "mindustry.game.Objectives") : SectorWave.class;
|
Class<? extends Objectives.Objective> oc = data.has("type") ? resolve(data.getString("type"), "mindustry.game.Objectives") : SectorComplete.class;
|
||||||
data.remove("type");
|
data.remove("type");
|
||||||
Objectives.Objective obj = make(oc);
|
Objectives.Objective obj = make(oc);
|
||||||
readFields(obj, data);
|
readFields(obj, data);
|
||||||
|
|||||||
@@ -4,11 +4,8 @@ import arc.*;
|
|||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.EventType.*;
|
|
||||||
import mindustry.game.Objectives.*;
|
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.maps.generators.*;
|
import mindustry.maps.generators.*;
|
||||||
@@ -20,7 +17,6 @@ public class SectorPreset extends UnlockableContent{
|
|||||||
public @NonNull FileMapGenerator generator;
|
public @NonNull FileMapGenerator generator;
|
||||||
public @NonNull Planet planet;
|
public @NonNull Planet planet;
|
||||||
public @NonNull Sector sector;
|
public @NonNull Sector sector;
|
||||||
public Seq<Objective> requirements = new Seq<>();
|
|
||||||
|
|
||||||
public Cons<Rules> rules = rules -> {};
|
public Cons<Rules> rules = rules -> {};
|
||||||
public int conditionWave = Integer.MAX_VALUE;
|
public int conditionWave = Integer.MAX_VALUE;
|
||||||
@@ -43,28 +39,11 @@ public class SectorPreset extends UnlockableContent{
|
|||||||
return metCondition() && wave % launchPeriod == 0;
|
return metCondition() && wave % launchPeriod == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUnlock(){
|
|
||||||
return unlocked() || !requirements.contains(r -> !r.complete());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasLaunched(){
|
public boolean hasLaunched(){
|
||||||
//TODO implement
|
//TODO implement
|
||||||
return Core.settings.getBool(name + "-launched", false);
|
return Core.settings.getBool(name + "-launched", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateObjectives(Runnable closure){
|
|
||||||
Seq<SectorObjective> incomplete = content.sectors()
|
|
||||||
.flatMap(z -> z.requirements)
|
|
||||||
.filter(o -> o.zone() == this && !o.complete()).as();
|
|
||||||
|
|
||||||
closure.run();
|
|
||||||
for(SectorObjective objective : incomplete){
|
|
||||||
if(objective.complete()){
|
|
||||||
Events.fire(new ZoneRequireCompleteEvent(objective.preset, content.sectors().find(z -> z.requirements.contains(objective)), objective));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int bestWave(){
|
public int bestWave(){
|
||||||
//TODO implement
|
//TODO implement
|
||||||
return Core.settings.getInt(name + "-wave", 0);
|
return Core.settings.getInt(name + "-wave", 0);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import arc.scene.ui.*;
|
|||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
|
import mindustry.content.*;
|
||||||
import mindustry.core.*;
|
import mindustry.core.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
@@ -120,7 +121,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
return mode == launch &&
|
return mode == launch &&
|
||||||
(sector.tile.v.within(launchSector.tile.v, (launchRange + 0.5f) * planets.planet.sectorApproxRadius*2) //within range
|
(sector.tile.v.within(launchSector.tile.v, (launchRange + 0.5f) * planets.planet.sectorApproxRadius*2) //within range
|
||||||
//TODO completely untested
|
//TODO completely untested
|
||||||
|| (sector.preset != null && sector.preset.unlocked() && sector.preset.requirements.contains(r -> r.zone() != null && r.zone() == sector.preset))); //is an unlocked preset
|
|| (sector.preset != null && sector.preset.unlocked() && TechTree.get(sector.preset) != null && TechTree.get(sector.preset).objectives.contains(r -> r.zone() != null && r.zone() == sector.preset))); //is an unlocked preset
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user