[maptools] update

master
elite 2017-07-22 20:22:35 -04:00
parent 97c447bedb
commit 239aa9b42b
3 changed files with 8 additions and 24 deletions

View File

@ -26,7 +26,6 @@ dofile(modpath .. "/craftitems.lua")
dofile(modpath .. "/default_nodes.lua")
dofile(modpath .. "/nodes.lua")
dofile(modpath .. "/tools.lua")
dofile(modpath .. "/priv.lua")
if minetest.setting_getbool("log_mods") then
minetest.log("action", S("[maptools] loaded."))

View File

@ -1,23 +0,0 @@
local function kill_node(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "maptools:pick_admin" then
if not minetest.check_player_privs(
puncher:get_player_name(), {worldedit = true}) then
puncher:set_wielded_item("")
minetest.log("action", puncher:get_player_name() ..
" tried to use an Admin Pick!")
return
end
local nn = minetest.get_node(pos).name
if nn == "air" then return end
minetest.log("action", puncher:get_player_name() ..
" digs " .. nn ..
" at " .. minetest.pos_to_string(pos) ..
" using an Admin Pick!")
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
end
end
end

View File

@ -58,4 +58,12 @@ minetest.register_on_punchnode(function(pos, node, puncher)
minetest.remove_node(pos) -- The node is removed directly, which means it even works on non-empty containers and group-less nodes.
nodeupdate(pos) -- Run node update actions like falling nodes.
end
if puncher:get_wielded_item():get_name() == "maptools:pick_admin" then
if not minetest.check_player_privs(puncher:get_player_name(), {worldedit = true}) then
puncher:set_wielded_item("")
minetest.log("action", puncher:get_player_name() ..
" tried to use an Admin Pick!")
return
end
end
end)