feat: streamline saving options

This commit is contained in:
Azgaar 2023-08-15 14:38:31 +04:00
parent 2424c66475
commit 5300b997b3
7 changed files with 104 additions and 69 deletions

19
main.js
View file

@ -292,17 +292,20 @@ async function checkLoadParameters() {
}
// check if there is a map saved to indexedDB
try {
const blob = await ldb.get("lastMap");
if (blob) {
WARN && console.warn("Loading last stored map");
uploadMap(blob);
return;
if (byId("onloadBehavior").value === "lastSaved") {
try {
const blob = await ldb.get("lastMap");
if (blob) {
WARN && console.warn("Loading last stored map");
uploadMap(blob);
return;
}
} catch (error) {
ERROR && console.error(error);
}
} catch (error) {
console.error(error);
}
// else generate random map
WARN && console.warn("Generate random map");
generateMapOnLoad();
}