Skip to content

Commit

Permalink
Fix Bubble Orb destroy timer logic (#787)
Browse files Browse the repository at this point in the history
Closes: #785
  • Loading branch information
Trildar authored and chrisinajar committed May 20, 2017
1 parent 9273d63 commit 2f25a16
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions game/scripts/vscripts/items/reflex/preemptive_bubble.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function modifier_item_preemptive_bubble_aura_block:OnCreated(keys)
self.bubbleCenter = self:GetParent():GetOrigin()
self.caster = self:GetCaster()
self.casterTeam = self.caster:GetTeamNumber()
self.bubbleIdentifier = "BubbleOrbID: " .. self.casterTeam .. "," .. self.bubbleCenter.x .. "," .. self.bubbleCenter.y
self.bubbleID = "BubbleOrbID: " .. self.casterTeam .. "," .. self.bubbleCenter.x .. "," .. self.bubbleCenter.y
self.ability = self:GetAbility()
self.radius = self.ability:GetSpecialValueFor("radius")
self.aura_stickiness = self.ability:GetSpecialValueFor("aura_stickiness")
Expand Down Expand Up @@ -103,10 +103,11 @@ function modifier_item_preemptive_bubble_aura_block:OnIntervalThink()
end

local duplicateModifier = nth(1, filter(IsFromThisBubble, bubbleModifiers))
local bubbleModifierID = self.bubbleID .. "," .. unit:entindex()
-- If the unit already has a modifier with the same center then refresh its timer
if duplicateModifier then
Timers:RemoveTimer(self.bubbleIdentifier)
Timers:CreateTimer(self.bubbleIdentifier, {
Timers:RemoveTimer(bubbleModifierID)
Timers:CreateTimer(bubbleModifierID, {
endTime = self.aura_stickiness,
callback = function()
duplicateModifier:Destroy()
Expand All @@ -117,7 +118,7 @@ function modifier_item_preemptive_bubble_aura_block:OnIntervalThink()
aura_origin_x = self.bubbleCenter.x,
aura_origin_y = self.bubbleCenter.y
})
Timers:CreateTimer(self.bubbleIdentifier, {
Timers:CreateTimer(bubbleModifierID, {
endTime = self.aura_stickiness,
callback = function()
newBubbleModifier:Destroy()
Expand Down

0 comments on commit 2f25a16

Please sign in to comment.