Activate indicators when they are set while the trigger is active

This fixes an issue where inverted triggers would not immediately activate the
indicator when they are created
This commit is contained in:
2023-04-04 16:31:16 +02:00
parent 8d2f3cef7f
commit e55f139fca

View File

@@ -26,7 +26,6 @@ local types = omi.GetModule("types")
local Trigger = types.CreateClass("Trigger") local Trigger = types.CreateClass("Trigger")
types.Trigger = Trigger types.Trigger = Trigger
--- Initialize a new Trigger object --- Initialize a new Trigger object
---@param invert boolean|nil ---@param invert boolean|nil
function Trigger:Init(invert) function Trigger:Init(invert)
@@ -41,6 +40,9 @@ end
---@param target Indicator ---@param target Indicator
function Trigger:SetTarget(target) function Trigger:SetTarget(target)
self.indicator = target self.indicator = target
if self.active then
target:Show()
end
end end
---Set the state of the trigger. Will activate the indicator if needed. ---Set the state of the trigger. Will activate the indicator if needed.