Skip to content

Commit 17617fd

Browse files
committed
init_game now runs server_bfs for instance maps with npcs or monsters
1 parent 585169d commit 17617fd

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

node/server.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,20 @@ function init_game() {
378378
create_instance("d_b1");
379379
create_instance("d_a1");
380380
create_instance("d_a2");
381-
server_bfs("crypt");
382-
server_bfs("winter_instance");
383-
server_bfs("tomb");
384-
server_bfs("dungeon0");
385-
server_bfs("cgallery");
381+
382+
for (const name in G.maps) {
383+
const gMap = G.maps[name];
384+
if (gMap.ignore) {
385+
continue;
386+
}
387+
388+
const hasNpcs = gMap.npcs && gMap.npcs.length > 0;
389+
const hasMonsters = gMap.monsters && gMap.monsters.length > 0;
390+
if (gMap.instance && (hasNpcs || hasMonsters)) {
391+
// running this is important for instances, so that npcs and monsters can navigate / move
392+
server_bfs(name);
393+
}
394+
}
386395
} else if (gameplay == "dungeon") {
387396
for (var name in G.maps) {
388397
if (G.maps[name].world == "dungeon") {

0 commit comments

Comments
 (0)