Commit Graph

90 Commits

Author SHA1 Message Date
asl97 45e1f05ffc Move checking of node that should be ignore above protection checking
firing a laser into a sky while in someone land without hitting anything but air shouldn't get anyone ban
2014-05-06 04:22:51 +02:00
Zefram 00d7c9bdea Refill behaviour for power tools and cans
Supply the on_refill hook for power tools and cans, to perform appropriate
charging.  This is to be used by unified_inventory's creative-mode
refill slot.
2014-04-30 10:49:54 +01:00
Zefram 0294fc8f3a various backward-compatibility aliases 2014-04-30 00:26:45 +01:00
Zefram 03a5375e55 Fix can wear following tool workshop change
The cans used set_RE_wear() to manage their wear bars.  As that now only
sets wear for power tools, the cans need a separate function.
2014-04-30 00:22:02 +01:00
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 70fb21ef36 Fix search for operating flashlight
Having a never-charged flashlight in the hotbar earlier than a charged
flashlight prevented the charged flashlight being found.
2014-04-27 14:43:31 -04:00
Zefram 5c59d97070 Fix discharge of flashlight and sonic screwdriver
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.
2014-04-27 14:43:31 -04:00
Zefram db79675570 Fix flashlight's light generation
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.
2014-04-27 14:43:31 -04:00
Zefram 60c75bce74 Fix flashlight light node declarations
The light and light_off node types should be not_in_creative_inventory,
and should drop nothing.
2014-04-27 14:43:31 -04:00
Zefram e748af927a Fix drill charge usage
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.
2014-04-27 14:43:00 -04:00
Zefram 04c6f5bea3 Improve message about drill control
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.
2014-04-27 14:42:59 -04:00
asl97 628a18977b Add fir leaves to the chainsaw's timber_nodenames 2014-04-22 16:34:14 -04: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 5dd09aeff4 Modify mining drill charges and power usage. Also fix bug with mk3 power usage. 2014-03-30 17:40:54 -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
Vanessa Ezekowitz dc324816db fix a few more tube-based recipes 2014-01-03 22:05:35 -05:00
ShadowNinja 8e2cb0121b Fix mining drill digging in the wrong direction 2013-12-23 16:54:21 -05:00
ShadowNinja dd2962aba6 Rewrite flashlight 2013-12-17 19:57:24 -05:00
ShadowNinja d8437faebc More global localiztions 2013-12-17 19:56:01 -05:00
ShadowNinja 64db3d14d8 Remove duplicate ABM 2013-12-17 14:24:06 -05: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 f3d8b47b20 Add support for minetest.swap_node 2013-12-10 20:14:39 -05:00
ShadowNinja 818a0e5ff0 Add protection support to the sonic screwdriver 2013-12-10 19:52:40 -05:00
Bryant Mairs ef70cbfbf2 Fix lava can being able to hold 16 sources 2013-12-03 11:00:41 -05:00
Vanessa Ezekowitz 9bc99a5d04 fix chainsaw not working 2013-11-06 23:08:28 -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
ShadowNinja be2f30a1a2 Add support for translations via intllib 2013-10-30 13:48:39 -04:00
Vanessa Ezekowitz 4a35d5dd98 fix typo 2013-10-26 07:14:35 -04:00
RealBadAngel 2a54e00677 fix typo 2013-10-25 19:45:06 +02:00
ShadowNinja eac4844175 Fix negative tool discharging and a few other tweaks...
Disable the flashlight by default.
Use itemstack:{get,set}_{metadata,name,wear,...} rather than {to,from}_table.
Improve the style of part of the code of mischelaneous tools
2013-10-18 22:28:32 -04:00
ShadowNinja ee0765804c Partial rewrite 2013-09-17 16:37:56 -04:00
Jonathan Raphael Joachim Kolberg 91329b19a4 Fixed the crafting for mining_drill mk3 2013-07-28 12:45:53 +02:00
RealBadAngel 3bc6cad671 Remove lv, mv, and hv tiers from power tools.
Theyre already tiered with Mk1-3 (at least drill is, more in the future).
Tools can be considered as designed for different tiers of circuits thx to their power needs.
For example Mk3 will require ages to load in LV batbox.
Batboxes load tools timining: LV standard (1000EU), MV 4x faster (4000EU), HV 16x faster (16000EU)
Also since 1EU is the same in any circuit it is possible to move energy from one to another with portable devices like crystals.

Other changes:
- moved charge/discharge functions to battery_boxes_commons.lua
- added UI style backgrounds for all the batboxes
2013-07-17 19:14:01 +02:00
kpoppel fa846989ac Remove file that doesn't seem to have any use.
Fix typing error in register... file
Fix two issues with nuclear reactor and set the burn time to 24h.
2013-07-11 23:01:13 +02:00
ShadowNinja d497429abc Load tools 2013-07-11 15:11:28 -04:00
ShadowNinja 5d470cd753 Move files to subfolders 2013-07-11 12:31:00 -04:00