Преглед изворни кода

Added hooks for rooms

tags/v0.1.0
Fen Dweller пре 6 година
родитељ
комит
1bc261531b
No known key found for this signature in database GPG Key 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",


Loading…
Откажи
Сачувај