From c9c9f7711e47f4be0c9371120f642ddec885d2fa Mon Sep 17 00:00:00 2001 From: Eraene Date: Thu, 12 Sep 2019 01:09:34 -0500 Subject: [PATCH] Handle duplicate exits in with the generic mapper (#3066) --- src/mudlet-lua/lua/generic-mapper/generic_mapper.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mudlet-lua/lua/generic-mapper/generic_mapper.xml b/src/mudlet-lua/lua/generic-mapper/generic_mapper.xml index 8a7b6007319..a7f09471c7d 100644 --- a/src/mudlet-lua/lua/generic-mapper/generic_mapper.xml +++ b/src/mudlet-lua/lua/generic-mapper/generic_mapper.xml @@ -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 @@ -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