Jump to content

[Gameplay?] Potential bug in Cooldown component


Recommended Posts

Bug Submission

 

Please choose a category

 

[Gameplay/code]

 

Platform

 

Steam

 

Do you use mods?

yes (found bug in game file though)

Version Number

 

Rev. 134052 (where there's a wilson)

Describe your issue
 

While modding, I discovered a potential bug in the component "cooldown". It's negligible since the game doesn't use this component a lot, but I wanted to mention it nontheless. Basically, it uses the default cooldown time even when you give it a special one.

 

function Cooldown:StartCharging(time)
   
time = time or self.cooldown_duration
    self.charged = false
    self.cooldown_deadline = GetTime() +
time

    if self.cooldown_deadline <= 0 then
        donecharging(self.inst)
        if self.startchargingfn then
            self.startchargingfn(self.inst)
        end
        return
    end

    self.inst:DoTaskInTime(self.
cooldown_duration, donecharging) --not using "time"
    if self.startchargingfn then
        self.startchargingfn(self.inst)
    end
end

 

Thank you for your attention.

Link to comment
Share on other sites

Another bug: the following function uses "cooldown_duration" rather than "cooldown_deadline". The former is never set by the component (but due to the above problem, needed).

 

function Cooldown:IsCharging()
    return not self.charged and self.
cooldown_duration
end

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...