|
|
|
@@ -55,8 +55,9 @@ function moveToRoom(src, exit, dest, state) { |
|
|
|
} |
|
|
|
|
|
|
|
state.world[dest].move(state.world[dest], state); |
|
|
|
state.player.location = dest; |
|
|
|
|
|
|
|
updateRoom(dest, state); |
|
|
|
updateRoom(state); |
|
|
|
} |
|
|
|
|
|
|
|
function goToRoom(dest, state) { |
|
|
|
@@ -70,14 +71,16 @@ function goToRoom(dest, state) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
updateRoom(dest, state); |
|
|
|
state.player.location = dest; |
|
|
|
updateRoom(state); |
|
|
|
} |
|
|
|
|
|
|
|
function updateRoom(dest, state) { |
|
|
|
const room = state.world[dest]; |
|
|
|
function updateRoom(state) { |
|
|
|
const name = state.player.location |
|
|
|
const room = state.world[name]; |
|
|
|
|
|
|
|
if (!state.player.rooms[dest.id]) { |
|
|
|
state.player.rooms[dest.id] = {}; |
|
|
|
if (!state.player.rooms[name.id]) { |
|
|
|
state.player.rooms[name.id] = {}; |
|
|
|
} |
|
|
|
|
|
|
|
const areaName = document.querySelector("#area-name"); |
|
|
|
@@ -160,7 +163,7 @@ function updateRoom(dest, state) { |
|
|
|
|
|
|
|
button.addEventListener("click", () => { |
|
|
|
action.execute(room, state); |
|
|
|
updateRoom(room.id, state); |
|
|
|
refresh(); |
|
|
|
}); |
|
|
|
|
|
|
|
button.addEventListener("mouseenter", () => { |
|
|
|
|