Research system changes, unfinished

This commit is contained in:
Anuken
2020-11-14 13:36:43 -05:00
parent 7559996227
commit c96f4609d0
15 changed files with 246 additions and 149 deletions

View File

@@ -486,6 +486,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.produce = Produce {0}
requirement.capture = Capture {0} requirement.capture = Capture {0}
bestwave = [lightgray]Best Wave: {0} bestwave = [lightgray]Best Wave: {0}
launch.text = Launch launch.text = Launch

Binary file not shown.

Binary file not shown.

View File

@@ -46,7 +46,6 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
//debug GL information //debug GL information
Log.info("[GL] Version: @", graphics.getGLVersion()); Log.info("[GL] Version: @", graphics.getGLVersion());
Log.info("[GL] Max texture size: @", Gl.getInt(Gl.maxTextureSize)); Log.info("[GL] Max texture size: @", Gl.getInt(Gl.maxTextureSize));
Log.info("[GL] Max vert/frag shader FP precision: @ / @", Gl.getShaderPrecision(Gl.vertexShader, Gl.highFloat), Gl.getShaderPrecision(Gl.fragmentShader, Gl.highFloat));
Log.info("[GL] Using @ context.", gl30 != null ? "OpenGL 3" : "OpenGL 2"); Log.info("[GL] Using @ context.", gl30 != null ? "OpenGL 3" : "OpenGL 2");
Log.info("[JAVA] Version: @", System.getProperty("java.version")); Log.info("[JAVA] Version: @", System.getProperty("java.version"));

View File

