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:
KaylebJay 2020-06-27 09:29:50 -06:00 committed by GitHub
parent 6154a04c00
commit 00618d13b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -51,13 +51,15 @@ local function drill_dig_it0 (pos,player)
minetest.record_protection_violation(pos, player:get_player_name())
return
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 == "default:lava_source" 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_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
local function drill_dig_it1 (player)

View File

@ -46,7 +46,7 @@ local function laser_node(pos, node, player)
})
return
end
minetest.node_dig(pos, node, player)
def.on_dig(pos, node, player)
end
local keep_node = {air = true}