summaryrefslogtreecommitdiff
path: root/wrench/support.lua
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2014-04-22 17:04:18 +0100
committerShadowNinja <shadowninja@minetest.net>2014-04-22 12:48:55 -0400
commitdb202503713ddd1084f188a5eac506be665e9c44 (patch)
tree31b222e6ac4bd7f361703079f328da59b08063b7 /wrench/support.lua
parent44dbc75b6115d5235ba0538925e44484037459a1 (diff)
Fix laser discharging
Commit a6dae893d66319739e8dfe962f67285221eb9b91 introduced per-version charge cost for firing mining lasers, but applies this in addition to the old fixed cost which it was meant to replace. Fix by removing the application of the fixed cost. The same commit did successfully change the check for a laser having sufficient charge to fire, so that's based purely on the variable cost. As a consequence, firing a laser that has just enough charge to cover the variable cost could cause its charge to go negative. (For example, by fully charging a Mk1 laser and then firing it until it empties, resulting in a charge of -400.) It turned out that set_RE_wear handled that badly, producing an over-100% wear value that would wrap to a *low* wear value, leading to the laser's wear bar looking as if it's fully charged. To protect against silly wear values, make set_RE_wear clamp the wear value to avoid wrapping. Handle specially the case of a fully-discharged tool, where there was desirable wrapping to zero.
Diffstat (limited to 'wrench/support.lua')
0 files changed, 0 insertions, 0 deletions