diff --git a/core/src/mindustry/content/TechTree.java b/core/src/mindustry/content/TechTree.java index ffac501ee3..2edc41ed9f 100644 --- a/core/src/mindustry/content/TechTree.java +++ b/core/src/mindustry/content/TechTree.java @@ -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(){ diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index d9294520ea..0788ccdfd0 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -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; } diff --git a/core/src/mindustry/maps/generators/FileMapGenerator.java b/core/src/mindustry/maps/generators/FileMapGenerator.java index f2e38e8d6b..0639fd439f 100644 --- a/core/src/mindustry/maps/generators/FileMapGenerator.java +++ b/core/src/mindustry/maps/generators/FileMapGenerator.java @@ -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){ diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index c74a96e3fd..88341a53c3 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -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; } ); diff --git a/core/src/mindustry/ui/dialogs/DatabaseDialog.java b/core/src/mindustry/ui/dialogs/DatabaseDialog.java index b5cdac1a6f..2f0b75ab9d 100644 --- a/core/src/mindustry/ui/dialogs/DatabaseDialog.java +++ b/core/src/mindustry/ui/dialogs/DatabaseDialog.java @@ -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++){ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 0354fd86e1..eefbcaca66 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -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; } diff --git a/core/src/mindustry/ui/dialogs/ResearchDialog.java b/core/src/mindustry/ui/dialogs/ResearchDialog.java index 6c421640a9..d194f4f4e5 100644 --- a/core/src/mindustry/ui/dialogs/ResearchDialog.java +++ b/core/src/mindustry/ui/dialogs/ResearchDialog.java @@ -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;