Przeglądaj źródła

Added hooks for rooms

tags/v0.1.0
Fen Dweller 6 lat temu
rodzic
commit
1bc261531b
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: E80B35A6F11C3656
1 zmienionych plików z 19 dodań i 1 usunięć
  1. +19
    -1
      world.js

+ 19
- 1
world.js Wyświetl plik

@@ -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",


Ładowanie…
Anuluj
Zapisz