Drill and laser: call node-specific on_dig (#556)
This properly digs nodes that have a custom on_dig function specified. For normal nodes, the behaviour is kept the same.
This commit is contained in:
parent
6154a04c00
commit
00618d13b5
@ -51,13 +51,15 @@ local function drill_dig_it0 (pos,player)
|
|||||||
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
|
if node.name == "air" or node.name == "ignore" then return end
|
||||||
if node.name == "default:lava_source" then return end
|
if node.name == "default:lava_source" then return end
|
||||||
if node.name == "default:lava_flowing" then return end
|
if node.name == "default:lava_flowing" then return end
|
||||||
if node.name == "default:water_source" then minetest.remove_node(pos) return end
|
if node.name == "default:water_source" then minetest.remove_node(pos) return end
|
||||||
if node.name == "default:water_flowing" then minetest.remove_node(pos) return end
|
if node.name == "default:water_flowing" then minetest.remove_node(pos) return end
|
||||||
minetest.node_dig(pos,node,player)
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
if not def then return end
|
||||||
|
def.on_dig(pos, node, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drill_dig_it1 (player)
|
local function drill_dig_it1 (player)
|
||||||
|
@ -46,7 +46,7 @@ local function laser_node(pos, node, player)
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.node_dig(pos, node, player)
|
def.on_dig(pos, node, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
local keep_node = {air = true}
|
local keep_node = {air = true}
|
||||||
|
Loading…
Reference in New Issue
Block a user