Skip to content
Snippets Groups Projects
Commit 11f61356 authored by dg's avatar dg
Browse files

Wearing an item with charges/cooldown will reset them to 0 to prevent abuse

Quick-switch will not reset cooldown of items


git-svn-id: http://svn.net-core.org/repos/t-engine4@4779 51575b47-30f0-44d4-a5cc-537603b46e54
parent 9b5c727d
No related branches found
No related tags found
No related merge requests found
......@@ -947,6 +947,9 @@ function _M:quickSwitchWeapons()
if not mh1 or not mh2 or not oh1 or not oh2 then return end
-- Do not reset power of switched items
self.no_power_reset_on_wear = true
local mhset1, mhset2 = {}, {}
local ohset1, ohset2 = {}, {}
local pfset1, pfset2 = {}, {}
......@@ -989,12 +992,24 @@ function _M:quickSwitchWeapons()
end
end
self.no_power_reset_on_wear = nil
self:playerCheckSustains()
game.logPlayer(self, "You switch your weapons to: %s.", names)
self.changed = true
end
--- Call when an object is worn
-- This doesnt call the base interface onWear, it copies the code because we need some tricky stuff
function _M:onWear(o, bypass_set)
mod.class.Actor.onWear(self, o, bypass_set)
if not self.no_power_reset_on_wear then
o:forAllStack(function(so) if so.power and so:attr("power_regen") then so.power = 0 end end)
end
end
-- Go through all sustained talents and turn them off if pre_use fails
function _M:playerCheckSustains()
for tid, _ in pairs(self.talents) do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment