소스 검색

Added hooks for rooms

tags/v0.1.0
Fen Dweller 7 년 전
부모
커밋
1bc261531b
No known key found for this signature in database 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",


불러오는 중...
취소
저장