diff --git a/core/src/io/anuke/mindustry/game/GlobalData.java b/core/src/io/anuke/mindustry/game/GlobalData.java index a782dc3f07..a644c3eed8 100644 --- a/core/src/io/anuke/mindustry/game/GlobalData.java +++ b/core/src/io/anuke/mindustry/game/GlobalData.java @@ -150,6 +150,7 @@ public class GlobalData{ @SuppressWarnings("unchecked") public void load(){ + items.clear(); unlocked = Core.settings.getObject("unlocks", ObjectMap.class, ObjectMap::new); for(Item item : Vars.content.items()){ items.put(item, Core.settings.getInt("item-" + item.name, 0)); diff --git a/core/src/io/anuke/mindustry/mod/Mods.java b/core/src/io/anuke/mindustry/mod/Mods.java index 8888ac0382..50254ce995 100644 --- a/core/src/io/anuke/mindustry/mod/Mods.java +++ b/core/src/io/anuke/mindustry/mod/Mods.java @@ -18,7 +18,6 @@ import io.anuke.mindustry.game.*; import io.anuke.mindustry.gen.*; import io.anuke.mindustry.plugin.*; import io.anuke.mindustry.type.*; -import io.anuke.mindustry.ui.*; import java.io.*; import java.net.*; @@ -225,9 +224,6 @@ public class Mods implements Loadable{ public void reloadContent(){ //epic memory leak Core.atlas = new TextureAtlas(Core.files.internal("sprites/sprites.atlas")); - Tex.load(); - Tex.loadStyles(); - Styles.load(); loaded.clear(); disabled.clear(); load(); @@ -244,6 +240,8 @@ public class Mods implements Loadable{ content.init(); content.load(); content.loadColors(); + data.load(); + requiresReload = false; } /** Creates all the content found in mod files. */ diff --git a/core/src/io/anuke/mindustry/ui/dialogs/ModsDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/ModsDialog.java index 010bc886a9..c0109b649f 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/ModsDialog.java @@ -60,10 +60,10 @@ public class ModsDialog extends FloatingDialog{ title.add("[accent]" + mod.meta.name + "[lightgray] v" + mod.meta.version + (" | " + Core.bundle.get(mod.enabled() ? "mod.enabled" : "mod.disabled"))); title.add().growX(); - title.addButton(mod.enabled() ? "$mod.disable" : "$mod.enable", Styles.cleart, () -> { + title.addImageTextButton(mod.enabled() ? "$mod.disable" : "$mod.enable", mod.enabled() ? Icon.arrowDownSmall : Icon.arrowUpSmall, Styles.cleart, () -> { mods.setEnabled(mod, !mod.enabled()); setup(); - }).height(50f).margin(8f).width(100f); + }).height(50f).margin(8f).width(130f); title.addImageButton(Icon.trash16Small, Styles.cleari, () -> ui.showConfirm("$confirm", "$mod.remove.confirm", () -> { mods.removeMod(mod); diff --git a/core/src/io/anuke/mindustry/world/blocks/Floor.java b/core/src/io/anuke/mindustry/world/blocks/Floor.java index 9985a617d4..e11a3a63e2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Floor.java +++ b/core/src/io/anuke/mindustry/world/blocks/Floor.java @@ -4,10 +4,12 @@ import io.anuke.arc.*; import io.anuke.arc.collection.*; import io.anuke.arc.graphics.*; import io.anuke.arc.graphics.g2d.*; +import io.anuke.arc.graphics.g2d.TextureAtlas.*; import io.anuke.arc.math.*; import io.anuke.arc.math.geom.*; import io.anuke.mindustry.content.*; import io.anuke.mindustry.entities.Effects.*; +import io.anuke.mindustry.game.*; import io.anuke.mindustry.type.*; import io.anuke.mindustry.world.*; @@ -53,7 +55,7 @@ public class Floor extends Block{ protected byte eq = 0; protected Array blenders = new Array<>(); protected IntSet blended = new IntSet(); - protected TextureRegion edgeRegion, edgierRegion; + protected TextureRegion edgeRegion; public Floor(String name){ super(name); @@ -81,7 +83,31 @@ public class Floor extends Block{ } region = variantRegions[0]; edgeRegion = Core.atlas.find("edge"); - edgierRegion = Core.atlas.find("edgier"); + } + + @Override + public void createIcons(PixmapPacker out, PixmapPacker editor){ + super.createIcons(out, editor); + editor.pack("editor-" + name, Core.atlas.getPixmap((AtlasRegion)icon(Cicon.full)).crop()); + + if(blendGroup != this){ + return; + } + + Color color = new Color(); + Color color2 = new Color(); + PixmapRegion image = Core.atlas.getPixmap((AtlasRegion)generateIcons()[0]); + PixmapRegion edge = Core.atlas.getPixmap("edge-stencil"); + Pixmap result = new Pixmap(edge.width, edge.height); + + for(int x = 0; x < edge.width; x++){ + for(int y = 0; y < edge.height; y++){ + edge.getPixel(x, y, color); + result.draw(x, y, color.mul(color2.set(image.getPixel(x % image.width, y % image.height)))); + } + } + + out.pack(name + "-edge", result); } @Override