1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 17:31:50 +00:00

Fixed reactivity on reset

This commit is contained in:
Jacorb90 2020-11-02 18:44:36 -05:00
parent 2a4612c8ec
commit b7c7317876
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

@ -612,6 +612,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