From c6df90a9aa87718631fc621563939f4ff8a5b1e8 Mon Sep 17 00:00:00 2001 From: elite Date: Mon, 10 Jul 2017 20:39:55 -0400 Subject: [PATCH] [maptools] update --- worldmods/maptools/priv.lua | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/worldmods/maptools/priv.lua b/worldmods/maptools/priv.lua index a140ef1..f0d7815 100644 --- a/worldmods/maptools/priv.lua +++ b/worldmods/maptools/priv.lua @@ -13,8 +13,8 @@ local function kill_node(pos, node, puncher) minetest.log("action", puncher:get_player_name() .. " digs " .. nn .. " at " .. minetest.pos_to_string(pos) .. - " using a Super Pickaxe!") - local node_drops = minetest.get_node_drops(nn, "superpick:pick") + " using an Admin Pickaxe!") + local node_drops = minetest.get_node_drops(nn, "maptools:pick_admin") for i=1, #node_drops do local add_node = puncher:get_inventory():add_item("main", node_drops[i]) if add_node then minetest.add_item(pos, add_node) end @@ -28,3 +28,22 @@ minetest.register_on_punchnode(function(pos, node, puncher) kill_node(pos, node, puncher) end) +minetest.after(0.01, function () + minetest.after(0.01, function () + for node in pairs(minetest.registered_nodes) do + local def = minetest.registered_nodes[node] + for i in pairs(def) do + if i == "on_punch" then + local rem = def.on_punch + local function new_on_punch(pos, node, puncher, pointed_thing) + kill_node(pos, node, puncher) + return rem(pos, node, puncher, pointed_thing) + end + minetest.override_item(node, { + on_punch = new_on_punch + }) + end + end + end + end) +end)