Added zone class / Dialog method inline

This commit is contained in:
Anuken
2019-01-09 18:50:10 -05:00
parent b9618d66f2
commit 84e754dd10
45 changed files with 342 additions and 265 deletions
@@ -9,6 +9,7 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.game.EventType.UnlockEvent;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack;
/**Stores player unlocks. Clientside only.*/
public class GlobalData{
@@ -25,6 +26,22 @@ public class GlobalData{
items.getAndIncrement(item, 0, amount);
}
public boolean hasItems(ItemStack[] stacks){
for(ItemStack stack : stacks){
if(items.get(stack.item, 0) < stack.amount){
return false;
}
}
return true;
}
public void removeItems(ItemStack[] stacks){
for(ItemStack stack : stacks){
items.getAndIncrement(stack.item, 0, -stack.amount);
}
modified = true;
}
public ObjectIntMap<Item> items(){
return items;
}
@@ -5,7 +5,6 @@ public abstract class MappableContent extends Content {
* Returns the unqiue name of this piece of content.
* The name only needs to be unique for all content of this type.
* Do not use IDs for names! Make sure this string stays constant with each update unless removed.
* (e.g. having a recipe and a block, both with name "wall" is fine, as they are different types).
*/
public abstract String getContentName();