Skip to content

Commit e85f777

Browse files
authored
feature(mapper): Add logic for instanced areas (#46)
* Adds logic for instanced areas Calls to deleteArea when switching to a new zone if that zone is "instanced". There may be instances where this is incorrect, but I haven't run into any since adding the logic for ignoring "Battlefield". * Handle case where map.prev_info.area is not yet set This likely would have led to the deletion of the area a user logged into.
1 parent 5eb952f commit e85f777

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

prs-mapper.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ end
328328

329329
function map.eventHandler(event,...)
330330
if event == "gmcp.room.info" then
331+
if gmcp.room.info.zone == "Battlefield" then return end
331332
map.prev_info = map.room_info
332333
map.room_info = {
333334
vnum = gmcp.room.info.num,
@@ -341,6 +342,11 @@ function map.eventHandler(event,...)
341342
for k,v in pairs(map.room_info.exits) do
342343
map.room_info.exits[k] = tonumber(v)
343344
end
345+
if map.prev_info.area and (map.prev_info.area ~= map.room_info.area) then
346+
if gmcp.room.info.instanced then
347+
deleteArea(gmcp.room.info.zone)
348+
end
349+
end
344350
handle_move()
345351
elseif event == "shiftRoom" then
346352
local dir = exitmap[arg[1]] or arg[1]

0 commit comments

Comments
 (0)