| | |
| | | |
| | | if node_name:match("default:.*_with_.*") or |
| | | node_name:match("default:coalblock") or |
| | | node_name:match("default:mese") or |
| | | node_name:match("technic:mineral_.*") or |
| | | node_name:match("xtraores:.*_ore") or |
| | | node_name:match("underch:.*_ore") or |
| | | -- underch:black_eye_ore |
| | | node_name:match("underch:coal_dust") or |
| | | node_name:match("underch:coal_diamond") or |
| | | node_name:match("moreores:mineral_.*") or |
| | |
| | | return false |
| | | end |
| | | |
| | | function handle_node_drops(pos, drops, digger) |
| | | -- Add dropped items to object's inventory |
| | | local inv = digger and digger:get_inventory() |
| | | local give_item |
| | | if inv then |
| | | give_item = function(item) |
| | | return inv:add_item("main", item) |
| | | end |
| | | else |
| | | give_item = function(item) |
| | | -- itemstring to ItemStack for left:is_empty() |
| | | return ItemStack(item) |
| | | end |
| | | end |
| | | |
| | | for _, dropped_item in pairs(drops) do |
| | | local left = give_item(dropped_item) |
| | | if not left:is_empty() then |
| | | local p = { |
| | | x = pos.x + math.random()/2-0.25, |
| | | y = pos.y + math.random()/2-0.25, |
| | | z = pos.z + math.random()/2-0.25, |
| | | } |
| | | minetest.add_item(p, left) |
| | | minetest.sound_play("item_drop_pickup", {pos = pos, gain = 1.0, max_hear_distance = 10}) |
| | | end |
| | | end |
| | | end |
| | | |
| | | |
| | | local function collect_node(user, pos, current_charge) |
| | | if current_charge < xnopick_charge_per_node then |
| | | minetest.sound_play("technic_prospector_miss", {pos = pos, gain = 1.0, max_hear_distance = 10}) |
| | | return current_charge |
| | | end |
| | | |
| | | local node_name = minetest.get_node(pos).name |
| | | local droped = minetest.get_node_drops(node_name) |
| | | |
| | | minetest.handle_node_drops(user:getpos(), droped, user) |
| | | -- for _, nameDroped in pairs(droped) do |
| | | -- --add node back into placer's inv |
| | | -- user:get_inventory():add_item("main", nameDroped .. ' 1') |
| | | -- end |
| | | -- add to inventory |
| | | -- minetest.handle_node_drops(user:getpos(), droped, user) |
| | | handle_node_drops(user:getpos(), droped, user) |
| | | |
| | | minetest.remove_node(pos) |
| | | local remain_charge = current_charge - xnopick_charge_per_node |
| | |
| | | on_refill = technic.refill_RE_charge, |
| | | |
| | | on_use = function(itemstack, user, pointed_thing) |
| | | local pos = pointed_thing.under |
| | | |
| | | if pointed_thing.type ~= "node" then |
| | | return itemstack |
| | | 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 then |
| | | meta.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 |
| | | local pos = pointed_thing.under |
| | | if minetest.is_protected(pos, user:get_player_name()) then |
| | | minetest.record_protection_violation(pos, user:get_player_name()) |
| | | return |
| | |
| | | -- 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) |
| | | 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)) |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |