Automatic custom game saves
This commit is contained in:
@@ -26,6 +26,8 @@ import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.blocks.storage.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.time.*;
|
||||
import java.time.format.*;
|
||||
|
||||
import static io.anuke.arc.Core.*;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@@ -230,6 +232,9 @@ public class Control implements ApplicationListener, Loadable{
|
||||
world.loadMap(map, rules);
|
||||
state.rules = rules;
|
||||
logic.play();
|
||||
if(settings.getBool("savecreate")){
|
||||
control.saves.addSave(map.name() + "-" + DateTimeFormatter.ofPattern("MMM dd h:mm").format(LocalDateTime.now()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class LoadDialog extends FloatingDialog{
|
||||
Time.runTask(2f, () -> Core.scene.setScrollFocus(pane));
|
||||
|
||||
Array<SaveSlot> array = control.saves.getSaveSlots();
|
||||
array.sort((slot, other) -> -Long.compare(slot.getTimestamp(), other.getTimestamp()));
|
||||
|
||||
for(SaveSlot slot : array){
|
||||
if(slot.isHidden()) continue;
|
||||
|
||||
@@ -139,6 +139,8 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.checkPref("crashreport", true);
|
||||
}
|
||||
|
||||
game.checkPref("savecreate", true);
|
||||
|
||||
game.pref(new Setting(){
|
||||
@Override
|
||||
public void add(SettingsTable table){
|
||||
|
||||
Reference in New Issue
Block a user