1.0.3 fix for deleted üath and branched to master
generic [05-09-22 - 10:15]
1.0.3 fix for deleted üath and branched to master
diff --git a/HarvestRoute.lua b/HarvestRoute.lua
index 97b8457..ce562d0 100644
--- a/HarvestRoute.lua
+++ b/HarvestRoute.lua
@@ -1,7 +1,7 @@
HarvestRoute = {}
HarvestRoute.name = "HarvestRoute"
HarvestRoute.displayName = 'HarvestRoute for Harvestmap'
-HarvestRoute.version = "1.0.2"
+HarvestRoute.version = "1.0.3"
HarvestRoute.author = "generic"
HarvestRoute.settingsVersion = 1
@@ -30,24 +30,27 @@ local function initialize( eventCode, addOnName )
return
end
local padding = 30
- local control = WINDOW_MANAGER:CreateControl(nil, HarvestFarmGenerator, CT_LABEL)
- control:SetFont("ZoFontGame")
- control:SetText(HarvestRoute.GetLocalization( "tourtrackerdescription" ))
- control:SetAnchor(TOPLEFT, Harvest.farm.generator.generatorBar , BOTTOMLEFT, 0, 10)
- control:SetWidth(HarvestFarmGenerator:GetWidth() - padding)
- local lastControl = control
-
local control = WINDOW_MANAGER:CreateControlFromVirtual('HarvestRouteButton', HarvestFarmGenerator, "ZO_DefaultButton")
control:SetText(HarvestRoute.GetLocalization( "buttonstarttracker" ))
- control:SetAnchor(TOPLEFT, lastControl, BOTTOMLEFT, 0, 20)
+ control:SetAnchor(TOPLEFT, Harvest.farm.generator.generatorBar , BOTTOMLEFT, 0, 10)
control:SetWidth(HarvestFarmGenerator:GetWidth() - padding)
control:SetClickSound("Click")
control:SetHandler("OnClicked", HarvestRoute.OnButton )
HarvestRouteButton = control
+ local lastControl = control
+
+ local control = WINDOW_MANAGER:CreateControl(nil, HarvestFarmGenerator, CT_LABEL)
+ control:SetFont("ZoFontGame")
+ control:SetText(HarvestRoute.GetLocalization( "tourtrackerdescription" ))
+ control:SetAnchor(TOPLEFT, lastControl, BOTTOMLEFT, 0, 20)
+ control:SetWidth(HarvestFarmGenerator:GetWidth() - padding)
HarvestRoute.savedVars = ZO_SavedVars:NewAccountWide("HarvestRoute", HarvestRoute.settingsVersion, nil, HarvestRoute.defaultSettings)
HarvestRoute.InitializeSettingsMenu()
EVENT_MANAGER:RegisterForEvent("HarvestRoutePlayerActivated", EVENT_PLAYER_ACTIVATED, HarvestRoute.OnPlayerLoaded )
+
+ Harvest.callbackManager:RegisterForEvent(Harvest.events.TOUR_CHANGED, HarvestRoute.checkPath )
+
end
function HarvestRoute:InitializeSettingsMenu()
@@ -111,6 +114,15 @@ function HarvestRoute:OnPlayerLoaded()
end
end
+-- hacky, but should do the trick: reset pathnodes when path has changed from outside
+function HarvestRoute:checkPath(event, path)
+ local index = Farm.path:GetIndex(pathNodeId)
+ if not index then
+ pathNodeId = nil
+ pathNodes = {}
+ end
+end
+
function HarvestRoute:OnUpdate (time)
if isActive then
local nodeId = HarvestRoute:GetClosestNode()
diff --git a/HarvestRoute.txt b/HarvestRoute.txt
index 5ed7b0e..8d0cce8 100644
--- a/HarvestRoute.txt
+++ b/HarvestRoute.txt
@@ -1,7 +1,7 @@
## Title: HarvestRoute
## Author: generic
## APIVersion: 101034 101033
-## AddOnVersion: 314999
+## AddOnVersion: 2
## DependsOn: HarvestMap LibAddonMenu-2.0>=32