Fixed copper/water not getting unlocked immediately

This commit is contained in:
Anuken 2018-09-29 10:31:17 -11:00
parent d062dffc13
commit 5e1aaf11a7
4 changed files with 18 additions and 4 deletions

View File

@ -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")){{

View File

@ -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")){

View File

@ -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){

View File

@ -38,6 +38,8 @@ public class Item extends UnlockableContent implements Comparable<Item>{
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<Item>{
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<Item>{
this.region = Draw.region("item-" + name);
}
@Override
public boolean alwaysUnlocked() {
return alwaysUnlocked;
}
@Override
public void displayInfo(Table table){
ContentDisplay.displayItem(table, this);