fix save loading when save doesn't exist

will need to figure out how to test this but it should work

Signed-off-by: nif <nif@incremental.social>
This commit is contained in:
Nif 2024-04-18 17:56:20 +00:00
parent 9ca5fb3399
commit ed8777f56f

View file

@ -209,13 +209,13 @@ document.getElementById("wipe-game").addEventListener("click", () => {
} }
}) })
{ try {
let falsePlayer = JSON.parse(atob(localStorage.getItem("nif's-infinite-generators"))) let falsePlayer = JSON.parse(atob(localStorage.getItem("nif's-infinite-generators")))
player = {...player, ...falsePlayer} player = {...player, ...falsePlayer}
player.unlocked = {...player.unlocked, ...falsePlayer.unlocked} if (falsePlayer.unlocked) player.unlocked = {...player.unlocked, ...falsePlayer.unlocked}
player.cupgs = [...player.cupgs, ...falsePlayer.cupgs] if (falsePlayer.cupgs) player.cupgs = [...player.cupgs, ...falsePlayer.cupgs]
for (const i in player.gens) newGenerator(Number(i)) for (const i in player.gens) newGenerator(Number(i))
} } catch (TypeError) {}
function updateVars() { function updateVars() {
const dt = 0.05 const dt = 0.05