Mercurial > wow > dependencyloader
diff DependencyLoader/Addon.lua @ 10:e0a4a8b5b389
lots more modifications...
author | mckenziemc |
---|---|
date | Sun, 05 Dec 2010 03:10:07 -0800 |
parents | 5362e308c3eb |
children | b230b94d4487 |
line wrap: on
line diff
--- a/DependencyLoader/Addon.lua Sun Dec 05 00:12:57 2010 -0800 +++ b/DependencyLoader/Addon.lua Sun Dec 05 03:10:07 2010 -0800 @@ -1,27 +1,16 @@ -- Addon --- Represents individual addon modules +-- Represents individual addon modules. local addonName, addonTable = ... --- NOTE: I assume that the API addon functions are --- slightly quicker with an index than with a number. - --- TODO: modify the dependency stuff to use the Errata module if available +-- TODO: test if the API functions are quicker with indexes than names. +-- TODO: modify the dependency stuff to check the Errata module. local Addon, addon = addonTable:NewClass("Addon") --- load ability masks -Addon.loadMasks = { - reload = bit.lshift(1, 0), -- can load after reloadui - ondemand = bit.lshift(1, 1), -- can load on demand - forceafter = bit.lshift(1, 2), -- force load after it would normally be loaded - forcebefore = bit.lshift(1, 3), -- force load before it would normally be loaded -} - - Addon.addons = {} Addon.nameToIndex = {} @@ -91,6 +80,7 @@ end end + -- Checks if an addon exists with the specified name. -- @param addon Name of the addon. -- @return True if the addon is present, false otherwise. @@ -115,11 +105,6 @@ end -function Addon:GetLoadMasks() - return self.masks -end - - function addon:GetName() return self.name end @@ -142,29 +127,6 @@ end -function addon:GetLoadBitfield() - local bitfield = 0 - - if self:CanLoad() then - bitfield = bitfield + self.masks.reload - end - - if self:CanLoD() then - bitfield = bitfield + self.masks.ondemand - end - - if self:CanForceLoadAfter() then - bitfield = bitfield + self.masks.forceafter - end - - if self:CanForceLoadBefore() then - bitfield = bitfield + self.masks.forcebefore - end - - return bitfield -end - - --- Checks if the addon is loadable. -- Considers interface issues, missing, etc. (NYI) -- Does not check dependencies. @@ -196,6 +158,12 @@ end +function addon:CanForceLoad() + -- FIXME: check if this would've already been loaded + return self:CanForceLoadAfter() +end + + function addon:Enable() -- FIXME: delay this till after PLAYER_LOGIN or it'll get force-loaded EnableAddOn(self.name)