Massive TechTree system cleanup

This commit is contained in:
Anuken
2021-11-28 13:48:06 -05:00
parent c1477e1f2f
commit 30e2d52341
22 changed files with 755 additions and 782 deletions

View File

@@ -34,7 +34,7 @@ import mindustry.world.meta.*;
import static mindustry.type.ItemStack.*;
public class Blocks implements ContentList{
public class Blocks{
public static Block
//environment
@@ -131,8 +131,7 @@ public class Blocks implements ContentList{
@Deprecated
public static Block blockForge, blockLoader, blockUnloader;
@Override
public void load(){
public static void load(){
//region environment
air = new AirBlock("air");

View File

@@ -1,12 +1,11 @@
package mindustry.content;
import arc.graphics.*;
import mindustry.ctype.*;
import mindustry.entities.bullet.*;
import mindustry.entities.effect.*;
import mindustry.graphics.*;
public class Bullets implements ContentList{
public class Bullets{
public static BulletType
//artillery
@@ -31,8 +30,7 @@ public class Bullets implements ContentList{
//environment, misc.
damageLightning, damageLightningGround, fireball, basicFlame, pyraFlame;
@Override
public void load(){
public static void load(){
//lightning bullets need to be initialized first.
damageLightning = new BulletType(0.0001f, 0f){{

View File

@@ -0,0 +1,31 @@
package mindustry.content;
import static mindustry.content.Blocks.*;
import static mindustry.content.TechTree.*;
public class ErekirTechTree{
public static void load(){
rootErekir = node(coreBastion, () -> {
node(duct, () -> {
node(ductRouter, () -> {
node(ductBridge, () -> {
node(surgeConveyor, () -> {
node(surgeRouter);
});
});
node(overflowDuct, () -> {
});
node(reinforcedContainer, () -> {
node(reinforcedVault, () -> {
});
});
});
});
});
}
}

View File

@@ -1,17 +1,15 @@
package mindustry.content;
import arc.graphics.*;
import mindustry.ctype.*;
import mindustry.type.*;
public class Items implements ContentList{
public class Items{
public static Item
scrap, copper, lead, graphite, coal, titanium, thorium, silicon, plastanium,
phaseFabric, surgeAlloy, sporePod, sand, blastCompound, pyratite, metaglass,
beryllium, tungsten, oxide, carbide, fissileMatter, dormantCyst;
@Override
public void load(){
public static void load(){
copper = new Item("copper", Color.valueOf("d99d73")){{
hardness = 1;
cost = 0.5f;

View File

@@ -1,16 +1,14 @@
package mindustry.content;
import arc.graphics.*;
import mindustry.ctype.*;
import mindustry.type.*;
public class Liquids implements ContentList{
public class Liquids{
public static Liquid water, slag, oil, cryofluid, neoplasm,
gallium,
ozone, hydrogen, nitrogen, cyanogen;
@Override
public void load(){
public static void load(){
water = new Liquid("water", Color.valueOf("596ab8")){{
heatCapacity = 0.4f;

View File

@@ -3,15 +3,14 @@ package mindustry.content;
import mindustry.ctype.*;
import mindustry.game.*;
public class Loadouts implements ContentList{
public class Loadouts{
public static Schematic
basicShard,
basicFoundation,
basicNucleus,
basicBastion;
@Override
public void load(){
public static void load(){
basicShard = Schematics.readBase64("bXNjaAB4nD2K2wqAIBiD5ymibnoRn6YnEP1BwUMoBL19FuJ2sbFvUFgYZDaJsLeQrkinN9UJHImsNzlYE7WrIUastuSbnlKx2VJJt+8IQGGKdfO/8J5yrGJSMegLg+YUIA==");
basicFoundation = Schematics.readBase64("bXNjaAB4nD1OSQ6DMBBzFhVu8BG+0X8MQyoiJTNSukj8nlCi2Adbtg/GA4OBF8oB00rvyE/9ykafqOIw58A7SWRKy1ZiShhZ5RcOLZhYS1hefQ1gRIeptH9jq/qW2lvc1d2tgWsOfVX/tOwE86AYBA==");
basicNucleus = Schematics.readBase64("bXNjaAB4nD2MUQqAIBBEJy0s6qOLdJXuYNtCgikYBd2+LNmdj308hkGHtkId7M4YFns4mk/yfB4a48602eDI+mlNznu0FMPFd0wYKCaewl8F0EOueqM+yKSLVfJrNKWnSw/FZGzEGXFG9sy/px4gEBW1");

View File

@@ -6,7 +6,6 @@ import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import mindustry.ctype.*;
import mindustry.graphics.*;
import mindustry.graphics.g3d.*;
import mindustry.graphics.g3d.PlanetGrid.*;
@@ -14,15 +13,14 @@ import mindustry.maps.planet.*;
import mindustry.type.*;
import mindustry.world.*;
public class Planets implements ContentList{
public class Planets{
public static Planet
sun,
erekir,
tantros,
serpulo;
@Override
public void load(){
public static void load(){
sun = new Planet("sun", null, 4f){{
bloom = true;
accessible = false;
@@ -104,7 +102,7 @@ public class Planets implements ContentList{
});
}
private void makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){
private static void makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){
new Planet(name, parent, 0.12f){{
hasAtmosphere = false;
alwaysUnlocked = true; //for testing only!

View File

@@ -5,7 +5,7 @@ import mindustry.type.*;
import static mindustry.content.Planets.*;
public class SectorPresets implements ContentList{
public class SectorPresets{
public static SectorPreset
groundZero,
craters, biomassFacility, frozenForest, ruinousShores, windsweptIslands, stainedMountains, tarFields,
@@ -13,8 +13,7 @@ public class SectorPresets implements ContentList{
impact0078, desolateRift, nuclearComplex, planetaryTerminal,
coastline, navalFortress;
@Override
public void load(){
public static void load(){
//region serpulo
groundZero = new SectorPreset("groundZero", serpulo, 15){{

View File

@@ -0,0 +1,651 @@
package mindustry.content;
import arc.struct.*;
import mindustry.game.Objectives.*;
import static mindustry.content.Blocks.*;
import static mindustry.content.SectorPresets.*;
import static mindustry.content.SectorPresets.craters;
import static mindustry.content.TechTree.*;
import static mindustry.content.UnitTypes.*;
public class SerpuloTechTree{
public static void load(){
root = node(coreShard, () -> {
node(conveyor, () -> {
node(junction, () -> {
node(router, () -> {
node(launchPad, Seq.with(new SectorComplete(extractionOutpost)), () -> {
node(interplanetaryAccelerator, Seq.with(new SectorComplete(planetaryTerminal)), () -> {
});
});
node(distributor);
node(sorter, () -> {
node(invertedSorter);
node(overflowGate, () -> {
node(underflowGate);
});
});
node(container, Seq.with(new SectorComplete(biomassFacility)), () -> {
node(unloader);
node(vault, Seq.with(new SectorComplete(stainedMountains)), () -> {
});
});
node(itemBridge, () -> {
node(titaniumConveyor, Seq.with(new SectorComplete(craters)), () -> {
node(phaseConveyor, () -> {
node(massDriver, () -> {
node(payloadPropulsionTower, () -> {
});
});
});
node(payloadConveyor, () -> {
node(payloadRouter, () -> {
});
});
node(armoredConveyor, () -> {
node(plastaniumConveyor, () -> {
});
});
});
});
});
});
});
node(coreFoundation, () -> {
node(coreNucleus, () -> {
});
});
node(mechanicalDrill, () -> {
node(mechanicalPump, () -> {
node(conduit, () -> {
node(liquidJunction, () -> {
node(liquidRouter, () -> {
node(liquidContainer, () -> {
node(liquidTank);
});
node(bridgeConduit);
node(pulseConduit, Seq.with(new SectorComplete(windsweptIslands)), () -> {
node(phaseConduit, () -> {
});
node(platedConduit, () -> {
});
node(rotaryPump, () -> {
node(impulsePump, () -> {
});
});
});
});
});
});
});
node(graphitePress, () -> {
node(pneumaticDrill, Seq.with(new SectorComplete(frozenForest)), () -> {
node(cultivator, Seq.with(new SectorComplete(biomassFacility)), () -> {
});
node(laserDrill, () -> {
node(blastDrill, Seq.with(new SectorComplete(nuclearComplex)), () -> {
});
node(waterExtractor, Seq.with(new SectorComplete(saltFlats)), () -> {
node(oilExtractor, () -> {
});
});
});
});
node(pyratiteMixer, () -> {
node(blastMixer, () -> {
});
});
node(siliconSmelter, () -> {
node(sporePress, () -> {
node(coalCentrifuge, () -> {
node(multiPress, () -> {
node(siliconCrucible, () -> {
});
});
});
node(plastaniumCompressor, Seq.with(new SectorComplete(windsweptIslands)), () -> {
node(phaseWeaver, Seq.with(new SectorComplete(tarFields)), () -> {
});
});
});
node(kiln, Seq.with(new SectorComplete(craters)), () -> {
node(pulverizer, () -> {
node(incinerator, () -> {
node(melter, () -> {
node(surgeSmelter, () -> {
});
node(separator, () -> {
node(disassembler, () -> {
});
});
node(cryofluidMixer, () -> {
});
});
});
});
});
node(microProcessor, () -> {
node(switchBlock, () -> {
node(message, () -> {
node(logicDisplay, () -> {
node(largeLogicDisplay, () -> {
});
});
node(memoryCell, () -> {
node(memoryBank, () -> {
});
});
});
node(logicProcessor, () -> {
node(hyperProcessor, () -> {
});
});
});
});
node(illuminator, () -> {
});
});
});
node(combustionGenerator, Seq.with(new Research(Items.coal)), () -> {
node(powerNode, () -> {
node(powerNodeLarge, () -> {
node(diode, () -> {
node(surgeTower, () -> {
});
});
});
node(battery, () -> {
node(batteryLarge, () -> {
});
});
node(mender, () -> {
node(mendProjector, () -> {
node(forceProjector, Seq.with(new SectorComplete(impact0078)), () -> {
node(overdriveProjector, Seq.with(new SectorComplete(impact0078)), () -> {
node(overdriveDome, Seq.with(new SectorComplete(impact0078)), () -> {
});
});
});
node(repairPoint, () -> {
node(repairTurret, () -> {
});
});
});
});
node(steamGenerator, Seq.with(new SectorComplete(craters)), () -> {
node(thermalGenerator, () -> {
node(differentialGenerator, () -> {
node(thoriumReactor, Seq.with(new Research(Liquids.cryofluid)), () -> {
node(impactReactor, () -> {
});
node(rtgGenerator, () -> {
});
});
});
});
});
node(solarPanel, () -> {
node(largeSolarPanel, () -> {
});
});
});
});
});
node(duo, () -> {
node(copperWall, () -> {
node(copperWallLarge, () -> {
node(titaniumWall, () -> {
node(titaniumWallLarge);
node(door, () -> {
node(doorLarge);
});
node(plastaniumWall, () -> {
node(plastaniumWallLarge, () -> {
});
});
node(thoriumWall, () -> {
node(thoriumWallLarge);
node(surgeWall, () -> {
node(surgeWallLarge);
node(phaseWall, () -> {
node(phaseWallLarge);
});
});
});
});
});
});
node(scatter, () -> {
node(hail, Seq.with(new SectorComplete(craters)), () -> {
node(salvo, () -> {
node(swarmer, () -> {
node(cyclone, () -> {
node(spectre, Seq.with(new SectorComplete(nuclearComplex)), () -> {
});
});
});
node(ripple, () -> {
node(fuse, () -> {
});
});
});
});
});
node(scorch, () -> {
node(arc, () -> {
node(wave, () -> {
node(parallax, () -> {
node(segment, () -> {
});
});
node(tsunami, () -> {
});
});
node(lancer, () -> {
node(meltdown, () -> {
node(foreshadow, () -> {
});
});
node(shockMine, () -> {
});
});
});
});
});
node(groundFactory, () -> {
node(commandCenter, () -> {
});
node(dagger, () -> {
node(mace, () -> {
node(fortress, () -> {
node(scepter, () -> {
node(reign, () -> {
});
});
});
});
node(nova, () -> {
node(pulsar, () -> {
node(quasar, () -> {
node(vela, () -> {
node(corvus, () -> {
});
});
});
});
});
node(crawler, () -> {
node(atrax, () -> {
node(spiroct, () -> {
node(arkyid, () -> {
node(toxopid, () -> {
});
});
});
});
});
});
node(airFactory, () -> {
node(flare, () -> {
node(horizon, () -> {
node(zenith, () -> {
node(antumbra, () -> {
node(eclipse, () -> {
});
});
});
});
node(mono, () -> {
node(poly, () -> {
node(mega, () -> {
node(quad, () -> {
node(oct, () -> {
});
});
});
});
});
});
node(navalFactory, Seq.with(new SectorComplete(ruinousShores)), () -> {
node(risso, () -> {
node(minke, () -> {
node(bryde, () -> {
node(sei, () -> {
node(omura, () -> {
});
});
});
});
node(retusa, Seq.with(new SectorComplete(windsweptIslands)), () -> {
node(oxynoe, Seq.with(new SectorComplete(coastline)), () -> {
node(cyerce, () -> {
node(aegires, () -> {
node(navanax, Seq.with(new SectorComplete(navalFortress)), () -> {
});
});
});
});
});
});
});
});
node(additiveReconstructor, Seq.with(new SectorComplete(biomassFacility)), () -> {
node(multiplicativeReconstructor, () -> {
node(exponentialReconstructor, Seq.with(new SectorComplete(overgrowth)), () -> {
node(tetrativeReconstructor, () -> {
});
});
});
});
});
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(kiln),
new Research(mechanicalPump)
), () -> {
node(windsweptIslands, Seq.with(
new SectorComplete(ruinousShores),
new Research(pneumaticDrill),
new Research(hail),
new Research(siliconSmelter),
new Research(steamGenerator)
), () -> {
node(tarFields, Seq.with(
new SectorComplete(windsweptIslands),
new Research(coalCentrifuge),
new Research(conduit),
new Research(wave)
), () -> {
node(impact0078, Seq.with(
new SectorComplete(tarFields),
new Research(Items.thorium),
new Research(lancer),
new Research(salvo),
new Research(coreFoundation)
), () -> {
node(desolateRift, Seq.with(
new SectorComplete(impact0078),
new Research(thermalGenerator),
new Research(thoriumReactor),
new Research(coreNucleus)
), () -> {
node(planetaryTerminal, Seq.with(
new SectorComplete(desolateRift),
new SectorComplete(nuclearComplex),
new SectorComplete(overgrowth),
new SectorComplete(extractionOutpost),
new SectorComplete(saltFlats),
new Research(risso),
new Research(minke),
new Research(bryde),
new Research(spectre),
new Research(launchPad),
new Research(massDriver),
new Research(impactReactor),
new Research(additiveReconstructor),
new Research(exponentialReconstructor)
), () -> {
});
});
});
});
node(extractionOutpost, Seq.with(
new SectorComplete(stainedMountains),
new SectorComplete(windsweptIslands),
new Research(groundFactory),
new Research(nova),
new Research(airFactory),
new Research(mono)
), () -> {
});
node(saltFlats, Seq.with(
new SectorComplete(windsweptIslands),
new Research(commandCenter),
new Research(groundFactory),
new Research(additiveReconstructor),
new Research(airFactory),
new Research(door)
), () -> {
node(coastline, Seq.with(
new SectorComplete(windsweptIslands),
new Research(navalFactory),
new Research(payloadConveyor)
), () -> {
node(navalFortress, Seq.with(
new SectorComplete(coastline),
new SectorComplete(extractionOutpost),
new Research(oxynoe),
new Research(minke),
new Research(cyclone),
new Research(ripple)
), () -> {
});
});
});
});
});
node(overgrowth, Seq.with(
new SectorComplete(craters),
new SectorComplete(fungalPass),
new Research(cultivator),
new Research(sporePress),
new Research(additiveReconstructor),
new Research(UnitTypes.mace),
new Research(UnitTypes.flare)
), () -> {
});
});
node(biomassFacility, Seq.with(
new SectorComplete(frozenForest),
new Research(powerNode),
new Research(steamGenerator),
new Research(scatter),
new Research(graphitePress)
), () -> {
node(stainedMountains, Seq.with(
new SectorComplete(biomassFacility),
new Research(pneumaticDrill),
new Research(siliconSmelter)
), () -> {
node(fungalPass, Seq.with(
new SectorComplete(stainedMountains),
new Research(groundFactory),
new Research(door)
), () -> {
node(nuclearComplex, Seq.with(
new SectorComplete(fungalPass),
new Research(thermalGenerator),
new Research(laserDrill),
new Research(Items.plastanium),
new Research(swarmer)
), () -> {
});
});
});
});
});
});
nodeProduce(Items.copper, () -> {
nodeProduce(Liquids.water, () -> {
});
nodeProduce(Items.lead, () -> {
nodeProduce(Items.titanium, () -> {
nodeProduce(Liquids.cryofluid, () -> {
});
nodeProduce(Items.thorium, () -> {
nodeProduce(Items.surgeAlloy, () -> {
});
nodeProduce(Items.phaseFabric, () -> {
});
});
});
nodeProduce(Items.metaglass, () -> {
});
});
nodeProduce(Items.sand, () -> {
nodeProduce(Items.scrap, () -> {
nodeProduce(Liquids.slag, () -> {
});
});
nodeProduce(Items.coal, () -> {
nodeProduce(Items.graphite, () -> {
nodeProduce(Items.silicon, () -> {
});
});
nodeProduce(Items.pyratite, () -> {
nodeProduce(Items.blastCompound, () -> {
});
});
nodeProduce(Items.sporePod, () -> {
});
nodeProduce(Liquids.oil, () -> {
nodeProduce(Items.plastanium, () -> {
});
});
});
});
});
});
}
}

View File

@@ -3,20 +3,17 @@ package mindustry.content;
import arc.*;
import arc.graphics.*;
import arc.math.*;
import mindustry.ctype.*;
import mindustry.game.*;
import mindustry.game.EventType.*;
import mindustry.type.*;
import mindustry.game.*;
import mindustry.graphics.*;
import mindustry.type.*;
import static mindustry.Vars.*;
public class StatusEffects implements ContentList{
public class StatusEffects{
public static StatusEffect none, burning, freezing, unmoving, slow, wet, muddy, melting, sapped, tarred, overdrive, overclock, shielded, shocked, blasted, corroded, boss, sporeSlowed, disarmed, electrified, invincible;
@Override
public void load(){
public static void load(){
none = new StatusEffect("none");

View File

@@ -7,705 +7,23 @@ import mindustry.ctype.*;
import mindustry.game.Objectives.*;
import mindustry.type.*;
import static mindustry.content.Blocks.*;
import static mindustry.content.SectorPresets.craters;
import static mindustry.content.SectorPresets.*;
import static mindustry.content.UnitTypes.*;
/** Class for storing a list of TechNodes with some utility tree builder methods; context dependent. See {@link SerpuloTechTree#load} source for example usage. */
public class TechTree{
private static TechNode context = null;
public class TechTree implements ContentList{
static ObjectMap<UnlockableContent, TechNode> map = new ObjectMap<>();
static TechNode context = null;
public static Seq<TechNode> all;
public static Seq<TechNode> all = new Seq<>();
//TODO deprecate and refactor the root system
public static TechNode root, rootErekir;
@Override
public void load(){
setup();
//region serpulo
root = node(coreShard, () -> {
node(conveyor, () -> {
node(junction, () -> {
node(router, () -> {
node(launchPad, Seq.with(new SectorComplete(extractionOutpost)), () -> {
node(interplanetaryAccelerator, Seq.with(new SectorComplete(planetaryTerminal)), () -> {
});
});
node(distributor);
node(sorter, () -> {
node(invertedSorter);
node(overflowGate, () -> {
node(underflowGate);
});
});
node(container, Seq.with(new SectorComplete(biomassFacility)), () -> {
node(unloader);
node(vault, Seq.with(new SectorComplete(stainedMountains)), () -> {
});
});
node(itemBridge, () -> {
node(titaniumConveyor, Seq.with(new SectorComplete(craters)), () -> {
node(phaseConveyor, () -> {
node(massDriver, () -> {
node(payloadPropulsionTower, () -> {
});
});
});
node(payloadConveyor, () -> {
node(payloadRouter, () -> {
});
});
node(armoredConveyor, () -> {
node(plastaniumConveyor, () -> {
});
});
});
});
});
});
});
node(coreFoundation, () -> {
node(coreNucleus, () -> {
});
});
node(mechanicalDrill, () -> {
node(mechanicalPump, () -> {
node(conduit, () -> {
node(liquidJunction, () -> {
node(liquidRouter, () -> {
node(liquidContainer, () -> {
node(liquidTank);
});
node(bridgeConduit);
node(pulseConduit, Seq.with(new SectorComplete(windsweptIslands)), () -> {
node(phaseConduit, () -> {
});
node(platedConduit, () -> {
});
node(rotaryPump, () -> {
node(impulsePump, () -> {
});
});
});
});
});
});
});
node(graphitePress, () -> {
node(pneumaticDrill, Seq.with(new SectorComplete(frozenForest)), () -> {
node(cultivator, Seq.with(new SectorComplete(biomassFacility)), () -> {
});
node(laserDrill, () -> {
node(blastDrill, Seq.with(new SectorComplete(nuclearComplex)), () -> {
});
node(waterExtractor, Seq.with(new SectorComplete(saltFlats)), () -> {
node(oilExtractor, () -> {
});
});
});
});
node(pyratiteMixer, () -> {
node(blastMixer, () -> {
});
});
node(siliconSmelter, () -> {
node(sporePress, () -> {
node(coalCentrifuge, () -> {
node(multiPress, () -> {
node(siliconCrucible, () -> {
});
});
});
node(plastaniumCompressor, Seq.with(new SectorComplete(windsweptIslands)), () -> {
node(phaseWeaver, Seq.with(new SectorComplete(tarFields)), () -> {
});
});
});
node(kiln, Seq.with(new SectorComplete(craters)), () -> {
node(pulverizer, () -> {
node(incinerator, () -> {
node(melter, () -> {
node(surgeSmelter, () -> {
});
node(separator, () -> {
node(disassembler, () -> {
});
});
node(cryofluidMixer, () -> {
});
});
});
});
});
node(microProcessor, () -> {
node(switchBlock, () -> {
node(message, () -> {
node(logicDisplay, () -> {
node(largeLogicDisplay, () -> {
});
});
node(memoryCell, () -> {
node(memoryBank, () -> {
});
});
});
node(logicProcessor, () -> {
node(hyperProcessor, () -> {
});
});
});
});
node(illuminator, () -> {
});
});
});
node(combustionGenerator, Seq.with(new Research(Items.coal)), () -> {
node(powerNode, () -> {
node(powerNodeLarge, () -> {
node(diode, () -> {
node(surgeTower, () -> {
});
});
});
node(battery, () -> {
node(batteryLarge, () -> {
});
});
node(mender, () -> {
node(mendProjector, () -> {
node(forceProjector, Seq.with(new SectorComplete(impact0078)), () -> {
node(overdriveProjector, Seq.with(new SectorComplete(impact0078)), () -> {
node(overdriveDome, Seq.with(new SectorComplete(impact0078)), () -> {
});
});
});
node(repairPoint, () -> {
node(repairTurret, () -> {
});
});
});
});
node(steamGenerator, Seq.with(new SectorComplete(craters)), () -> {
node(thermalGenerator, () -> {
node(differentialGenerator, () -> {
node(thoriumReactor, Seq.with(new Research(Liquids.cryofluid)), () -> {
node(impactReactor, () -> {
});
node(rtgGenerator, () -> {
});
});
});
});
});
node(solarPanel, () -> {
node(largeSolarPanel, () -> {
});
});
});
});
});
node(duo, () -> {
node(copperWall, () -> {
node(copperWallLarge, () -> {
node(titaniumWall, () -> {
node(titaniumWallLarge);
node(door, () -> {
node(doorLarge);
});
node(plastaniumWall, () -> {
node(plastaniumWallLarge, () -> {
});
});
node(thoriumWall, () -> {
node(thoriumWallLarge);
node(surgeWall, () -> {
node(surgeWallLarge);
node(phaseWall, () -> {
node(phaseWallLarge);
});
});
});
});
});
});
node(scatter, () -> {
node(hail, Seq.with(new SectorComplete(craters)), () -> {
node(salvo, () -> {
node(swarmer, () -> {
node(cyclone, () -> {
node(spectre, Seq.with(new SectorComplete(nuclearComplex)), () -> {
});
});
});
node(ripple, () -> {
node(fuse, () -> {
});
});
});
});
});
node(scorch, () -> {
node(arc, () -> {
node(wave, () -> {
node(parallax, () -> {
node(segment, () -> {
});
});
node(tsunami, () -> {
});
});
node(lancer, () -> {
node(meltdown, () -> {
node(foreshadow, () -> {
});
});
node(shockMine, () -> {
});
});
});
});
});
node(groundFactory, () -> {
node(commandCenter, () -> {
});
node(dagger, () -> {
node(mace, () -> {
node(fortress, () -> {
node(scepter, () -> {
node(reign, () -> {
});
});
});
});
node(nova, () -> {
node(pulsar, () -> {
node(quasar, () -> {
node(vela, () -> {
node(corvus, () -> {
});
});
});
});
});
node(crawler, () -> {
node(atrax, () -> {
node(spiroct, () -> {
node(arkyid, () -> {
node(toxopid, () -> {
});
});
});
});
});
});
node(airFactory, () -> {
node(flare, () -> {
node(horizon, () -> {
node(zenith, () -> {
node(antumbra, () -> {
node(eclipse, () -> {
});
});
});
});
node(mono, () -> {
node(poly, () -> {
node(mega, () -> {
node(quad, () -> {
node(oct, () -> {
});
});
});
});
});
});
node(navalFactory, Seq.with(new SectorComplete(ruinousShores)), () -> {
node(risso, () -> {
node(minke, () -> {
node(bryde, () -> {
node(sei, () -> {
node(omura, () -> {
});
});
});
});
node(retusa, Seq.with(new SectorComplete(windsweptIslands)), () -> {
node(oxynoe, Seq.with(new SectorComplete(coastline)), () -> {
node(cyerce, () -> {
node(aegires, () -> {
node(navanax, Seq.with(new SectorComplete(navalFortress)), () -> {
});
});
});
});
});
});
});
});
node(additiveReconstructor, Seq.with(new SectorComplete(biomassFacility)), () -> {
node(multiplicativeReconstructor, () -> {
node(exponentialReconstructor, Seq.with(new SectorComplete(overgrowth)), () -> {
node(tetrativeReconstructor, () -> {
});
});
});
});
});
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(kiln),
new Research(mechanicalPump)
), () -> {
node(windsweptIslands, Seq.with(
new SectorComplete(ruinousShores),
new Research(pneumaticDrill),
new Research(hail),
new Research(siliconSmelter),
new Research(steamGenerator)
), () -> {
node(tarFields, Seq.with(
new SectorComplete(windsweptIslands),
new Research(coalCentrifuge),
new Research(conduit),
new Research(wave)
), () -> {
node(impact0078, Seq.with(
new SectorComplete(tarFields),
new Research(Items.thorium),
new Research(lancer),
new Research(salvo),
new Research(coreFoundation)
), () -> {
node(desolateRift, Seq.with(
new SectorComplete(impact0078),
new Research(thermalGenerator),
new Research(thoriumReactor),
new Research(coreNucleus)
), () -> {
node(planetaryTerminal, Seq.with(
new SectorComplete(desolateRift),
new SectorComplete(nuclearComplex),
new SectorComplete(overgrowth),
new SectorComplete(extractionOutpost),
new SectorComplete(saltFlats),
new Research(risso),
new Research(minke),
new Research(bryde),
new Research(spectre),
new Research(launchPad),
new Research(massDriver),
new Research(impactReactor),
new Research(additiveReconstructor),
new Research(exponentialReconstructor)
), () -> {
});
});
});
});
node(extractionOutpost, Seq.with(
new SectorComplete(stainedMountains),
new SectorComplete(windsweptIslands),
new Research(groundFactory),
new Research(nova),
new Research(airFactory),
new Research(mono)
), () -> {
});
node(saltFlats, Seq.with(
new SectorComplete(windsweptIslands),
new Research(commandCenter),
new Research(groundFactory),
new Research(additiveReconstructor),
new Research(airFactory),
new Research(door)
), () -> {
node(coastline, Seq.with(
new SectorComplete(windsweptIslands),
new Research(navalFactory),
new Research(payloadConveyor)
), () -> {
node(navalFortress, Seq.with(
new SectorComplete(coastline),
new SectorComplete(extractionOutpost),
new Research(oxynoe),
new Research(minke),
new Research(cyclone),
new Research(ripple)
), () -> {
});
});
});
});
});
node(overgrowth, Seq.with(
new SectorComplete(craters),
new SectorComplete(fungalPass),
new Research(cultivator),
new Research(sporePress),
new Research(additiveReconstructor),
new Research(UnitTypes.mace),
new Research(UnitTypes.flare)
), () -> {
});
});
node(biomassFacility, Seq.with(
new SectorComplete(frozenForest),
new Research(powerNode),
new Research(steamGenerator),
new Research(scatter),
new Research(graphitePress)
), () -> {
node(stainedMountains, Seq.with(
new SectorComplete(biomassFacility),
new Research(pneumaticDrill),
new Research(siliconSmelter)
), () -> {
node(fungalPass, Seq.with(
new SectorComplete(stainedMountains),
new Research(groundFactory),
new Research(door)
), () -> {
node(nuclearComplex, Seq.with(
new SectorComplete(fungalPass),
new Research(thermalGenerator),
new Research(laserDrill),
new Research(Items.plastanium),
new Research(swarmer)
), () -> {
});
});
});
});
});
});
nodeProduce(Items.copper, () -> {
nodeProduce(Liquids.water, () -> {
});
nodeProduce(Items.lead, () -> {
nodeProduce(Items.titanium, () -> {
nodeProduce(Liquids.cryofluid, () -> {
});
nodeProduce(Items.thorium, () -> {
nodeProduce(Items.surgeAlloy, () -> {
});
nodeProduce(Items.phaseFabric, () -> {
});
});
});
nodeProduce(Items.metaglass, () -> {
});
});
nodeProduce(Items.sand, () -> {
nodeProduce(Items.scrap, () -> {
nodeProduce(Liquids.slag, () -> {
});
});
nodeProduce(Items.coal, () -> {
nodeProduce(Items.graphite, () -> {
nodeProduce(Items.silicon, () -> {
});
});
nodeProduce(Items.pyratite, () -> {
nodeProduce(Items.blastCompound, () -> {
});
});
nodeProduce(Items.sporePod, () -> {
});
nodeProduce(Liquids.oil, () -> {
nodeProduce(Items.plastanium, () -> {
});
});
});
});
});
});
//endregion
//region erekir
rootErekir = node(coreBastion, () -> {
node(duct, () -> {
node(ductRouter, () -> {
node(ductBridge, () -> {
node(surgeConveyor, () -> {
node(surgeRouter);
});
});
node(overflowDuct, () -> {
});
node(reinforcedContainer, () -> {
node(reinforcedVault, () -> {
});
});
});
});
});
//endregion
}
public static void setup(){
context = null;
map = new ObjectMap<>();
all = new Seq<>();
}
//all the "node" methods are hidden, because they are for internal context-dependent use only
//for custom research, just use the TechNode constructor
static TechNode node(UnlockableContent content, Runnable children){
public static TechNode node(UnlockableContent content, Runnable children){
return node(content, content.researchRequirements(), children);
}
static TechNode node(UnlockableContent content, ItemStack[] requirements, Runnable children){
public static TechNode node(UnlockableContent content, ItemStack[] requirements, Runnable children){
return node(content, requirements, null, children);
}
static TechNode node(UnlockableContent content, ItemStack[] requirements, Seq<Objective> objectives, Runnable children){
public static TechNode node(UnlockableContent content, ItemStack[] requirements, Seq<Objective> objectives, Runnable children){
TechNode node = new TechNode(context, content, requirements);
if(objectives != null){
node.objectives.addAll(objectives);
@@ -719,29 +37,33 @@ public class TechTree implements ContentList{
return node;
}
static TechNode node(UnlockableContent content, Seq<Objective> objectives, Runnable children){
public static TechNode node(UnlockableContent content, Seq<Objective> objectives, Runnable children){
return node(content, content.researchRequirements(), objectives, children);
}
static TechNode node(UnlockableContent block){
public static TechNode node(UnlockableContent block){
return node(block, () -> {});
}
static TechNode nodeProduce(UnlockableContent content, Seq<Objective> objectives, Runnable children){
public static TechNode nodeProduce(UnlockableContent content, Seq<Objective> objectives, Runnable children){
return node(content, content.researchRequirements(), objectives.and(new Produce(content)), children);
}
static TechNode nodeProduce(UnlockableContent content, Runnable children){
public static TechNode nodeProduce(UnlockableContent content, Runnable children){
return nodeProduce(content, new Seq<>(), children);
}
@Nullable
public static TechNode get(UnlockableContent content){
return map.get(content);
/** @deprecated use {@link UnlockableContent#techNode} instead. */
@Deprecated
public static @Nullable TechNode get(UnlockableContent content){
return content.techNode;
}
/** @deprecated use {@link UnlockableContent#techNode} instead. */
@Deprecated
public static TechNode getNotNull(UnlockableContent content){
return map.getThrow(content, () -> new RuntimeException(content + " does not have a tech node"));
if(content.techNode == null) throw new RuntimeException(content + " does not have a tech node");
return content.techNode;
}
public static class TechNode{
@@ -777,7 +99,7 @@ public class TechTree implements ContentList{
}
});
map.put(content, this);
content.techNode = this;
all.add(this);
}

View File

@@ -7,7 +7,6 @@ import arc.math.geom.*;
import arc.struct.*;
import mindustry.ai.types.*;
import mindustry.annotations.Annotations.*;
import mindustry.ctype.*;
import mindustry.entities.*;
import mindustry.entities.abilities.*;
import mindustry.entities.bullet.*;
@@ -24,7 +23,7 @@ import static arc.graphics.g2d.Lines.*;
import static arc.math.Angles.*;
import static mindustry.Vars.*;
public class UnitTypes implements ContentList{
public class UnitTypes{
//region standard
//mech
@@ -76,8 +75,7 @@ public class UnitTypes implements ContentList{
//endregion
@Override
public void load(){
public static void load(){
//region ground attack
dagger = new UnitType("dagger"){{

View File

@@ -2,13 +2,12 @@ package mindustry.content;
import arc.graphics.*;
import arc.util.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.type.weather.*;
import mindustry.world.meta.*;
public class Weathers implements ContentList{
public class Weathers{
public static Weather
rain,
snow,
@@ -17,8 +16,7 @@ public class Weathers implements ContentList{
fog,
suspendParticles;
@Override
public void load(){
public static void load(){
snow = new ParticleWeather("snow"){{
particleRegion = "particle";
sizeMax = 13f;

View File

@@ -30,42 +30,28 @@ public class ContentLoader{
private @Nullable LoadedMod currentMod;
private @Nullable Content lastAdded;
private ObjectSet<Cons<Content>> initialization = new ObjectSet<>();
private ContentList[] content = {
new Items(),
new StatusEffects(),
new Liquids(),
new Bullets(),
new UnitTypes(),
new Blocks(),
new Loadouts(),
new Weathers(),
new Planets(),
new SectorPresets(),
new TechTree(),
};
public ContentLoader(){
clear();
}
/** Clears all initialized content.*/
public void clear(){
contentNameMap = new ObjectMap[ContentType.all.length];
contentMap = new Seq[ContentType.all.length];
initialization = new ObjectSet<>();
for(ContentType type : ContentType.all){
contentMap[type.ordinal()] = new Seq<>();
contentNameMap[type.ordinal()] = new ObjectMap<>();
}
}
/** Creates all base types. */
public void createBaseContent(){
for(ContentList list : content){
list.load();
}
Items.load();
StatusEffects.load();
Liquids.load();
Bullets.load();
UnitTypes.load();
Blocks.load();
Loadouts.load();
Weathers.load();
Planets.load();
SectorPresets.load();
SerpuloTechTree.load();
ErekirTechTree.load();
}
/** Creates mod content, if applicable. */

View File

@@ -307,7 +307,7 @@ public class Logic implements ApplicationListener{
public static void researched(Content content){
if(!(content instanceof UnlockableContent u)) return;
var node = u.node();
var node = u.techNode;
//unlock all direct dependencies on client, permanently
while(node != null){

View File

@@ -1,6 +1,7 @@
package mindustry.ctype;
/** Interface for a list of content to be loaded in {@link mindustry.core.ContentLoader}. */
/** @deprecated single-method interfaces don't need to exist for content loading; just call YouList.load() directly in the order necessary. */
@Deprecated
public interface ContentList{
/** This method should create all the content. */
void load();

View File

@@ -5,7 +5,6 @@ import arc.func.*;
import arc.graphics.g2d.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.content.TechTree.*;
import mindustry.game.EventType.*;
import mindustry.graphics.*;
@@ -35,6 +34,8 @@ public abstract class UnlockableContent extends MappableContent{
public TextureRegion uiIcon;
/** Icon of the full content. Unscaled.*/
public TextureRegion fullIcon;
/** The tech tree node for this content, if applicable. Null if not part of a tech tree. */
public @Nullable TechNode techNode;
/** Unlock state. Loaded from settings. Do not modify outside of the constructor. */
protected boolean unlocked;
@@ -59,12 +60,13 @@ public abstract class UnlockableContent extends MappableContent{
uiIcon = Core.atlas.find(getContentType().name() + "-" + name + "-ui", fullIcon);
}
/** @return the tech node for this content. may be null. */
/** @deprecated use the {@link #techNode} field instead. */
@Deprecated
public @Nullable TechNode node(){
return TechTree.get(this);
return techNode;
}
/** Use fullIcon / uiIcon instead! This will be removed. */
/** @deprecated Use fullIcon / uiIcon instead! This will be removed. */
@Deprecated
public TextureRegion icon(Cicon icon){
return icon == Cicon.full ? fullIcon : uiIcon;

View File

@@ -8,7 +8,6 @@ import arc.util.*;
import arc.util.io.*;
import mindustry.ai.types.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.content.TechTree.*;
import mindustry.ctype.*;
import mindustry.entities.*;
@@ -125,7 +124,7 @@ public class TypeIO{
case 6: short length = read.s(); IntSeq arr = new IntSeq(); for(int i = 0; i < length; i ++) arr.add(read.i()); return arr;
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 9: return TechTree.getNotNull(content.getByID(ContentType.all[read.b()], read.s()));
case 9: return content.<UnlockableContent>getByID(ContentType.all[read.b()], read.s()).techNode;
case 10: return read.bool();
case 11: return read.d();
case 12: return !box ? world.build(read.i()) : new BuildingBox(read.i());

View File

@@ -3,7 +3,6 @@ package mindustry.net;
import arc.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.game.*;
@@ -29,7 +28,7 @@ public class NetworkIO{
state.rules.researched.clear();
for(ContentType type : ContentType.all){
for(Content c : content.getBy(type)){
if(c instanceof UnlockableContent u && u.unlocked() && TechTree.get(u) != null){
if(c instanceof UnlockableContent u && u.unlocked() && u.techNode != null){
state.rules.researched.add(u.name);
}
}

View File

@@ -53,7 +53,7 @@ public class DatabaseDialog extends BaseDialog{
Seq<Content> array = allContent[j]
.select(c -> c instanceof UnlockableContent u &&
(!u.isHidden() || u.node() != null) &&
(!u.isHidden() || u.techNode != null) &&
(text.isEmpty() || u.localizedName.toLowerCase().contains(text.toLowerCase())));
if(array.size == 0) continue;

View File

@@ -297,7 +297,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
if(sector.hasBase() || sector.id == sector.planet.startSector) return true;
//preset sectors can only be selected once unlocked
if(sector.preset != null){
TechNode node = sector.preset.node();
TechNode node = sector.preset.techNode;
return node == null || node.parent == null || node.parent.content.unlocked();
}
@@ -416,7 +416,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
sec.isAttacked() ? Fonts.getLargeIcon("warning") :
!sec.hasBase() && sec.preset != null && sec.preset.unlocked() && preficon == null ?
Fonts.getLargeIcon("terrain") :
sec.preset != null && sec.preset.locked() && sec.preset.node() != null && !sec.preset.node().parent.content.locked() ? Fonts.getLargeIcon("lock") :
sec.preset != null && sec.preset.locked() && sec.preset.techNode != null && !sec.preset.techNode.parent.content.locked() ? Fonts.getLargeIcon("lock") :
preficon;
var color = sec.preset != null && !sec.hasBase() ? Team.derelict.color : Team.sharded.color;
@@ -950,13 +950,13 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stable.image().color(Pal.accent).fillX().height(3f).pad(3f).row();
boolean locked = sector.preset != null && sector.preset.locked() && !sector.hasBase() && sector.preset.node() != null;
boolean locked = sector.preset != null && sector.preset.locked() && !sector.hasBase() && sector.preset.techNode != null;
if(locked){
stable.table(r -> {
r.add("@complete").colspan(2).left();
r.row();
for(Objective o : sector.preset.node().objectives){
for(Objective o : sector.preset.techNode.objectives){
if(o.complete()) continue;
r.add("> " + o.display()).color(Color.lightGray).left();