diff --git a/core/assets/mindustry-saves/1.mins b/core/assets/mindustry-saves/1.mins deleted file mode 100644 index f110400b08..0000000000 Binary files a/core/assets/mindustry-saves/1.mins and /dev/null differ diff --git a/core/assets/mindustry-saves/2.mins b/core/assets/mindustry-saves/2.mins deleted file mode 100644 index c825924f54..0000000000 Binary files a/core/assets/mindustry-saves/2.mins and /dev/null differ diff --git a/core/assets/mindustry-saves/3.mins b/core/assets/mindustry-saves/3.mins deleted file mode 100644 index 87c41d61fd..0000000000 Binary files a/core/assets/mindustry-saves/3.mins and /dev/null differ diff --git a/core/assets/mindustry-saves/4.mins b/core/assets/mindustry-saves/4.mins deleted file mode 100644 index 47854a9109..0000000000 Binary files a/core/assets/mindustry-saves/4.mins and /dev/null differ diff --git a/core/assets/mindustry-saves/5.mins b/core/assets/mindustry-saves/5.mins deleted file mode 100644 index 833aa4a201..0000000000 Binary files a/core/assets/mindustry-saves/5.mins and /dev/null differ diff --git a/core/src/io/anuke/mindustry/io/Saves.java b/core/src/io/anuke/mindustry/io/Saves.java index 9b7c3333a2..909f04efe4 100644 --- a/core/src/io/anuke/mindustry/io/Saves.java +++ b/core/src/io/anuke/mindustry/io/Saves.java @@ -5,6 +5,9 @@ import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Timer; import com.badlogic.gdx.utils.Timer.Task; import com.badlogic.gdx.utils.async.AsyncExecutor; +import com.badlogic.gdx.utils.reflect.ClassReflection; +import com.badlogic.gdx.utils.reflect.Field; +import com.badlogic.gdx.utils.reflect.ReflectionException; import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.GameState; import io.anuke.mindustry.core.GameState.State; @@ -33,8 +36,30 @@ public class Saves { Timer.schedule(new Task() { + Field field; + int lastInterval; + + { + try{ + field = ClassReflection.getDeclaredField(getClass(), "intervalMillis"); + field.setAccessible(true); + }catch (ReflectionException e){ + throw new RuntimeException(e); + } + } + @Override public void run() { + if(Settings.getInt("saveinterval") != lastInterval){ + try{ + field.set(this, (long)(Settings.getInt("saveinterval")) / 60f * 1000); + }catch (ReflectionException e){ + throw new RuntimeException(e); + } + + lastInterval = Settings.getInt("saveinterval"); + } + if(!GameState.is(State.menu) && !GameState.is(State.dead) && current != null && current.isAutosave()){ saving = true;