Bugfixes / Cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mindustry.game;
|
||||
|
||||
import arc.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.files.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
@@ -98,8 +99,10 @@ public class GlobalData{
|
||||
items.getAndIncrement(item, 0, amount);
|
||||
state.stats.itemsDelivered.getAndIncrement(item, 0, amount);
|
||||
|
||||
//clamp to capacity
|
||||
items.put(item, Mathf.clamp(items.get(item), 0, getItemCapacity()));
|
||||
|
||||
//clamp overflow
|
||||
if(items.get(item, 0) < 0) items.put(item, Integer.MAX_VALUE);
|
||||
if(state.stats.itemsDelivered.get(item, 0) < 0) state.stats.itemsDelivered.put(item, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@@ -139,6 +142,11 @@ public class GlobalData{
|
||||
return items;
|
||||
}
|
||||
|
||||
//TODO: make it upgradeable
|
||||
public int getItemCapacity(){
|
||||
return 10000;
|
||||
}
|
||||
|
||||
/** Returns whether or not this piece of content is unlocked yet. */
|
||||
public boolean isUnlocked(UnlockableContent content){
|
||||
return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.name);
|
||||
|
||||
Reference in New Issue
Block a user