myadmin/myadmintools/init.lua

67 lines
2.4 KiB
Lua
Raw Normal View History

2015-04-27 19:45:27 -07:00
2016-04-04 15:08:37 -07:00
minetest.register_alias("ut", "myadmintools:ultimate_tool")
minetest.register_alias("utd", "myadmintools:ultimate_tool_drop")
2015-04-27 19:45:27 -07:00
2016-04-04 15:08:37 -07:00
minetest.register_tool("myadmintools:ultimate_tool", {
2015-04-27 19:45:27 -07:00
description = "Ultimate Tool",
inventory_image = "ultimate_tool.png",
groups = {not_in_creative_inventory=1},
tool_capabilities = {
full_punch_interval = 0.2,
2015-04-27 19:45:27 -07:00
max_drop_level=3,
groupcaps= {
unbreakable={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
fleshy = {times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
choppy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
bendy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
cracky={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
crumbly={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
snappy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
}
},
2016-03-25 11:03:38 -07:00
on_drop = function(itemstack, dropper, pos)
end
2015-04-27 19:45:27 -07:00
})
2016-04-04 15:08:37 -07:00
minetest.register_tool("myadmintools:ultimate_tool_drop", {
2015-04-27 19:45:27 -07:00
description = "Ultimate Tool With Drops",
inventory_image = "ultimate_tool2.png",
groups = {not_in_creative_inventory=1},
tool_capabilities = {
full_punch_interval = 0.2,
2015-04-27 19:45:27 -07:00
max_drop_level=3,
groupcaps= {
unbreakable={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
fleshy = {times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
choppy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
bendy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
cracky={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
crumbly={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
snappy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
}
},
2016-03-25 11:03:38 -07:00
on_drop = function(itemstack, dropper, pos)
end
2015-04-27 19:45:27 -07:00
})
2016-03-25 11:03:38 -07:00
2015-04-27 19:45:27 -07:00
minetest.register_on_punchnode(function(pos, node, puncher)
2016-03-25 11:03:38 -07:00
local n = node
2016-04-04 15:08:37 -07:00
if puncher:get_wielded_item():get_name() == "myadmintools:ultimate_tool"
2016-03-25 11:03:38 -07:00
and minetest.get_node(pos).name ~= "air"
and minetest.get_player_privs(puncher:get_player_name()).myadmin_levels_super == true then
2016-03-21 18:50:43 -07:00
minetest.remove_node(pos)
2015-04-27 19:45:27 -07:00
end
2016-03-25 11:03:38 -07:00
2016-04-04 15:08:37 -07:00
if puncher:get_wielded_item():get_name() == "myadmintools:ultimate_tool"
or puncher:get_wielded_item():get_name() == "myadmintools:ultimate_tool_drop"
2016-03-25 11:03:38 -07:00
and minetest.get_node(pos).name ~= "air" then
if minetest.get_player_privs(puncher:get_player_name()).myadmin_levels_super ~= true then
minetest.chat_send_player(puncher:get_player_name(), "You don't have the priv for this tool")
puncher:set_wielded_item("default:stick")
minetest.set_node(pos,{name = node.name})
return
end
end
2015-04-27 19:45:27 -07:00
end)