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

Attempt to fix toggles sometimes not visually updating

This commit is contained in:
Harley White 2021-06-06 15:04:16 -04:00
parent a801bd95d0
commit 43932fd977
2 changed files with 8 additions and 8 deletions

View file

@ -130,7 +130,7 @@ function rowReset(row, layer) {
for (lr in ROW_LAYERS[row]){ for (lr in ROW_LAYERS[row]){
if(layers[lr].doReset) { if(layers[lr].doReset) {
player[lr].activeChallenge = null // Exit challenges on any row reset on an equal or higher row Vue.set(player[lr], "activeChallenge", null) // Exit challenges on any row reset on an equal or higher row
run(layers[lr].doReset, layers[lr], layer) run(layers[lr].doReset, layers[lr], layer)
} }
else else
@ -258,13 +258,13 @@ function startChallenge(layer, x) {
if (!player[layer].unlocked) return if (!player[layer].unlocked) return
if (player[layer].activeChallenge == x) { if (player[layer].activeChallenge == x) {
completeChallenge(layer, x) completeChallenge(layer, x)
player[layer].activeChallenge = null Vue.set(player[layer], "activeChallenge", null)
} else { } else {
enter = true enter = true
} }
doReset(layer, true) doReset(layer, true)
if(enter) { if(enter) {
player[layer].activeChallenge = x Vue.set(player[layer], "activeChallenge", x)
run(layers[layer].challenges[x].onEnter, layers[layer].challenges[x]) run(layers[layer].challenges[x].onEnter, layers[layer].challenges[x])
} }
updateChallengeTemp(layer) updateChallengeTemp(layer)
@ -301,8 +301,8 @@ function completeChallenge(layer, x) {
let completions = canCompleteChallenge(layer, x) let completions = canCompleteChallenge(layer, x)
if (!completions){ if (!completions){
player[layer].activeChallenge = null Vue.set(player[layer], "activeChallenge", null)
run(layers[layer].challenges[x].onExit, layers[layer].challenges[x]) run(layers[layer].challenges[x].onExit, layers[layer].challenges[x])
return return
} }
if (player[layer].challenges[x] < tmp[layer].challenges[x].completionLimit) { if (player[layer].challenges[x] < tmp[layer].challenges[x].completionLimit) {
@ -311,7 +311,7 @@ function completeChallenge(layer, x) {
player[layer].challenges[x] = Math.min(player[layer].challenges[x], tmp[layer].challenges[x].completionLimit) player[layer].challenges[x] = Math.min(player[layer].challenges[x], tmp[layer].challenges[x].completionLimit)
if (layers[layer].challenges[x].onComplete) run(layers[layer].challenges[x].onComplete, layers[layer].challenges[x]) if (layers[layer].challenges[x].onComplete) run(layers[layer].challenges[x].onComplete, layers[layer].challenges[x])
} }
player[layer].activeChallenge = null Vue.set(player[layer], "activeChallenge", null)
run(layers[layer].challenges[x].onExit, layers[layer].challenges[x]) run(layers[layer].challenges[x].onExit, layers[layer].challenges[x])
updateChallengeTemp(layer) updateChallengeTemp(layer)
} }

View file

@ -41,7 +41,7 @@ function changeTreeQuality() {
document.body.style.setProperty('--hqProperty3', on ? "2px 2px 4px rgba(0, 0, 0, 0.25)" : "none"); document.body.style.setProperty('--hqProperty3', on ? "2px 2px 4px rgba(0, 0, 0, 0.25)" : "none");
} }
function toggleAuto(toggle) { function toggleAuto(toggle) {
player[toggle[0]][toggle[1]] = !player[toggle[0]][toggle[1]]; Vue.set(player[toggle[0]], [toggle[1]], !player[toggle[0]][toggle[1]]);
needCanvasUpdate=true needCanvasUpdate=true
} }