mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Allow configuring autosave interval
This commit is contained in:
@@ -47,10 +47,16 @@ export class AutomaticSave {
|
||||
return;
|
||||
}
|
||||
|
||||
const saveInterval = this.root.app.settings.getAutosaveIntervalSeconds();
|
||||
if (!saveInterval) {
|
||||
// Disabled
|
||||
return;
|
||||
}
|
||||
|
||||
// Check when the last save was, but make sure that if it fails, we don't spam
|
||||
const lastSaveTime = Math_max(this.lastSaveAttempt, this.root.savegame.getRealLastUpdate());
|
||||
|
||||
let secondsSinceLastSave = (Date.now() - lastSaveTime) / 1000.0;
|
||||
const secondsSinceLastSave = (Date.now() - lastSaveTime) / 1000.0;
|
||||
let shouldSave = false;
|
||||
|
||||
switch (this.saveImportance) {
|
||||
@@ -61,7 +67,7 @@ export class AutomaticSave {
|
||||
|
||||
case enumSavePriority.regular:
|
||||
// Could determine if there is a good / bad point here
|
||||
shouldSave = secondsSinceLastSave > MIN_INTERVAL_SECS;
|
||||
shouldSave = secondsSinceLastSave > saveInterval;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user