diff --git a/stories/demo.js b/stories/demo.js index dae799e..478e69a 100644 --- a/stories/demo.js +++ b/stories/demo.js @@ -63,7 +63,12 @@ stories.push({ "execute": (room) => { state.player.rooms[room.id].squinted = true; print(["You stare at the wall and notice a secret door. But where is the key?"]); - } + }, + "conditions": [ + (room) => { + return !state.player.rooms[room.id].squinted; + } + ] }, { "name": "Find Keys", diff --git a/world.js b/world.js index aa24d72..fcd6a3e 100644 --- a/world.js +++ b/world.js @@ -259,7 +259,10 @@ function updateRoom() { if (action.conditions) { if (!action.conditions.every(cond => cond(room))) { button.classList.add("disabled"); - button.setAttribute("disabled", "true"); + button.setAttribute("disabled", true); + } else { + button.classList.remove("disabled"); + button.removeAttribute("disabled"); } }