These two tools wouldn't discharge all the way to zero through use,
unlike most chargeable items.
Incidentally remove a duplicate of the check_for_flashlight() function.
The flashlight was lighting the wrong node, 1 m east of the player's lower
half, thus getting no light if the player is adjacent to an eastern wall.
Restore the old 1 m above, that coincides with the player's hands.
There was a problem with light from the flashlight getting stuck in
the map. This arises because the flashlight's light value was 15, the
reserved value that the engine uses for sunlight. Moving the flashlight
upwards, by jumping while it is equipped, would cause the node below it to
acquire a bogus sunlit state. Fix this by reducing the flashlight's light
value to 14 (LIGHT_MAX), which is the maximum permitted for non-sunlight.
The light_off node type is not required. With the light value limited
to 14, mere removal of the light node suffices to correctly recalculate
lighting.
All log messages about moving stuff in/into/from chests described them
as "locked", whether the chests are locked or not. Remove that word,
so the messages make no claim about lockedness.
The drills weren't taking the variable usage cost into account (either
the per-type base cost or the per-mode multiplier) when deciding whether
they have sufficient charge to use. This could cause them to overshoot in
charge usage, although they would then clamp to zero rather than record
negative charge. Also, for the Mk1 drill where the cost was assessed
correctly, the drill would refuse to discharge to exactly zero charge.
The message to "hold shift" makes an unwarranted assumption about the
user's keybindings. Messages from the server should refer to a key's
game function, rather than its extragame identity.
the first-seen tier for which the machine was registered. So the
switching station, which is uniquely registered for all tiers, would
only visually connect to LV cable when placed, not to MV or HV cable.
(It would function nevertheless, and cable would connect to the switching
station if placed later.) Change to consider all tiers. Incidentally
avoid a gratuitous iteration through all registered machines.
When using the form to edit a chest label, apply the edited label whenever the
form is submitted with the text field included, rather than only if the form's
specific "finished editing" button is used. This supports the natural use of
<ret> to indicate that text editing is complete, which works with other text
editing forms such as that for signs.
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.