Cleanup / Fixed unlock system in custom games

This commit is contained in:
Anuken
2018-09-29 02:50:21 -07:00
parent 4810bbbbd9
commit d062dffc13
18 changed files with 42 additions and 62 deletions

View File

@@ -41,7 +41,7 @@ public abstract class UnlockableContent extends MappableContent{
return true;
}else{
for(UnlockableContent cont : depend){
if(!control.database().isUnlocked(cont)){
if(!control.unlocks().isUnlocked(cont)){
return false;
}
}

View File

@@ -10,7 +10,8 @@ import io.anuke.ucore.core.Settings;
import static io.anuke.mindustry.Vars.*;
public class ContentDatabase{
/**Stores player unlocks. Clientside only.*/
public class Unlocks{
private ObjectMap<String, ContentUnlockSet> sets = new ObjectMap<>();
static{
@@ -40,10 +41,8 @@ public class ContentDatabase{
return getSet(Net.getLastIP());
}else if(world.getSector() != null || state.mode.infiniteResources){ //sector-sandbox have shared set
return rootSet();
}else if(control != null && control.getSaves().getCurrent() != null){ //per-save set
return getSet(String.valueOf(control.getSaves().getCurrent().index));
}else{ //dedicated server set
return rootSet();
}else{ //per-mode set
return getSet(state.mode.name());
}
}