Commit 394622adabded2123d3b507d2377ffd544f94733
1 parent
55016cf1
Fix talent ignore resource when lua error on item skill
Using item talent will temporary set force_talent_ignore_ressources to avoid using resources. However, it will not reset the flag when a lua error happen and exit this function This patch will fix this problem
Showing
1 changed file
with
6 additions
and
1 deletions
... | ... | @@ -248,7 +248,12 @@ function _M:useObject(who, ...) |
248 | 248 | else |
249 | 249 | local ok, special |
250 | 250 | ok, ret, special = xpcall(function() return ab.action(who, ab) end, debug.traceback) |
251 | - if not ok then who:onTalentLuaError(ab, ret) error(ret) end | |
251 | + if not ok then | |
252 | + who:attr("force_talent_ignore_ressources", -1) | |
253 | + who.talents[id] = old_level | |
254 | + who:onTalentLuaError(ab, ret) | |
255 | + error(ret) | |
256 | + end | |
252 | 257 | end |
253 | 258 | who:attr("force_talent_ignore_ressources", -1) |
254 | 259 | who.talents[id] = old_level | ... | ... |
-
Please register or login to post a comment