mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-12 03:37:27 +07:00
Automatic custom game saves
This commit is contained in:
parent
b5ed309405
commit
641937f952
@ -525,6 +525,7 @@ setting.mutemusic.name = Mute Music
|
||||
setting.sfxvol.name = SFX Volume
|
||||
setting.mutesound.name = Mute Sound
|
||||
setting.crashreport.name = Send Anonymous Crash Reports
|
||||
setting.savecreate.name = Auto-Create Saves
|
||||
setting.chatopacity.name = Chat Opacity
|
||||
setting.playerchat.name = Display In-Game Chat
|
||||
uiscale.reset = UI scale has been changed.\nPress "OK" to confirm this scale.\n[scarlet]Reverting and exiting in[accent] {0}[] seconds...
|
||||
|
@ -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){
|
||||
|
Loading…
Reference in New Issue
Block a user