Added map region class
This commit is contained in:
@@ -38,7 +38,7 @@ public class GameState{
|
|||||||
|
|
||||||
/** Note that being in a campaign does not necessarily mean having a sector. */
|
/** Note that being in a campaign does not necessarily mean having a sector. */
|
||||||
public boolean isCampaign(){
|
public boolean isCampaign(){
|
||||||
return rules.sector != null || rules.satellite != null;
|
return rules.sector != null || rules.region != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSector(){
|
public boolean hasSector(){
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package mindustry.game;
|
|||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.files.*;
|
import arc.files.*;
|
||||||
|
import arc.util.ArcAnnotate.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
@@ -19,6 +20,8 @@ import static mindustry.Vars.*;
|
|||||||
public class GlobalData{
|
public class GlobalData{
|
||||||
private ObjectMap<ContentType, ObjectSet<String>> unlocked = new ObjectMap<>();
|
private ObjectMap<ContentType, ObjectSet<String>> unlocked = new ObjectMap<>();
|
||||||
private ObjectIntMap<Item> items = new ObjectIntMap<>();
|
private ObjectIntMap<Item> items = new ObjectIntMap<>();
|
||||||
|
private Array<Satellite> satellites = new Array<>();
|
||||||
|
private ObjectMap<String, MapRegion> regions = new ObjectMap<>();
|
||||||
private boolean modified;
|
private boolean modified;
|
||||||
|
|
||||||
public GlobalData(){
|
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{
|
public void exportData(Fi file) throws IOException{
|
||||||
Array<Fi> files = new Array<>();
|
Array<Fi> files = new Array<>();
|
||||||
files.add(Core.settings.getSettingsFile());
|
files.add(Core.settings.getSettingsFile());
|
||||||
|
|||||||
12
core/src/mindustry/game/MapRegion.java
Normal file
12
core/src/mindustry/game/MapRegion.java
Normal 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(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,8 +59,8 @@ public class Rules{
|
|||||||
public float launchWaveMultiplier = 2f;
|
public float launchWaveMultiplier = 2f;
|
||||||
/** Sector for saves that have them.*/
|
/** Sector for saves that have them.*/
|
||||||
public @Nullable Sector sector;
|
public @Nullable Sector sector;
|
||||||
/** Satellite that save is on. Indicates campaign. */
|
/** Region that save is on. Indicates campaign. */
|
||||||
public @Nullable Satellite satellite;
|
public @Nullable MapRegion region;
|
||||||
/** Spawn layout. */
|
/** Spawn layout. */
|
||||||
public Array<SpawnGroup> spawns = new Array<>();
|
public Array<SpawnGroup> spawns = new Array<>();
|
||||||
/** Determines if there should be limited respawns. */
|
/** Determines if there should be limited respawns. */
|
||||||
|
|||||||
Reference in New Issue
Block a user