diff --git a/Radar.lua b/Radar.lua index 1e2e473..c831bae 100644 --- a/Radar.lua +++ b/Radar.lua @@ -7,6 +7,12 @@ local Builder = Tinkr.Util.GUIBuilder:New { } local nodes = { + -- Fishing nods + [451678] = {name = "Blood in the Water", type = "fishing" }, + [451669] = {name = "Glimmerpool", type = "fishing" }, + [451670] = {name = "Calm Surfacing Ripple", type = "fishing" }, + [451680] = {name = "Royal Ripple", type = "fishing" }, + -- Mining nodes [413047] = {name = "Aqirite", type = "mining"}, [434556] = {name = "Aqirite Chunk", type = "mining"}, @@ -240,6 +246,9 @@ local function DrawNode(draw, nodeInfo, nx, ny, nz, objectId) elseif nodeType == "herb" and Builder:GetConfig("show_herbs") == "yes" and Builder:GetConfig("show_herb_" .. objectId) == "yes" then color = {0, 255, 0} shouldDraw = true + elseif nodeType == "fishing" and Builder:GetConfig("show_fish") == "yes" and Builder:GetConfig("show_fish_" .. objectId) == "yes" then + color = {255, 0, 0} + shouldDraw = true end if shouldDraw then @@ -257,19 +266,35 @@ local function DrawNode(draw, nodeInfo, nx, ny, nz, objectId) end Draw:Sync(function(draw) + local px, py, pz = ObjectPosition('player') + local nearestNode = nil + local nearestDist = 100000 -- Start with a very large distance + for _, object in ipairs(Objects()) do - if ObjectType(object) == 8 then + if ObjectType(object) == 8 then local objectId = ObjectId(object) local nodeInfo = GetNodeInfo(objectId) - - if nodeInfo and ObjectLootable(object) then - local nx, ny, nz = ObjectRawPosition(object) - DrawNode(draw, nodeInfo, nx, ny, nz, objectId) + + if nodeInfo then + local nx, ny, nz = ObjectPosition(object) + local dist = ObjectDistance('player',object) + + -- Check if this node is the nearest so far + if dist and dist < nearestDist then + nearestNode = { nodeInfo = nodeInfo, nx = nx, ny = ny, nz = nz, objectId = objectId } + nearestDist = dist + end end end end + + -- Draw the nearest node if one was found + if nearestNode then + DrawNode(draw, nearestNode.nodeInfo, nearestNode.nx, nearestNode.ny, nearestNode.nz, nearestNode.objectId) + end end) + -- Modify the SavePreferences function local function SavePreferences() for id, node in pairs(nodes) do @@ -295,6 +320,11 @@ local MainSettingsTab = Builder:Tab { -- description = "Toggle visibility of herb nodes.", default = "yes" }, + Builder:Checkbox { + key = "show_fish", + label = "Show School of Fish", + default = "yes" + }, Builder:Checkbox { key = "draw_lines", label = "Draw Lines to Nodes", @@ -343,6 +373,24 @@ local DetailedFilterTab = Builder:Tab { return elements end)() }, + Builder:Group { + key = "fish_nodes_group", + title = "School of Fish", + content = (function() + local elements = {} + for id, node in pairs(nodes) do + if node.type == "fishing" then + table.insert(elements, Builder:Checkbox { + key = "show_fish_" .. id, + label = node.name, + -- description = "Toggle visibility of " .. node.name, + default = "yes" + }) + end + end + return elements + end)() + }, Builder:Button { key = "save_preferences_button", text = "Save Preferences", diff --git a/readme.md b/readme.md index c6b7bcb..fded959 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ This Lua script creates a radar-like visualization for mining and herb nodes in If you find this script helpful, please consider supporting the developer: -🎁 **[Tip the Developer](https://coindrop.to/okrotations)** 🎁 +🎁 **[Tip the Developer](https://coindrop.to/skippylol)** 🎁 Your support helps maintain and improve this project. Thank you!