Browse Source

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.
master
KaylebJay GitHub 1 week ago
parent
commit
00618d13b5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions
  1. +4
    -2
      technic/tools/mining_drill.lua
  2. +1
    -1
      technic/tools/mining_lasers.lua

+ 4
- 2
technic/tools/mining_drill.lua 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)


+ 1
- 1
technic/tools/mining_lasers.lua 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}


Loading…
Cancel
Save