comparison DependencyLoader/Addon.lua @ 18:e7995d599184 tip

updated pkgmeta fix the inversion in addon:Enable added support for late-loading
author mckenziemc
date Tue, 21 Dec 2010 00:23:57 -0800
parents f825ccf94a89
children
comparison
equal deleted inserted replaced
17:f825ccf94a89 18:e7995d599184
2 -- Represents individual addon modules. 2 -- Represents individual addon modules.
3 3
4 4
5 local addonName, addonTable = ... 5 local addonName, addonTable = ...
6 6
7
8 local debug = addonTable.debug
7 9
8 -- TODO: test if the API functions are quicker with indexes than names. 10 -- TODO: test if the API functions are quicker with indexes than names.
9 -- TODO: modify the dependency stuff to check the Errata module. 11 -- TODO: modify the dependency stuff to check the Errata module.
10 12
11 local Addon, addon = addonTable:NewClass("Addon") 13 local Addon, addon = addonTable:NewClass("Addon")
159 return false 161 return false
160 end 162 end
161 end 163 end
162 164
163 165
166 function addon:CanLoadLate()
167 -- TODO: check Errata module
168 return false
169 end
170
171
164 -- can this addon be force-loaded after the point where the client would enable it? 172 -- can this addon be force-loaded after the point where the client would enable it?
165 function addon:CanForceLoadAfter() 173 function addon:CanForceLoadAfter()
166 -- TODO: check Errata module 174 -- TODO: check Errata module
167 return false 175 return false
168 end 176 end
182 end 190 end
183 191
184 192
185 function addon:Enable() 193 function addon:Enable()
186 if IsLoggedIn() then 194 if IsLoggedIn() then
195 addonTable.classes.Core:RawEnableAddOn(self.name)
196 else
187 addonTable.classes.Core:QueueEnable(self.name) 197 addonTable.classes.Core:QueueEnable(self.name)
188 else
189 addonTable.classes.Core:RawEnableAddOn(self.name)
190 end 198 end
191 end 199 end
192 200
193 201
194 -- NOTE: only call for LoD, not force-loading 202 -- NOTE: only call for LoD, not force-loading
198 addonTable.classes.Core:RawEnableAddOn(self.name) 206 addonTable.classes.Core:RawEnableAddOn(self.name)
199 addonTable.classes.Core:RawLoadAddOn(self.name) 207 addonTable.classes.Core:RawLoadAddOn(self.name)
200 end 208 end
201 209
202 210
211 function addon:LoadLate()
212 classes.Core:RawEnableAddOn(self.name)
213 classes.Core:RawLoadAddOn(self.name)
214 end
215
216
203 function addon:ForceLoad() 217 function addon:ForceLoad()
218 debug("addon:ForceLoad called on", self.name)
219
204 assert(self:CanForceLoad()) 220 assert(self:CanForceLoad())
205 -- TODO: make sure force-loading is available at this time 221 -- TODO: make sure force-loading is available at this time
206 222
207 addonTable.Core:RawEnableAddOn(self.name) -- This should cause the game to also load this addon 223 addonTable.Core:RawEnableAddOn(self.name) -- This should cause the game to also load this addon
208 end 224 end