Tech tree selection fixes
This commit is contained in:
@@ -1168,7 +1168,7 @@ public class Blocks{
|
|||||||
size = 3;
|
size = 3;
|
||||||
|
|
||||||
itemCapacity = 20;
|
itemCapacity = 20;
|
||||||
heatRequirement = 5f;
|
heatRequirement = 10f;
|
||||||
craftTime = 60f * 3f;
|
craftTime = 60f * 3f;
|
||||||
liquidCapacity = 80f * 5;
|
liquidCapacity = 80f * 5;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import static mindustry.content.TechTree.*;
|
|||||||
public class ErekirTechTree{
|
public class ErekirTechTree{
|
||||||
|
|
||||||
public static void load(){
|
public static void load(){
|
||||||
Planets.erekir.techTree = nodeRoot("erekir", coreBastion, () -> {
|
Planets.erekir.techTree = nodeRoot("erekir", coreBastion, true, () -> {
|
||||||
node(duct, () -> {
|
node(duct, () -> {
|
||||||
node(ductRouter, () -> {
|
node(ductRouter, () -> {
|
||||||
node(ductBridge, () -> {
|
node(ductBridge, () -> {
|
||||||
@@ -57,11 +57,13 @@ public class ErekirTechTree{
|
|||||||
|
|
||||||
node(turbineCondenser, () -> {
|
node(turbineCondenser, () -> {
|
||||||
node(beamNode, () -> {
|
node(beamNode, () -> {
|
||||||
|
node(ventCondenser, () -> {
|
||||||
node(chemicalCombustionChamber, () -> {
|
node(chemicalCombustionChamber, () -> {
|
||||||
node(pyrolysisGenerator, () -> {
|
node(pyrolysisGenerator, () -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
node(beamTower, () -> {
|
node(beamTower, () -> {
|
||||||
|
|
||||||
@@ -75,11 +77,14 @@ public class ErekirTechTree{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
node(ventCondenser, () -> {
|
|
||||||
node(siliconArcFurnace, () -> {
|
node(siliconArcFurnace, () -> {
|
||||||
node(electrolyzer, () -> {
|
node(electrolyzer, () -> {
|
||||||
node(oxidationChamber, () -> {
|
node(oxidationChamber, () -> {
|
||||||
node(electricHeater, () -> {
|
node(electricHeater, () -> {
|
||||||
|
node(heatRedirector, () -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
node(atmosphericConcentrator, () -> {
|
node(atmosphericConcentrator, () -> {
|
||||||
node(cyanogenSynthesizer, () -> {
|
node(cyanogenSynthesizer, () -> {
|
||||||
|
|
||||||
@@ -110,7 +115,6 @@ public class ErekirTechTree{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
//TODO move into turbine condenser?
|
//TODO move into turbine condenser?
|
||||||
node(plasmaBore, () -> {
|
node(plasmaBore, () -> {
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public class Liquids{
|
|||||||
colorTo = Color.valueOf("9e172c");
|
colorTo = Color.valueOf("9e172c");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO
|
|
||||||
arkycite = new Liquid("arkycite", Color.valueOf("84a94b")){{
|
arkycite = new Liquid("arkycite", Color.valueOf("84a94b")){{
|
||||||
flammability = 0.4f;
|
flammability = 0.4f;
|
||||||
viscosity = 0.7f;
|
viscosity = 0.7f;
|
||||||
|
|||||||
@@ -17,8 +17,13 @@ public class TechTree{
|
|||||||
public static Seq<TechNode> roots = new Seq<>();
|
public static Seq<TechNode> roots = new Seq<>();
|
||||||
|
|
||||||
public static TechNode nodeRoot(String name, UnlockableContent content, Runnable children){
|
public static TechNode nodeRoot(String name, UnlockableContent content, Runnable children){
|
||||||
|
return nodeRoot(name, content, false, children);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TechNode nodeRoot(String name, UnlockableContent content, boolean requireUnlock, Runnable children){
|
||||||
var root = node(content, content.researchRequirements(), children);
|
var root = node(content, content.researchRequirements(), children);
|
||||||
root.name = name;
|
root.name = name;
|
||||||
|
root.requiresUnlock = requireUnlock;
|
||||||
roots.add(root);
|
roots.add(root);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@@ -81,6 +86,8 @@ public class TechTree{
|
|||||||
public @Nullable Drawable icon;
|
public @Nullable Drawable icon;
|
||||||
/** Name for root node - used in tech tree selector. */
|
/** Name for root node - used in tech tree selector. */
|
||||||
public @Nullable String name;
|
public @Nullable String name;
|
||||||
|
/** For roots only. If true, this needs to be unlocked before it is selectable in the research dialog. Does not apply when you are on the planet itself. */
|
||||||
|
public boolean requiresUnlock = false;
|
||||||
/** Requirement node. */
|
/** Requirement node. */
|
||||||
public @Nullable TechNode parent;
|
public @Nullable TechNode parent;
|
||||||
/** Content to be researched. */
|
/** Content to be researched. */
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
public ResearchDialog(){
|
public ResearchDialog(){
|
||||||
super("");
|
super("");
|
||||||
|
|
||||||
|
titleTable.remove();
|
||||||
titleTable.clear();
|
titleTable.clear();
|
||||||
|
titleTable.top();
|
||||||
titleTable.button(b -> {
|
titleTable.button(b -> {
|
||||||
//TODO custom icon here.
|
//TODO custom icon here.
|
||||||
b.imageDraw(() -> root.node.icon()).padRight(8).size(iconMed);
|
b.imageDraw(() -> root.node.icon()).padRight(8).size(iconMed);
|
||||||
@@ -59,6 +61,8 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
t.table(Tex.button, in -> {
|
t.table(Tex.button, in -> {
|
||||||
in.defaults().width(300f).height(60f);
|
in.defaults().width(300f).height(60f);
|
||||||
for(TechNode node : TechTree.roots){
|
for(TechNode node : TechTree.roots){
|
||||||
|
if(node.requiresUnlock && !node.content.unlocked() && node != getPrefRoot()) continue;
|
||||||
|
|
||||||
in.button(node.localizedName(), Styles.cleart, () -> {
|
in.button(node.localizedName(), Styles.cleart, () -> {
|
||||||
rebuildTree(node);
|
rebuildTree(node);
|
||||||
hide();
|
hide();
|
||||||
@@ -72,12 +76,20 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
}).minWidth(300f);
|
}).minWidth(300f);
|
||||||
|
|
||||||
margin(0f).marginBottom(8);
|
margin(0f).marginBottom(8);
|
||||||
cont.stack(view = new View(), itemDisplay = new ItemsDisplay()).grow();
|
cont.stack(titleTable, view = new View(), itemDisplay = new ItemsDisplay()).grow();
|
||||||
|
|
||||||
titleTable.toFront();
|
titleTable.toFront();
|
||||||
|
|
||||||
shouldPause = true;
|
shouldPause = true;
|
||||||
|
|
||||||
|
onResize(() -> {
|
||||||
|
if(Core.graphics.isPortrait()){
|
||||||
|
itemDisplay.marginTop(60f);
|
||||||
|
}else{
|
||||||
|
itemDisplay.marginTop(0f);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
Planet currPlanet = ui.planet.isShown() ?
|
Planet currPlanet = ui.planet.isShown() ?
|
||||||
ui.planet.state.planet :
|
ui.planet.state.planet :
|
||||||
@@ -210,6 +222,13 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public @Nullable TechNode getPrefRoot(){
|
||||||
|
Planet currPlanet = ui.planet.isShown() ?
|
||||||
|
ui.planet.state.planet :
|
||||||
|
state.isCampaign() ? state.rules.sector.planet : null;
|
||||||
|
return currPlanet == null ? null : currPlanet.techTree;
|
||||||
|
}
|
||||||
|
|
||||||
public void switchTree(TechNode node){
|
public void switchTree(TechNode node){
|
||||||
if(lastNode == node || node == null) return;
|
if(lastNode == node || node == null) return;
|
||||||
nodes.clear();
|
nodes.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user