Saves / Paused dialog cleanup / Zone rule save

This commit is contained in:
Anuken
2019-01-16 23:25:43 -05:00
parent 836a4eb892
commit 58e83c11f0
66 changed files with 996 additions and 965 deletions

View File

@@ -24,4 +24,6 @@ public class Rules{
public float respawnTime = 60 * 4;
/**Time between waves in ticks.*/
public float waveSpacing = 60 * 60;
/**Zone ID, -1 for invalid zone.*/
public byte zone = -1;
}

View File

@@ -13,6 +13,8 @@ import io.anuke.mindustry.game.EventType.StateChangeEvent;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.io.SaveMeta;
import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Zone;
import java.io.IOException;
import java.text.SimpleDateFormat;
@@ -105,6 +107,16 @@ public class Saves{
return saving;
}
public void zoneSave(){
SaveSlot slot = new SaveSlot(-1);
slot.setName("zone");
saves.remove(s -> s.index == -1);
saves.add(slot);
saveMap.put(slot.index, slot);
slot.save();
saveSlots();
}
public SaveSlot addSave(String name){
SaveSlot slot = new SaveSlot(nextSlot);
nextSlot++;
@@ -129,6 +141,11 @@ public class Saves{
return slot;
}
public SaveSlot getZoneSlot(){
SaveSlot slot = getByID(-1);
return slot == null || slot.getZone() == null ? null : slot;
}
public SaveSlot getByID(int id){
return saveMap.get(id);
}
@@ -203,6 +220,10 @@ public class Saves{
Core.settings.save();
}
public Zone getZone(){
return content.getByID(ContentType.zone, meta.rules.zone);
}
public int getBuild(){
return meta.build;
}
@@ -211,10 +232,6 @@ public class Saves{
return meta.wave;
}
public Difficulty getDifficulty(){
return meta.difficulty;
}
public boolean isAutosave(){
return Core.settings.getBool("save-" + index + "-autosave", true);
}