mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 15:02:03 -08:00
Research bugfixes
This commit is contained in:
parent
4385cb8a88
commit
cfbfa0844d
7 changed files with 34 additions and 14 deletions
|
|
@ -6,7 +6,6 @@ import arc.struct.*;
|
|||
import arc.util.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.Objectives.*;
|
||||
import mindustry.gen.*;
|
||||
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. */
|
||||
|
|
@ -142,7 +141,7 @@ public class TechTree{
|
|||
}
|
||||
|
||||
public Drawable icon(){
|
||||
return icon == null ? Icon.tree : icon;
|
||||
return icon == null ? new TextureRegionDrawable(content.uiIcon) : icon;
|
||||
}
|
||||
|
||||
public String localizedName(){
|
||||
|
|
|
|||
|
|
@ -115,6 +115,10 @@ public class Renderer implements ApplicationListener{
|
|||
|
||||
loadFluidFrames();
|
||||
|
||||
Events.on(ClientLoadEvent.class, e -> {
|
||||
loadFluidFrames();
|
||||
});
|
||||
|
||||
assets.load("sprites/clouds.png", Texture.class).loaded = t -> {
|
||||
t.setWrap(TextureWrap.repeat);
|
||||
t.setFilter(TextureFilter.linear);
|
||||
|
|
@ -130,8 +134,6 @@ public class Renderer implements ApplicationListener{
|
|||
}
|
||||
|
||||
public void loadFluidFrames(){
|
||||
if(fluidFrames != null) return;
|
||||
|
||||
fluidFrames = new TextureRegion[2][Liquid.animationFrames];
|
||||
|
||||
String[] fluidTypes = {"liquid", "gas"};
|
||||
|
|
@ -145,7 +147,9 @@ public class Renderer implements ApplicationListener{
|
|||
}
|
||||
|
||||
public TextureRegion[][] getFluidFrames(){
|
||||
loadFluidFrames();
|
||||
if(fluidFrames == null){
|
||||
loadFluidFrames();
|
||||
}
|
||||
return fluidFrames;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public class FileMapGenerator implements WorldGenerator{
|
|||
world.setGenerating(true);
|
||||
|
||||
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};
|
||||
|
||||
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.");
|
||||
|
||||
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 -> {
|
||||
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;
|
||||
|
||||
for(int i = 0; i < array.size; i++){
|
||||
|
|
|
|||
|
|
@ -1045,7 +1045,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||
return;
|
||||
}
|
||||
|
||||
if(sector.preset != null && sector.preset.locked() && !sector.hasBase()){
|
||||
if(sector.preset != null && sector.preset.locked() && sector.preset.techNode != null && !sector.hasBase()){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ public class ResearchDialog extends BaseDialog{
|
|||
|
||||
public ItemSeq items;
|
||||
|
||||
private boolean showTechSelect;
|
||||
|
||||
public ResearchDialog(){
|
||||
super("");
|
||||
|
||||
|
|
@ -63,17 +65,22 @@ public class ResearchDialog extends BaseDialog{
|
|||
for(TechNode node : TechTree.roots){
|
||||
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);
|
||||
hide();
|
||||
}).row();
|
||||
}).marginLeft(12f).checked(node == lastNode).row();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
addCloseButton();
|
||||
}}.show();
|
||||
}).minWidth(300f);
|
||||
}).visible(() -> showTechSelect = TechTree.roots.count(node -> !(node.requiresUnlock && !node.content.unlocked())) > 1).minWidth(300f);
|
||||
|
||||
margin(0f).marginBottom(8);
|
||||
cont.stack(titleTable, view = new View(), itemDisplay = new ItemsDisplay()).grow();
|
||||
|
|
@ -82,15 +89,19 @@ public class ResearchDialog extends BaseDialog{
|
|||
|
||||
shouldPause = true;
|
||||
|
||||
onResize(() -> {
|
||||
if(Core.graphics.isPortrait()){
|
||||
Runnable checkMargin = () -> {
|
||||
if(Core.graphics.isPortrait() && showTechSelect){
|
||||
itemDisplay.marginTop(60f);
|
||||
}else{
|
||||
itemDisplay.marginTop(0f);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onResize(checkMargin);
|
||||
|
||||
shown(() -> {
|
||||
checkMargin.run();
|
||||
|
||||
Planet currPlanet = ui.planet.isShown() ?
|
||||
ui.planet.state.planet :
|
||||
state.isCampaign() ? state.rules.sector.planet : null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue