ソースを参照

Added hooks for rooms

tags/v0.1.0
Fen Dweller 6年前
コミット
1bc261531b
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: E80B35A6F11C3656
1個のファイルの変更19行の追加1行の削除
  1. +19
    -1
      world.js

+ 19
- 1
world.js ファイルの表示

@@ -23,6 +23,18 @@ function initRoomState(state) {
}

function moveToRoom(dest, state) {
const room = world[dest];

console.log(room);

if (room.hooks) {
for (let hook of room.hooks) {
if (!hook(room, state)) {
return;
}
}
}

updateRoom(dest, state);
}

@@ -169,7 +181,13 @@ world = {
}
]
}
}
},
"hooks": [
(self, state) => {
print(["This is a test of the hooks"]);
return true;
}
]
},
"Locked Room": {
"id": "Locked Room",


読み込み中…
キャンセル
保存