From e070e5dfa5beee828de0f3ec657e72f0230858c0 Mon Sep 17 00:00:00 2001 From: rope Date: Thu, 12 Nov 2026 15:08:33 +0000 Subject: [PATCH] Ship Routes: no edge marker on top of a dock near the map edge Co-Authored-By: Claude Opus 5.5 --- ShipRoutes/ShipRoutes.lua | 8 +++++++- tests/test_sr.lua | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ShipRoutes/ShipRoutes.lua b/ShipRoutes/ShipRoutes.lua index e1f93a9..c56dd1f 100644 --- a/ShipRoutes/ShipRoutes.lua +++ b/ShipRoutes/ShipRoutes.lua @@ -24,6 +24,7 @@ local HOME_MAP = { [0] = 1415, [1] = 1414, [2991] = 2521 } local NEARBY = 800 -- yards: other departures this close show in a dock's tooltip local EXIT_INSET = 0.025 -- share of the map an edge marker sits inside the border local EXIT_MERGE = 0.06 -- edge markers closer than this share of the map width merge +local EXIT_NEAR = 0.08 -- no edge marker this close to its own dock: the dock already says where it goes local db @@ -439,7 +440,12 @@ function provider:RefreshAllData() end local x, y, angle, edge = ExitPoint(walk, W, H) if x then - exits[#exits + 1] = { route = route, leg = leg, far = far, x = x, y = y, angle = angle, edge = edge } + local mx = math.max(EXIT_INSET, math.min(1 - EXIT_INSET, x / W)) * W + local my = math.max(EXIT_INSET, math.min(1 - EXIT_INSET, y / H)) * H + local dx, dy = mx - walk[1], my - walk[2] + if dx * dx + dy * dy > (EXIT_NEAR * W) ^ 2 then + exits[#exits + 1] = { route = route, leg = leg, far = far, x = x, y = y, angle = angle, edge = edge } + end end end end diff --git a/tests/test_sr.lua b/tests/test_sr.lua index cb8cf19..da6b2ee 100644 --- a/tests/test_sr.lua +++ b/tests/test_sr.lua @@ -14,7 +14,7 @@ end local RECTS = { [1415] = { inst = 0, top = 7467, bottom = -16000, left = 16000, right = -19200, type = 2 }, [1414] = { inst = 1, top = 12800, bottom = -11733, left = 17067, right = -19733, type = 2 }, - [1437] = { inst = 0, top = -1500, bottom = -4800, left = 200, right = -4800, type = 3 }, -- "Wetlands" + [1437] = { inst = 0, top = -2148, bottom = -4904, left = -390, right = -4525, type = 3 }, -- Wetlands [1431] = { inst = 0, top = -9716, bottom = -11516, left = 833, right = -1866, type = 3 }, -- "Duskwood" [2521] = { inst = 2991, top = 4956, bottom = 1248, left = 4231, right = -1331, type = 3 }, } @@ -315,7 +315,12 @@ mapID = 1437 provider:RefreshAllData() check(find("dock", "Menethil Harbor") ~= nil, "Menethil on its zone map") check(find("dock", "Stormwind Harbor") == nil, "Stormwind not on the Wetlands map") -check(find("exit", "Theramore Isle") ~= nil and find("exit", "Southshore") ~= nil, "Wetlands edge markers toward Theramore and Southshore") +local menethilPiers = 0 +for _, p in ipairs(pins) do + if p.kind == "dock" and p.route.stops[p.index][1] == "Menethil Harbor" then menethilPiers = menethilPiers + 1 end +end +check(menethilPiers == 2, "both Menethil piers on Wetlands, got " .. menethilPiers) +check(count("exit") == 0, "no edge marker on top of Menethil's piers, which sit by the map edge") check(visibleLines() > 0, "Wetlands draws the lanes from its docks") -- a zone with no docks shows no lanes, even the ones flying over it