1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 16:13:55 +00:00

Merge pull request #15 from Jacorb90/dev

Fixed reactivity on reset
This commit is contained in:
Harley White 2020-11-07 17:00:28 -05:00 committed by GitHub
commit 92ba6d7e1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -109,7 +109,7 @@ function layerDataReset(layer, keep = []) {
storedData[keep[thing]] = player[layer][keep[thing]]
}
player[layer] = layers[layer].startData();
layOver(player[layer], layers[layer].startData());
player[layer].upgrades = []
player[layer].milestones = []
player[layer].challenges = getStartChallenges(layer)

View file

@ -622,6 +622,13 @@ function goBack() {
else showTab(player.lastSafeTab)
}
function layOver(obj1, obj2) {
for (let x in obj2) {
if (obj2[x] instanceof Object) layOver(obj1[x], obj2[x]);
else obj1[x] = obj2[x];
}
}
function notifyLayer(name) {
if (player.tab == name || !layerunlocked(name)) return
player.notify[name] = 1