Add a new trigger type statustrigger
StatusTrigger will trigger if a status activates (or reaches a certain activation # of auras). This is an abstraction provided by AuraList which keeps track of which auras belong to which statuses. Added type annotations to all touched files
This commit is contained in:
@@ -16,13 +16,22 @@
|
||||
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
|
||||
local omif = select(2, ...)
|
||||
local types = omif.GetModule("types")
|
||||
|
||||
---@class StatusBar
|
||||
local StatusBar = types.StatusBar
|
||||
|
||||
---@class AuraList
|
||||
local AuraList = types.AuraList
|
||||
|
||||
---@class SquareIndicator
|
||||
local SquareIndicator = types.SquareIndicator
|
||||
|
||||
---@class AuraTrigger
|
||||
local AuraTrigger = types.AuraTrigger
|
||||
|
||||
---@class StatusTrigger
|
||||
local StatusTrigger = types.StatusTrigger
|
||||
|
||||
---@class UnitFrame
|
||||
local UnitFrame = types.CreateClass("UnitFrame")
|
||||
types.UnitFrame = UnitFrame
|
||||
@@ -47,6 +56,8 @@ local colors = {
|
||||
white = {1.0, 1.0, 1.0}
|
||||
}
|
||||
|
||||
---@param unit string
|
||||
---@param config table
|
||||
function UnitFrame:Init(unit, config)
|
||||
local width = config.size.width
|
||||
local height = config.size.height
|
||||
@@ -85,8 +96,8 @@ end
|
||||
function UnitFrame:CreateTriggers(triggers)
|
||||
for _, trigger in ipairs(triggers) do
|
||||
local kind = trigger.kind
|
||||
local indicator = self:CreateIndicator(trigger.indicator)
|
||||
if kind == "AuraTrigger" then
|
||||
local indicator = self:CreateIndicator(trigger.indicator)
|
||||
local at = AuraTrigger:new(
|
||||
trigger.spellId,
|
||||
trigger.own,
|
||||
@@ -95,6 +106,10 @@ function UnitFrame:CreateTriggers(triggers)
|
||||
)
|
||||
at:SetTarget(indicator)
|
||||
self.auras:AddTrigger(at)
|
||||
elseif kind == "StatusTrigger" then
|
||||
local st = StatusTrigger:new(trigger.status, trigger.requiredCount, trigger.invert)
|
||||
st:SetTarget(indicator)
|
||||
self.auras:AddTrigger(st)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user