Added option to ignore custom lag tolerance for lag indicators

This allows the user to override the fact that they've set a custom lag tolerance in the game's options and instead have the mod display the computed latency. (ticket #201)
This commit is contained in:
Parnic
2015-12-22 01:14:42 -06:00
parent 7421f916ad
commit c4adadb301
2 changed files with 40 additions and 2 deletions

View File

@ -34,6 +34,7 @@ function CastBar.prototype:GetDefaultSettings()
settings["usesDogTagStrings"] = false settings["usesDogTagStrings"] = false
settings["rangeColor"] = true settings["rangeColor"] = true
settings["bAllowExpand"] = false settings["bAllowExpand"] = false
settings["respectLagTolerance"] = true
return settings return settings
end end
@ -118,6 +119,24 @@ function CastBar.prototype:GetOptions()
order = 43 order = 43
} }
opts["respectLagTolerance"] =
{
type = 'toggle',
name = L["Respect lag tolerance"],
desc = L["When checked, if a 'Custom Lag Tolerance' is set in the game's Combat options, the lag indicator will always use that tolerance value. Otherwise, it uses the computed latency."],
get = function()
return self.moduleSettings.respectLagTolerance
end,
set = function(info, value)
self.moduleSettings.respectLagTolerance = value
self:CVarUpdate()
end,
disabled = function()
return not self.moduleSettings.enabled or GetCVar("reducedLagTolerance") == "0"
end,
order = 42.1,
}
opts["barVisible"] = { opts["barVisible"] = {
type = 'toggle', type = 'toggle',
name = L["Bar visible"], name = L["Bar visible"],
@ -338,7 +357,7 @@ function CastBar.prototype:CheckVehicle()
end end
function CastBar.prototype:CVarUpdate(...) function CastBar.prototype:CVarUpdate(...)
self.useFixedLatency = GetCVar("reducedLagTolerance") == "1" self.useFixedLatency = self.moduleSettings.respectLagTolerance and GetCVar("reducedLagTolerance") == "1"
self.fixedLatency = tonumber(GetCVar("maxSpellStartRecoveryoffset")) / 1000 self.fixedLatency = tonumber(GetCVar("maxSpellStartRecoveryoffset")) / 1000
end end

View File

@ -44,7 +44,7 @@ function GlobalCoolDown.prototype:Enable(core)
end end
function GlobalCoolDown.prototype:CVarUpdate() function GlobalCoolDown.prototype:CVarUpdate()
self.useFixedLatency = GetCVar("reducedLagTolerance") == "1" self.useFixedLatency = self.moduleSettings.respectLagTolerance and GetCVar("reducedLagTolerance") == "1"
self.fixedLatency = tonumber(GetCVar("maxSpellStartRecoveryoffset")) / 1000.0 self.fixedLatency = tonumber(GetCVar("maxSpellStartRecoveryoffset")) / 1000.0
end end
@ -66,6 +66,7 @@ function GlobalCoolDown.prototype:GetDefaultSettings()
settings["barVisible"]["bg"] = false settings["barVisible"]["bg"] = false
settings["bAllowExpand"] = false settings["bAllowExpand"] = false
settings["lagAlpha"] = 0.7 settings["lagAlpha"] = 0.7
settings["respectLagTolerance"] = true
return settings return settings
end end
@ -114,6 +115,24 @@ function GlobalCoolDown.prototype:GetOptions()
order = 42 order = 42
} }
opts["respectLagTolerance"] =
{
type = 'toggle',
name = L["Respect lag tolerance"],
desc = L["When checked, if a 'Custom Lag Tolerance' is set in the game's Combat options, the lag indicator will always use that tolerance value. Otherwise, it uses the computed latency."],
get = function()
return self.moduleSettings.respectLagTolerance
end,
set = function(info, value)
self.moduleSettings.respectLagTolerance = value
self:CVarUpdate()
end,
disabled = function()
return not self.moduleSettings.enabled or GetCVar("reducedLagTolerance") == "0"
end,
order = 42.1,
}
return opts return opts
end end