Ver código fonte

Added hooks for rooms

tags/v0.1.0
Fen Dweller 7 anos atrás
pai
commit
1bc261531b
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: E80B35A6F11C3656
1 arquivos alterados com 19 adições e 1 exclusões
  1. +19
    -1
      world.js

+ 19
- 1
world.js Ver arquivo

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


Carregando…
Cancelar
Salvar