Commit Graph

9 Commits

Author SHA1 Message Date
Zefram 99fd5dfee5 Genericise handling of multiple meanings of wear
The tool workshop is meant to repair mechanical damage to tools, so
is at risk of `repairing' tools that use the wear bar to represent
something other than mechanical wear.  It had special-case recognition
of the water and lava cans, which use the wear bar to represent how much
content they're carrying, and wouldn't repair them.  But it didn't avoid
`repairing' RE chargeable items, which use the wear bar to represent
how much energy they have stored.  It would modify the wear bar without
actually affecting the charge, so the wear bar would jump back to the
correct place when the next charging or discharging event occurred.

To genericise, introduce a new item property, "wear_represents", which
indicates how the wear bar is used for this item.  Currently defined
values are "mechanical_wear" (straightforward damage to tools that
start out perfect), "technic_RE_charge" (electrical energy, canonically
represented in the meta rather than the wear bar), and "content_level"
(how full a container is).  For backcompat, nil is interpreted as
"mechanical_wear".  The tool workshop will only repair "mechanical_wear"
tools.  As a bonus, set_RE_wear() will only set the wear bar for
"technic_RE_charge" items: this means developers will notice if they
forget to declare wear_represents, but also means that with no further
changes it's possible to have an RE chargeable item that uses its wear
bar to represent something else.
2014-04-30 00:21:55 +01:00
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
ShadowNinja 7dc21cec40 Fix steel ingot item name in laser Mk1 crafting recipe 2014-04-02 23:03:51 -04:00
Bryant Mairs a6dae893d6 Modify the cost, range, and cost-per-shot of all 3 lasers. 2014-03-30 17:40:54 -04:00
Bryant Mairs 49052d6f4a Revised recipe for mk1 laser and added mk2 & mk3 laser recipes. 2014-03-30 17:40:54 -04:00
ShadowNinja bab8517b2a Add protection support to tools
This adds support to the chainsaw, mining drill, mining laser,
sonic screwdriver, and tree tap.
2013-12-17 14:22:10 -05:00
ShadowNinja 5cf765b2f1 Localize most variables 2013-12-17 13:56:37 -05:00
ShadowNinja 2d7c1d7252 Readd craft recipe for the Mk1 mining laser 2013-10-30 15:18:18 -04:00
HybridDog f90915c408 Add Mk2 and Mk3 mining lasers 2013-10-30 15:09:31 -04:00