Auto Hide Options Overhaul

This commit is contained in:
Tercio Jose
2020-06-27 18:13:07 -03:00
parent 2d40243d25
commit e6dec35beb
12 changed files with 220 additions and 33 deletions
+39 -5
View File
@@ -24,12 +24,29 @@ do
WidgetType = "panel",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,
dversion = DF.dversion,
}
_G [DF.GlobalWidgetControlNames ["panel"]] = _G [DF.GlobalWidgetControlNames ["panel"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["panel"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["panel"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["panel"]] = metaPrototype
end
end
local PanelMetaFunctions = _G [DF.GlobalWidgetControlNames ["panel"]]
local PanelMetaFunctions = _G[DF.GlobalWidgetControlNames ["panel"]]
--> mixin for options functions
DF.OptionsFunctions = {
@@ -7087,10 +7104,27 @@ DF.StatusBarFunctions = {
WidgetType = "healthBar",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,
}
_G [DF.GlobalWidgetControlNames ["healthBar"]] = _G [DF.GlobalWidgetControlNames ["healthBar"]] or healthBarMetaPrototype
local healthBarMetaFunctions = _G [DF.GlobalWidgetControlNames ["healthBar"]]
dversion = DF.dversion,
}
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["healthBar"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["healthBar"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(healthBarMetaPrototype) do
oldMetaPrototype[funcName] = healthBarMetaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["healthBar"]] = healthBarMetaPrototype
end
local healthBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["healthBar"]]
--hook list
local defaultHooksForHealthBar = {