mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- added tons of divide-by-zero protection all over the place
- general cleanup of values passed to UpdateBar
This commit is contained in:
@ -135,10 +135,10 @@ function IceCastBar.prototype:OnUpdate()
|
||||
-- handle casting and channeling
|
||||
if (self.action == IceCastBar.Actions.Cast or self.action == IceCastBar.Actions.Channel) then
|
||||
local remainingTime = self.actionStartTime + self.actionDuration - time
|
||||
local scale = 1 - (remainingTime / self.actionDuration)
|
||||
local scale = 1 - (self.actionDuration > 0 and remainingTime / self.actionDuration or 0)
|
||||
|
||||
if (self.action == IceCastBar.Actions.Channel) then
|
||||
scale = remainingTime / self.actionDuration
|
||||
scale = self.actionDuration > 0 and remainingTime / self.actionDuration or 0
|
||||
end
|
||||
|
||||
if (remainingTime < 0) then
|
||||
|
Reference in New Issue
Block a user