| | |
| | | end |
| | | |
| | | --check tool charge |
| | | local meta = minetest.deserialize(itemstack:get_metadata()) |
| | | if not meta or not meta.charge or |
| | | meta.charge < xnopick_charge_per_node |
| | | local meta = technic.get_stack_meta(itemstack) |
| | | local charge = meta:get_int("technic:charge") |
| | | |
| | | if not meta or not charge or |
| | | charge < xnopick_charge_per_node |
| | | then |
| | | minetest.sound_play("technic_prospector_miss", {pos = pos, gain = 1.0, max_hear_distance = 10}) |
| | | |
| | | return |
| | | end |
| | | |
| | | --check node protection |
| | | if minetest.is_protected(pos, user:get_player_name()) then |
| | | minetest.record_protection_violation(pos, user:get_player_name()) |
| | | local name = user:get_player_name() |
| | | if minetest.is_protected(pos, name) then |
| | | minetest.record_protection_violation(pos, name) |
| | | return |
| | | end |
| | | |
| | |
| | | |
| | | -- Send current charge to digging function so that the |
| | | -- chainsaw will stop after digging a number of nodes |
| | | meta.charge = collect_block_node(user, pos, meta.charge) |
| | | charge = collect_block_node(user, pos, charge) |
| | | minetest.sound_play("technic_laser_mk3", {pos = pos, gain = 1.0, max_hear_distance = 10}) |
| | | |
| | | if not technic.creative_mode then |
| | | technic.set_RE_wear(itemstack, meta.charge, xnopick_max_charge) |
| | | itemstack:set_metadata(minetest.serialize(meta)) |
| | | technic.set_RE_wear(itemstack, charge, xnopick_max_charge) |
| | | meta:set_int("technic:charge", charge) |
| | | end |
| | | return itemstack |
| | | |