Skip to content

Commit

Permalink
Handle duplicate exits in with the generic mapper (#3066)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eraene authored and vadi2 committed Sep 12, 2019
1 parent f02b621 commit c9c9f77
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/mudlet-lua/lua/generic-mapper/generic_mapper.xml
Expand Up @@ -1931,7 +1931,14 @@ local function capture_move_cmd(dir,priority)
end
end
end
local function deduplicate_exits(exits)
local deduplicated_exits = {}
for _, v in ipairs(exits) do
deduplicated_exits[v] = true
end

return table.keys(deduplicated_exits)
end
local function capture_room_info(name, exits)
-- captures room info, and tries to move map to match
if (not vision_fail) and name and exits then
Expand All @@ -1952,6 +1959,8 @@ local function capture_room_info(name, exits)
table.insert(map.currentExits,w)
end
end
undupeExits = deduplicate_exits(map.currentExits)
map.set("currentExits", undupeExits)
map.echo(string.format("Exits Captured: %s (%s)",exits, table.concat(map.currentExits, " ")),true)
move_map()
elseif vision_fail then
Expand Down

0 comments on commit c9c9f77

Please sign in to comment.