diff --git a/world.js b/world.js index 3b35590..f4b1469 100644 --- a/world.js +++ b/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",