@@ -48,7 +48,7 @@ public class SectorPresets implements ContentList{
windsweptIslands = new SectorPreset("windsweptIslands", serpulo, 246){{ windsweptIslands = new SectorPreset("windsweptIslands", serpulo, 246){{
captureWave = 30; captureWave = 30;
difficulty = 5; difficulty = 4;
}}; }};
stainedMountains = new SectorPreset("stainedMountains", serpulo, 20){{ stainedMountains = new SectorPreset("stainedMountains", serpulo, 20){{

View File

@@ -11,7 +11,6 @@ import static mindustry.content.Blocks.*;
import static mindustry.content.SectorPresets.craters; import static mindustry.content.SectorPresets.craters;
import static mindustry.content.SectorPresets.*; import static mindustry.content.SectorPresets.*;
import static mindustry.content.UnitTypes.*; import static mindustry.content.UnitTypes.*;
import static mindustry.type.ItemStack.*;
public class TechTree implements ContentList{ public class TechTree implements ContentList{
static ObjectMap<UnlockableContent, TechNode> map = new ObjectMap<>(); static ObjectMap<UnlockableContent, TechNode> map = new ObjectMap<>();
@@ -40,9 +39,9 @@ public class TechTree implements ContentList{
node(underflowGate); node(underflowGate);
}); });
}); });
node(container, () -> { node(container, Seq.with(new SectorComplete(biomassFacility)), () -> {
node(unloader); node(unloader);
node(vault, () -> { node(vault, Seq.with(new SectorComplete(stainedMountains)), () -> {
}); });
}); });
@@ -108,185 +107,152 @@ public class TechTree implements ContentList{
}); });
}); });
node(Items.coal, with(Items.lead, 3000), () -> { node(graphitePress, () -> {
node(Items.graphite, with(Items.coal, 1000), () -> { node(pneumaticDrill, () -> {
node(cultivator, Seq.with(new SectorComplete(biomassFacility)), () -> {
node(graphitePress, () -> { });
node(Items.titanium, with(Items.graphite, 3000, Items.copper, 7000, Items.lead, 7000), () -> {
node(pneumaticDrill, () -> {
node(Items.sporePod, with(Items.coal, 4000, Items.graphite, 4000, Items.lead, 4000), () -> {
node(cultivator, Seq.with(new SectorComplete(biomassFacility)), () -> {
}); node(laserDrill, () -> {
}); node(blastDrill, () -> {
node(Items.thorium, with(Items.titanium, 8000, Items.lead, 12000, Items.copper, 20000), () -> {
node(laserDrill, () -> {
node(blastDrill, () -> {
});
node(waterExtractor, () -> {
node(oilExtractor, () -> {
});
});
});
});
});
}); });
node(Items.pyratite, with(Items.coal, 6000, Items.lead, 8000, Items.sand, 4000), () -> { node(waterExtractor, () -> {
node(pyratiteMixer, () -> { node(oilExtractor, () -> {
node(Items.blastCompound, with(Items.pyratite, 3000, Items.sporePod, 3000), () -> {
node(blastMixer, () -> {
});
});
}); });
}); });
node(Items.silicon, with(Items.coal, 3000, Items.sand, 4000), () -> {
node(siliconSmelter, () -> {
node(Liquids.oil, with(Items.coal, 8000, Items.pyratite, 6000, Items.sand, 8000), () -> {
node(sporePress, () -> {
node(coalCentrifuge, () -> {
node(multiPress, () -> {
node(siliconCrucible, () -> {
});
});
});
node(Items.plastanium, with(Items.titanium, 8000, Items.silicon, 8000), () -> {
node(plastaniumCompressor, () -> {
node(Items.phaseFabric, with(Items.thorium, 12000, Items.sand, 8000, Items.silicon, 5000), () -> {
node(phaseWeaver, () -> {
});
});
});
});
});
});
node(Items.metaglass, with(Items.sand, 4000, Items.lead, 10000), () -> {
node(kiln, () -> {
node(incinerator, () -> {
node(Items.scrap, with(Items.copper, 8000, Items.sand, 4000), () -> {
node(Liquids.slag, with(Items.scrap, 4000), () -> {
node(melter, () -> {
node(Items.surgeAlloy, with(Items.thorium, 20000, Items.silicon, 20000, Items.lead, 40000), () -> {
node(surgeSmelter, () -> {
});
});
node(separator, () -> {
node(pulverizer, () -> {
node(disassembler, () -> {
});
});
});
node(Liquids.cryofluid, with(Items.titanium, 8000, Items.metaglass, 4000), () -> {
node(cryofluidMixer, () -> {
});
});
});
});
});
});
});
});
node(microProcessor, () -> {
node(switchBlock, () -> {
node(message, () -> {
node(logicDisplay, () -> {
node(largeLogicDisplay, () -> {
});
});
node(memoryCell, () -> {
node(memoryBank, () -> {
});
});
});
node(logicProcessor, () -> {
node(hyperProcessor, () -> {
});
});
});
});
});
});
node(illuminator, () -> {
});
}); });
}); });
node(pyratiteMixer, () -> {
node(blastMixer, () -> {
node(combustionGenerator, () -> { });
node(powerNode, () -> { });
node(powerNodeLarge, () -> {
node(diode, () -> { node(siliconSmelter, () -> {
node(surgeTower, () -> {
node(sporePress, () -> {
node(coalCentrifuge, () -> {
node(multiPress, () -> {
node(siliconCrucible, () -> {
}); });
}); });
}); });
node(battery, () -> { node(plastaniumCompressor, () -> {
node(batteryLarge, () -> { node(phaseWeaver, () -> {
}); });
}); });
});
node(mender, () -> { node(kiln, Seq.with(new SectorComplete(craters)), () -> {
node(mendProjector, () -> { node(incinerator, () -> {
node(forceProjector, () -> { node(melter, () -> {
node(overdriveProjector, () -> { node(surgeSmelter, () -> {
node(overdriveDome, () -> {
});
node(separator, () -> {
node(pulverizer, () -> {
node(disassembler, () -> {
}); });
}); });
}); });
node(repairPoint, () -> { node(cryofluidMixer, () -> {
}); });
}); });
}); });
});
node(steamGenerator, () -> { node(microProcessor, () -> {
node(thermalGenerator, () -> { node(switchBlock, () -> {
node(differentialGenerator, () -> { node(message, () -> {
node(thoriumReactor, Seq.with(new Research(Liquids.cryofluid)), () -> { node(logicDisplay, () -> {
node(impactReactor, () -> { node(largeLogicDisplay, () -> {
}); });
});
node(rtgGenerator, () -> { 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(steamGenerator, () -> {
node(thermalGenerator, () -> {
node(differentialGenerator, () -> {
node(thoriumReactor, Seq.with(new Research(Liquids.cryofluid)), () -> {
node(impactReactor, () -> {
});
node(rtgGenerator, () -> {
});
}); });
}); });
}); });
}); });
});
node(solarPanel, () -> { node(solarPanel, () -> {
node(largeSolarPanel, () -> { node(largeSolarPanel, () -> {
});
}); });
}); });
}); });
@@ -321,8 +287,7 @@ public class TechTree implements ContentList{
}); });
node(scatter, () -> { node(scatter, () -> {
node(hail, () -> { node(hail, Seq.with(new SectorComplete(craters)), () -> {
node(salvo, () -> { node(salvo, () -> {
node(swarmer, () -> { node(swarmer, () -> {
node(cyclone, () -> { node(cyclone, () -> {
@@ -451,7 +416,7 @@ public class TechTree implements ContentList{
}); });
}); });
node(additiveReconstructor, () -> { node(additiveReconstructor, Seq.with(new SectorComplete(biomassFacility)), () -> {
node(multiplicativeReconstructor, () -> { node(multiplicativeReconstructor, () -> {
node(exponentialReconstructor, () -> { node(exponentialReconstructor, () -> {
node(tetrativeReconstructor, () -> { node(tetrativeReconstructor, () -> {
@@ -525,6 +490,7 @@ public class TechTree implements ContentList{
new SectorComplete(fungalPass), new SectorComplete(fungalPass),
new Research(cultivator), new Research(cultivator),
new Research(sporePress), new Research(sporePress),
new Research(additiveReconstructor),
new Research(UnitTypes.mace), new Research(UnitTypes.mace),
new Research(UnitTypes.flare) new Research(UnitTypes.flare)
), () -> { ), () -> {
@@ -562,6 +528,63 @@ public class TechTree implements ContentList{
}); });
}); });
}); });
nodeProduce(Items.copper, () -> {
nodeProduce(Items.lead, () -> {
nodeProduce(Items.graphite, () -> {
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.silicon, () -> {
});
nodeProduce(Items.pyratite, () -> {
nodeProduce(Items.blastCompound, () -> {
});
});
nodeProduce(Items.sporePod, () -> {
});
nodeProduce(Liquids.oil, () -> {
});
});
});
nodeProduce(Liquids.water, () -> {
});
});
}); });
} }
@@ -604,6 +627,14 @@ public class TechTree implements ContentList{
return node(block, () -> {}); return node(block, () -> {});
} }
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){
return nodeProduce(content, new Seq<>(), children);
}
@Nullable @Nullable
public static TechNode get(UnlockableContent content){ public static TechNode get(UnlockableContent content){
return map.get(content); return map.get(content);

View File

@@ -11,6 +11,7 @@ import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.audio.*; import mindustry.audio.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.content.TechTree.*;
import mindustry.core.GameState.*; import mindustry.core.GameState.*;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
@@ -127,6 +128,14 @@ public class Control implements ApplicationListener, Loadable{
Events.on(UnlockEvent.class, e -> ui.hudfrag.showUnlock(e.content)); Events.on(UnlockEvent.class, e -> ui.hudfrag.showUnlock(e.content));
Events.on(UnlockEvent.class, e -> {
checkAutoUnlocks();
});
Events.on(SectorCaptureEvent.class, e -> {
checkAutoUnlocks();
});
Events.on(BlockBuildEndEvent.class, e -> { Events.on(BlockBuildEndEvent.class, e -> {
if(e.team == player.team()){ if(e.team == player.team()){
if(e.breaking){ if(e.breaking){
@@ -177,6 +186,7 @@ public class Control implements ApplicationListener, Loadable{
app.post(() -> Fx.coreLand.at(core.getX(), core.getY(), 0, core.block)); app.post(() -> Fx.coreLand.at(core.getX(), core.getY(), 0, core.block));
camera.position.set(core); camera.position.set(core);
player.set(core); player.set(core);
Time.run(Fx.coreLand.lifetime, () -> { Time.run(Fx.coreLand.lifetime, () -> {
Fx.launch.at(core); Fx.launch.at(core);
Effect.shake(5f, 5f, core); Effect.shake(5f, 5f, core);
@@ -209,6 +219,17 @@ public class Control implements ApplicationListener, Loadable{
saves.load(); saves.load();
} }
/** Automatically unlocks things with no requirements. */
void checkAutoUnlocks(){
if(net.client()) return;
for(TechNode node : TechTree.all){
if(!node.content.unlocked() && node.requirements.length == 0 && !node.objectives.contains(o -> !o.complete())){
node.content.unlocked();
}
}
}
void createPlayer(){ void createPlayer(){
player = Player.create(); player = Player.create();
player.name = Core.settings.getString("name"); player.name = Core.settings.getString("name");
@@ -520,6 +541,12 @@ public class Control implements ApplicationListener, Loadable{
platform.updateRPC(); platform.updateRPC();
} }
//unlock core items
var core = state.rules.defaultTeam.core();
if(!net.client() && core != null){
core.items.each((i, a) -> i.unlock());
}
if(Core.input.keyTap(Binding.pause) && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){ if(Core.input.keyTap(Binding.pause) && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){
state.set(state.is(State.playing) ? State.paused : State.playing); state.set(state.is(State.playing) ? State.paused : State.playing);
} }

View File

@@ -76,6 +76,8 @@ public class EditorTile extends Tile{
if(getTeamID() == team.id) return; if(getTeamID() == team.id) return;
op(OpType.team, (byte)getTeamID()); op(OpType.team, (byte)getTeamID());
super.setTeam(team); super.setTeam(team);
getLinkedTiles(t -> ui.editor.editor.renderer.updatePoint(t.x, t.y));
} }
@Override @Override

View File

@@ -519,6 +519,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public void dumpLiquid(Liquid liquid){ public void dumpLiquid(Liquid liquid){
int dump = this.cdump; int dump = this.cdump;
if(!net.client()) liquid.unlock();
for(int i = 0; i < proximity.size; i++){ for(int i = 0; i < proximity.size; i++){
incrementDump(proximity.size); incrementDump(proximity.size);
Building other = proximity.get((i + dump) % proximity.size); Building other = proximity.get((i + dump) % proximity.size);
@@ -618,6 +620,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
*/ */
public void offload(Item item){ public void offload(Item item){
int dump = this.cdump; int dump = this.cdump;
if(!net.client()) item.unlock();
for(int i = 0; i < proximity.size; i++){ for(int i = 0; i < proximity.size; i++){
incrementDump(proximity.size); incrementDump(proximity.size);

View File

@@ -28,6 +28,26 @@ public class Objectives{
} }
} }
public static class Produce implements Objective{
public UnlockableContent content;
public Produce(UnlockableContent content){
this.content = content;
}
protected Produce(){}
@Override
public boolean complete(){
return content.unlocked();
}
@Override
public String display(){
return Core.bundle.format("requirement.produce", content.emoji() + " " + content.localizedName);
}
}
public static class SectorComplete extends SectorObjective{ public static class SectorComplete extends SectorObjective{
public SectorComplete(SectorPreset zone){ public SectorComplete(SectorPreset zone){

View File

@@ -617,7 +617,7 @@ public class Block extends UnlockableContent{
public ItemStack[] researchRequirements(){ public ItemStack[] researchRequirements(){
ItemStack[] out = new ItemStack[requirements.length]; ItemStack[] out = new ItemStack[requirements.length];
for(int i = 0; i < out.length; i++){ for(int i = 0; i < out.length; i++){
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.11f) * 20 * researchCostMultiplier, 10); int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.13f) * 20 * researchCostMultiplier, 10);
out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity)); out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity));
} }
@@ -631,6 +631,19 @@ public class Block extends UnlockableContent{
for(ItemStack stack : requirements){ for(ItemStack stack : requirements){
cons.get(stack.item); cons.get(stack.item);
} }
if(consumes.any()){
//also requires inputs
for(Consume c : consumes.all()){
if(c instanceof ConsumeItems i){
for(ItemStack stack : i.items){
cons.get(stack.item);
}
}else if(c instanceof ConsumeLiquid i){
cons.get(i.liquid);
}
}
}
} }
@Override @Override

View File

@@ -101,6 +101,7 @@ public class Consumers{
return (T)map[type.ordinal()]; return (T)map[type.ordinal()];
} }
@Nullable
public Consume[] all(){ public Consume[] all(){
return results; return results;
} }

View File

@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=e430136d6c6f14a1254e1bcde427ec3b334e3cbd archash=1c7e02ed2e2059ee1fca6812fb0d2ffd860f82b3