superpick-cd2025/init.lua

95 lines
2.5 KiB
Lua
Raw Normal View History

2013-02-01 19:50:10 +01:00
minetest.register_on_punchnode(function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "superpick:pick"
and minetest.env: get_node(pos).name ~= "air" then
minetest.env:remove_node(pos)
2013-05-11 12:50:50 +02:00
local inv = puncher:get_inventory()
if inv then
if not inv:contains_item("main", node) then
inv:add_item("main", node)
end
end
2013-02-01 19:50:10 +01:00
end
end)
minetest.register_tool("superpick:pick", {
description = "LX 113",
inventory_image = "superpick.png",
wield_scale = {x=2,y=2,z=2},
liquids_pointable = true,
tool_capabilities = {
full_punch_interval = 0,
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},
2013-05-11 12:50:50 +02:00
},
damage_groups = {fleshy = 20},
2013-02-01 19:50:10 +01:00
},
})
2013-03-16 10:10:26 +01:00
minetest.register_on_punchnode(function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "superpick:info"
and minetest.env: get_node(pos).name ~= "air" then
2013-06-11 19:38:18 +02:00
local nam = node.name
2013-08-24 12:40:13 +02:00
local par1 = node.param1
local par2 = node.param2
if par1 == 0 then
a = " "
2013-06-11 19:38:18 +02:00
else
2013-08-24 12:40:13 +02:00
a = par1
2013-06-11 19:38:18 +02:00
end
2013-08-24 12:40:13 +02:00
if par2 == 0 then
b = ""
else
b = par2
end
local m = nam.." "..a.." "..b
if puncher:get_player_control().sneak then
m = m..' '..dump(minetest.registered_nodes[nam])
end
print("[superpick] "..m)
minetest.chat_send_all(m)
2013-03-16 10:10:26 +01:00
end
end)
minetest.register_tool("superpick:info", {
description = "i 114",
inventory_image = "superpick_info.png",
wield_scale = {x=2,y=2,z=2},
liquids_pointable = true,
tool_capabilities = {},
})
2013-08-24 12:40:13 +02:00
function cleaninventory(name)
if name == nil or name == "" then
return
end
minetest.env:get_player_by_name(name):
get_inventory():
set_list("main", {
[1] = "superpick:info",
[2] = "replacer:replacer",
[3] = "superpick:pick",
})
print("[superpick] "..name.." has cleaned his inventory.")
minetest.chat_send_player(name, 'Inventory Cleaned!')
end
if minetest.setting_getbool("creative_mode") then
minetest.register_chatcommand('cleaninv',{
description = 'Tidy up your inventory.',
params = "",
privs = {},
func = cleaninventory
})
end
2013-06-15 00:15:56 +02:00
print("[superpick] loaded")