|
|
|
@ -184,26 +184,6 @@ Bastion.Globals.EventManager:RegisterWoWEvent("COMBAT_LOG_EVENT_UNFILTERED", fun |
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
Bastion.Ticker = C_Timer.NewTicker(0.1, function() |
|
|
|
|
|
|
|
if not Bastion.CombatTimer:IsRunning() and UnitAffectingCombat("player") then |
|
|
|
|
|
|
|
Bastion.CombatTimer:Start() |
|
|
|
|
|
|
|
elseif Bastion.CombatTimer:IsRunning() and not UnitAffectingCombat("player") then |
|
|
|
|
|
|
|
Bastion.CombatTimer:Reset() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Bastion.Enabled then |
|
|
|
|
|
|
|
Bastion.ObjectManager:Refresh() |
|
|
|
|
|
|
|
for i = 1, #MODULES do |
|
|
|
|
|
|
|
MODULES[i]:Tick() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Bastion:Register(module) |
|
|
|
|
|
|
|
table.insert(MODULES, module) |
|
|
|
|
|
|
|
Bastion:Print("Registered", module) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Find a module by name |
|
|
|
-- Find a module by name |
|
|
|
function Bastion:FindModule(name) |
|
|
|
function Bastion:FindModule(name) |
|
|
|
for i = 1, #MODULES do |
|
|
|
for i = 1, #MODULES do |
|
|
|
@ -392,6 +372,58 @@ end |
|
|
|
-- return |
|
|
|
-- return |
|
|
|
-- end |
|
|
|
-- end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Bastion:OnTick() |
|
|
|
|
|
|
|
for i = 1, #MODULES do |
|
|
|
|
|
|
|
MODULES[i]:OnTick() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local lastTick = 0 |
|
|
|
|
|
|
|
local timeElapsed = 0 |
|
|
|
|
|
|
|
local configTickRate = .01 |
|
|
|
|
|
|
|
Bastion.tickRate = 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Bastion:GetMinummTickRate() |
|
|
|
|
|
|
|
local fr = GetFrameRate() |
|
|
|
|
|
|
|
local minTick = 1/fr |
|
|
|
|
|
|
|
return minTick |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Bastion:GetTickRate() |
|
|
|
|
|
|
|
local min = Bastion:GetMinummTickRate() |
|
|
|
|
|
|
|
return math.max(min, configTickRate) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Bastion:GetTick() |
|
|
|
|
|
|
|
return GetTime() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Bastion:Ticker() |
|
|
|
|
|
|
|
if not Bastion.CombatTimer:IsRunning() and UnitAffectingCombat("player") then |
|
|
|
|
|
|
|
Bastion.CombatTimer:Start() |
|
|
|
|
|
|
|
elseif Bastion.CombatTimer:IsRunning() and not UnitAffectingCombat("player") then |
|
|
|
|
|
|
|
Bastion.CombatTimer:Reset() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
if Bastion.Enabled then |
|
|
|
|
|
|
|
Bastion.ObjectManager:Refresh() |
|
|
|
|
|
|
|
for i = 1, #MODULES do |
|
|
|
|
|
|
|
MODULES[i]:Tick() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local tickFrame = CreateFrame("FRAME", "ticker") |
|
|
|
|
|
|
|
tickFrame:HookScript("OnUpdate", function(self, elapsed) |
|
|
|
|
|
|
|
timeElapsed = timeElapsed + elapsed |
|
|
|
|
|
|
|
while (timeElapsed > Bastion.tickRate) do |
|
|
|
|
|
|
|
timeElapsed = timeElapsed - Bastion.tickRate |
|
|
|
|
|
|
|
Bastion:Ticker() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
Bastion.tickRate = Bastion:GetTickRate() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
Load("@Libraries/") |
|
|
|
Load("@Libraries/") |
|
|
|
Load("@Modules/") |
|
|
|
Load("@Modules/") |
|
|
|
Load("@") |
|
|
|
Load("@") |
|
|
|
|