Massive input refactoring

This commit is contained in:
Anuken
2018-05-29 00:15:24 -04:00
parent 2bf7d06a91
commit 4655bd5502
19 changed files with 599 additions and 696 deletions
@@ -11,6 +11,7 @@ import static io.anuke.mindustry.Vars.debug;
public class ContentDatabase {
private ObjectMap<String, ObjectSet<String>> unlocked = new ObjectMap<>();
/**Returns whether or not this piece of content is unlocked yet.*/
public boolean isUnlocked(Content content){
if(debug){
return true;
@@ -25,6 +26,17 @@ public class ContentDatabase {
return set.contains(content.getContentName());
}
/**Makes this piece of content 'unlocked'.
* If this piece of content is already unlocked, nothing changes.
* Results are not saved until you call {@link #save()}.*/
public void unlockContent(Content content){
if(!unlocked.containsKey(content.getContentTypeName())){
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
}
unlocked.get(content.getContentTypeName()).add(content.getContentName());
}
private void load(){
ObjectMap<String, Array<String>> result = Settings.getJson("content-database", ObjectMap.class);