diff --git a/core/src/io/anuke/mindustry/content/Items.java b/core/src/io/anuke/mindustry/content/Items.java index 8c9fc00ac1..688cbcc9a6 100644 --- a/core/src/io/anuke/mindustry/content/Items.java +++ b/core/src/io/anuke/mindustry/content/Items.java @@ -17,6 +17,7 @@ public class Items implements ContentList{ hardness = 1; cost = 0.6f; genOre = true; + alwaysUnlocked = true; }}; lead = new Item("lead", Color.valueOf("8c7fa9")){{ diff --git a/core/src/io/anuke/mindustry/content/Liquids.java b/core/src/io/anuke/mindustry/content/Liquids.java index 9b9184a116..5c25ed2535 100644 --- a/core/src/io/anuke/mindustry/content/Liquids.java +++ b/core/src/io/anuke/mindustry/content/Liquids.java @@ -17,6 +17,11 @@ public class Liquids implements ContentList{ tier = 0; effect = StatusEffects.wet; } + + @Override + public boolean alwaysUnlocked() { + return true; + } }; lava = new Liquid("lava", Color.valueOf("e37341")){ diff --git a/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java b/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java index 7839c41d06..6c57b400bc 100644 --- a/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java @@ -129,10 +129,11 @@ public class DebugBlocks extends BlockList implements ContentList{ Table cont = new Table(); for(int i = 0; i < items.size; i++){ + if(!control.unlocks().isUnlocked(items.get(i))) continue; + final int f = i; - ImageButton button = cont.addImageButton("liquid-icon-" + items.get(i).name, "toggle", 24, () -> { - Call.setLiquidSourceLiquid(null, tile, items.get(f)); - }).size(38, 42).padBottom(-5.1f).group(group).get(); + ImageButton button = cont.addImageButton("liquid-icon-" + items.get(i).name, "toggle", 24, + () -> Call.setLiquidSourceLiquid(null, tile, items.get(f))).size(38, 42).padBottom(-5.1f).group(group).get(); button.setChecked(entity.source.id == f); if(i % 4 == 3){ diff --git a/core/src/io/anuke/mindustry/type/Item.java b/core/src/io/anuke/mindustry/type/Item.java index 7fecf4eb27..2860056a20 100644 --- a/core/src/io/anuke/mindustry/type/Item.java +++ b/core/src/io/anuke/mindustry/type/Item.java @@ -38,6 +38,8 @@ public class Item extends UnlockableContent implements Comparable{ public float cost = 3f; /**Whether this item has ores generated for it.*/ public boolean genOre = false; + /**If true, item is always unlocked.*/ + public boolean alwaysUnlocked = false; public Item(String name, Color color){ this.name = name; @@ -45,7 +47,7 @@ public class Item extends UnlockableContent implements Comparable{ this.description = Bundles.getOrNull("item." + this.name + ".description"); if(!Bundles.has("item." + this.name + ".name")){ - Log.err("Warning: item '" + name + "' is missing a localized name. Add the follow to bundle.properties:"); + Log.err("Warning: item '" + name + "' is missing a localized name. Add the following to bundle.properties:"); Log.err("item." + this.name + ".name=" + Strings.capitalize(name.replace('-', '_'))); } } @@ -54,6 +56,11 @@ public class Item extends UnlockableContent implements Comparable{ this.region = Draw.region("item-" + name); } + @Override + public boolean alwaysUnlocked() { + return alwaysUnlocked; + } + @Override public void displayInfo(Table table){ ContentDisplay.displayItem(table, this);