Fix Mining Drill Mk1 not drilling

Problem introduced in  0f6bdb1
This commit is contained in:
SmallJoker 2022-06-19 16:50:20 +02:00
parent 167ab93905
commit bce5306abe
1 changed files with 17 additions and 10 deletions

View File

@ -46,20 +46,27 @@ local mining_drill_mode_text = {
{S("3x3 nodes.")}, {S("3x3 nodes.")},
} }
local function drill_dig_it0 (pos,player) local function drill_dig_it0(pos, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
minetest.record_protection_violation(pos, player:get_player_name()) minetest.record_protection_violation(pos, player:get_player_name())
return return
end end
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name == "air" or node.name == "ignore" then return end local ndef = minetest.registered_nodes[node.name]
if node.name == "default:lava_source" then return end if not ndef or ndef.drawtype == "airlike" then
if node.name == "default:lava_flowing" then return end -- Covers "air", "ignore", unknown nodes and more.
if node.name == "default:water_source" then minetest.remove_node(pos) return end return
if node.name == "default:water_flowing" then minetest.remove_node(pos) return end end
local def = minetest.registered_nodes[node.name] local groups = ndef and ndef.groups or {}
if not def then return end
def.on_dig(pos, node, player) if groups.lava then
return
end
if groups.water then
minetest.remove_node(pos)
return
end
ndef.on_dig(pos, node, player)
end end
local function drill_dig_it1 (player) local function drill_dig_it1 (player)
@ -284,7 +291,7 @@ local function mining_drill_mkX_handler(itemstack, user, pointed_thing, drill_ty
-- Do the actual shoorting action -- Do the actual shoorting action
local pos = minetest.get_pointed_thing_position(pointed_thing, false) local pos = minetest.get_pointed_thing_position(pointed_thing, false)
drill_dig_it(pos, user, meta.mode) drill_dig_it(pos, user, meta.mode or 1)
if not technic.creative_mode then if not technic.creative_mode then
meta.charge = meta.charge - charge_to_take meta.charge = meta.charge - charge_to_take
itemstack:set_metadata(minetest.serialize(meta)) itemstack:set_metadata(minetest.serialize(meta))