浏览代码

Fix actions not being available again once their conditions are met

tags/v0.1.3
Fen Dweller 5 年前
父节点
当前提交
47bc425a94
共有 2 个文件被更改,包括 10 次插入2 次删除
  1. +6
    -1
      stories/demo.js
  2. +4
    -1
      world.js

+ 6
- 1
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",


+ 4
- 1
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");
}
}



正在加载...
取消
保存