Research bugfixes
This commit is contained in:
@@ -6,7 +6,6 @@ import arc.struct.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.Objectives.*;
|
import mindustry.game.Objectives.*;
|
||||||
import mindustry.gen.*;
|
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
/** Class for storing a list of TechNodes with some utility tree builder methods; context dependent. See {@link SerpuloTechTree#load} source for example usage. */
|
/** Class for storing a list of TechNodes with some utility tree builder methods; context dependent. See {@link SerpuloTechTree#load} source for example usage. */
|
||||||
@@ -142,7 +141,7 @@ public class TechTree{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Drawable icon(){
|
public Drawable icon(){
|
||||||
return icon == null ? Icon.tree : icon;
|
return icon == null ? new TextureRegionDrawable(content.uiIcon) : icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String localizedName(){
|
public String localizedName(){
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ public class Renderer implements ApplicationListener{
|
|||||||
|
|
||||||
loadFluidFrames();
|
loadFluidFrames();
|
||||||
|
|
||||||
|
Events.on(ClientLoadEvent.class, e -> {
|
||||||
|
loadFluidFrames();
|
||||||
|
});
|
||||||
|
|
||||||
assets.load("sprites/clouds.png", Texture.class).loaded = t -> {
|
assets.load("sprites/clouds.png", Texture.class).loaded = t -> {
|
||||||
t.setWrap(TextureWrap.repeat);
|
t.setWrap(TextureWrap.repeat);
|
||||||
t.setFilter(TextureFilter.linear);
|
t.setFilter(TextureFilter.linear);
|
||||||
@@ -130,8 +134,6 @@ public class Renderer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadFluidFrames(){
|
public void loadFluidFrames(){
|
||||||
if(fluidFrames != null) return;
|
|
||||||
|
|
||||||
fluidFrames = new TextureRegion[2][Liquid.animationFrames];
|
fluidFrames = new TextureRegion[2][Liquid.animationFrames];
|
||||||
|
|
||||||
String[] fluidTypes = {"liquid", "gas"};
|
String[] fluidTypes = {"liquid", "gas"};
|
||||||
@@ -145,7 +147,9 @@ public class Renderer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TextureRegion[][] getFluidFrames(){
|
public TextureRegion[][] getFluidFrames(){
|
||||||
loadFluidFrames();
|
if(fluidFrames == null){
|
||||||
|
loadFluidFrames();
|
||||||
|
}
|
||||||
return fluidFrames;
|
return fluidFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public class FileMapGenerator implements WorldGenerator{
|
|||||||
world.setGenerating(true);
|
world.setGenerating(true);
|
||||||
|
|
||||||
tiles = world.tiles;
|
tiles = world.tiles;
|
||||||
|
|
||||||
|
//TODO why is this hardcoded into the map generator
|
||||||
Item[] items = {Items.blastCompound, Items.pyratite, Items.copper, Items.thorium, Items.copper, Items.lead};
|
Item[] items = {Items.blastCompound, Items.pyratite, Items.copper, Items.thorium, Items.copper, Items.lead};
|
||||||
|
|
||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
|
|||||||
@@ -384,7 +384,11 @@ public class ContentParser{
|
|||||||
|
|
||||||
if(!value.has("sector") || !value.get("sector").isNumber()) throw new RuntimeException("SectorPresets must have a sector number.");
|
if(!value.has("sector") || !value.get("sector").isNumber()) throw new RuntimeException("SectorPresets must have a sector number.");
|
||||||
|
|
||||||
return new SectorPreset(name, locate(ContentType.planet, value.getString("planet", "serpulo")), value.getInt("sector"));
|
SectorPreset out = new SectorPreset(name, locate(ContentType.planet, value.getString("planet", "serpulo")), value.getInt("sector"));
|
||||||
|
value.remove("sector");
|
||||||
|
value.remove("planet");
|
||||||
|
read(() -> readFields(out, value));
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class DatabaseDialog extends BaseDialog{
|
|||||||
all.table(list -> {
|
all.table(list -> {
|
||||||
list.left();
|
list.left();
|
||||||
|
|
||||||
int cols = (int)Mathf.clamp((Core.graphics.getWidth() - Scl.scl(30)) / Scl.scl(32 + 10), 1, 22);
|
int cols = (int)Mathf.clamp((Core.graphics.getWidth() - Scl.scl(30)) / Scl.scl(32 + 12), 1, 22);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for(int i = 0; i < array.size; i++){
|
for(int i = 0; i < array.size; i++){
|
||||||
|
|||||||
@@ -1045,7 +1045,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sector.preset != null && sector.preset.locked() && !sector.hasBase()){
|
if(sector.preset != null && sector.preset.locked() && sector.preset.techNode != null && !sector.hasBase()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
|
|
||||||
public ItemSeq items;
|
public ItemSeq items;
|
||||||
|
|
||||||
|
private boolean showTechSelect;
|
||||||
|
|
||||||
public ResearchDialog(){
|
public ResearchDialog(){
|
||||||
super("");
|
super("");
|
||||||
|
|
||||||
@@ -63,17 +65,22 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
for(TechNode node : TechTree.roots){
|
for(TechNode node : TechTree.roots){
|
||||||
if(node.requiresUnlock && !node.content.unlocked() && node != getPrefRoot()) continue;
|
if(node.requiresUnlock && !node.content.unlocked() && node != getPrefRoot()) continue;
|
||||||
|
|
||||||
in.button(node.localizedName(), Styles.cleart, () -> {
|
//TODO toggle
|
||||||
|
in.button(node.localizedName(), node.icon(), Styles.clearTogglet, iconMed, () -> {
|
||||||
|
if(node == lastNode){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rebuildTree(node);
|
rebuildTree(node);
|
||||||
hide();
|
hide();
|
||||||
}).row();
|
}).marginLeft(12f).checked(node == lastNode).row();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
}}.show();
|
}}.show();
|
||||||
}).minWidth(300f);
|
}).visible(() -> showTechSelect = TechTree.roots.count(node -> !(node.requiresUnlock && !node.content.unlocked())) > 1).minWidth(300f);
|
||||||
|
|
||||||
margin(0f).marginBottom(8);
|
margin(0f).marginBottom(8);
|
||||||
cont.stack(titleTable, view = new View(), itemDisplay = new ItemsDisplay()).grow();
|
cont.stack(titleTable, view = new View(), itemDisplay = new ItemsDisplay()).grow();
|
||||||
@@ -82,15 +89,19 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
|
|
||||||
shouldPause = true;
|
shouldPause = true;
|
||||||
|
|
||||||
onResize(() -> {
|
Runnable checkMargin = () -> {
|
||||||
if(Core.graphics.isPortrait()){
|
if(Core.graphics.isPortrait() && showTechSelect){
|
||||||
itemDisplay.marginTop(60f);
|
itemDisplay.marginTop(60f);
|
||||||
}else{
|
}else{
|
||||||
itemDisplay.marginTop(0f);
|
itemDisplay.marginTop(0f);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
onResize(checkMargin);
|
||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
|
checkMargin.run();
|
||||||
|
|
||||||
Planet currPlanet = ui.planet.isShown() ?
|
Planet currPlanet = ui.planet.isShown() ?
|
||||||
ui.planet.state.planet :
|
ui.planet.state.planet :
|
||||||
state.isCampaign() ? state.rules.sector.planet : null;
|
state.isCampaign() ? state.rules.sector.planet : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user