Minor cleanup

This commit is contained in:
Anuken
2020-04-08 10:54:45 -04:00
parent 7b25b09c18
commit a241d6f5bb
11 changed files with 21 additions and 25 deletions

View File

@@ -68,20 +68,6 @@ public enum Gamemode{
this.validator = validator;
}
public static Gamemode bestFit(Rules rules){
if(rules.pvp){
return pvp;
}else if(rules.editor){
return editor;
}else if(rules.attackMode){
return attack;
}else if(rules.infiniteResources){
return sandbox;
}else{
return survival;
}
}
/** Applies this preset to this ruleset. */
public Rules apply(Rules in){
rules.get(in);

View File

@@ -61,7 +61,7 @@ public class Rules{
public float launchWaveMultiplier = 2f;
/** Sector for saves that have them.*/
public @Nullable Sector sector;
/** Region that save is on. Indicates campaign. */
/** Region that save is on. Indicates campaign. TODO not implemented. */
public @Nullable MapRegion region;
/** Spawn layout. */
public Array<SpawnGroup> spawns = new Array<>();
@@ -107,6 +107,16 @@ public class Rules{
/** Returns the gamemode that best fits these rules.*/
public Gamemode mode(){
return Gamemode.bestFit(this);
if(pvp){
return Gamemode.pvp;
}else if(editor){
return Gamemode.editor;
}else if(attackMode){
return Gamemode.attack;
}else if(infiniteResources){
return Gamemode.sandbox;
}else{
return Gamemode.survival;
}
}
}

View File

@@ -291,7 +291,7 @@ public class Saves{
}
public Gamemode mode(){
return Gamemode.bestFit(meta.rules);
return meta.rules.mode();
}
public int getBuild(){