forked from ThomasMonroe314/ugxrealms
[maptools] add priv requirement for admin pick
This commit is contained in:
parent
8ca612e87c
commit
1d8c419ae0
@ -26,6 +26,7 @@ dofile(modpath .. "/craftitems.lua")
|
|||||||
dofile(modpath .. "/default_nodes.lua")
|
dofile(modpath .. "/default_nodes.lua")
|
||||||
dofile(modpath .. "/nodes.lua")
|
dofile(modpath .. "/nodes.lua")
|
||||||
dofile(modpath .. "/tools.lua")
|
dofile(modpath .. "/tools.lua")
|
||||||
|
dofile(modpath .. "/priv.lua")
|
||||||
|
|
||||||
if minetest.setting_getbool("log_mods") then
|
if minetest.setting_getbool("log_mods") then
|
||||||
minetest.log("action", S("[maptools] loaded."))
|
minetest.log("action", S("[maptools] loaded."))
|
||||||
|
27
worldmods/maptools/priv.lua
Normal file
27
worldmods/maptools/priv.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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 a Super Pickaxe!")
|
||||||
|
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 a Super Pickaxe!")
|
||||||
|
local node_drops = minetest.get_node_drops(nn, "superpick:pick")
|
||||||
|
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
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||||
|
kill_node(pos, node, puncher)
|
||||||
|
end)
|
Loading…
x
Reference in New Issue
Block a user