technic/technic/tools
Zefram db20250371 Fix laser discharging
Commit a6dae893d6 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.
2014-04-22 12:48:55 -04:00
..
cans.lua Fix lava can being able to hold 16 sources 2013-12-03 11:00:41 -05:00
chainsaw.lua Add protection support to tools 2013-12-17 14:22:10 -05:00
flashlight.lua Rewrite flashlight 2013-12-17 19:57:24 -05:00
init.lua Add Mk2 and Mk3 mining lasers 2013-10-30 15:09:31 -04:00
mining_drill.lua Modify mining drill charges and power usage. Also fix bug with mk3 power usage. 2014-03-30 17:40:54 -04:00
mining_lasers.lua Fix laser discharging 2014-04-22 12:48:55 -04:00
sonic_screwdriver.lua Add protection support to tools 2013-12-17 14:22:10 -05:00
tree_tap.lua fix a few more tube-based recipes 2014-01-03 22:05:35 -05:00