Added map region class

This commit is contained in:
Anuken 2020-03-03 12:08:31 -05:00
parent 182a8837be
commit 3858cdd4c5
4 changed files with 22 additions and 3 deletions

View file

@ -38,7 +38,7 @@ public class GameState{
/** Note that being in a campaign does not necessarily mean having a sector. */
public boolean isCampaign(){
return rules.sector != null || rules.satellite != null;
return rules.sector != null || rules.region != null;
}
public boolean hasSector(){

View file

@ -3,6 +3,7 @@ package mindustry.game;
import arc.*;
import arc.struct.*;
import arc.files.*;
import arc.util.ArcAnnotate.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.content.*;
@ -19,6 +20,8 @@ import static mindustry.Vars.*;
public class GlobalData{
private ObjectMap<ContentType, ObjectSet<String>> unlocked = new ObjectMap<>();
private ObjectIntMap<Item> items = new ObjectIntMap<>();
private Array<Satellite> satellites = new Array<>();
private ObjectMap<String, MapRegion> regions = new ObjectMap<>();
private boolean modified;
public GlobalData(){
@ -35,6 +38,10 @@ public class GlobalData{
});
}
public @Nullable MapRegion getRegion(String name){
return regions.get(name);
}
public void exportData(Fi file) throws IOException{
Array<Fi> files = new Array<>();
files.add(Core.settings.getSettingsFile());

View file

@ -0,0 +1,12 @@
package mindustry.game;
/** Defines a special map that can be visited, loaded, and saved. */
public abstract class MapRegion{
/** Name of the region. Used for lookup and save names. */
public abstract String name();
public void load(){
}
}

View file

@ -59,8 +59,8 @@ public class Rules{
public float launchWaveMultiplier = 2f;
/** Sector for saves that have them.*/
public @Nullable Sector sector;
/** Satellite that save is on. Indicates campaign. */
public @Nullable Satellite satellite;
/** Region that save is on. Indicates campaign. */
public @Nullable MapRegion region;
/** Spawn layout. */
public Array<SpawnGroup> spawns = new Array<>();
/** Determines if there should be limited respawns. */