update
Former-commit-id: a54a30cc417a6c8f891f5bee39fa0c955ac1ff87 Former-commit-id: 6eefb2ba663c97d9ae408c18c4cbc385f13199f9
This commit is contained in:
parent
105adeaa0a
commit
43c028faaf
32
init.lua
32
init.lua
@ -1,15 +1,26 @@
|
|||||||
if minetest.setting_getbool("creative_mode") then
|
if minetest.setting_getbool("creative_mode") then
|
||||||
local load_time_start = os.clock()
|
local load_time_start = os.clock()
|
||||||
|
|
||||||
|
local function add_to_inv(puncher, node)
|
||||||
|
local inv = puncher:get_inventory()
|
||||||
|
if inv then
|
||||||
|
if not inv:contains_item("main", node) then
|
||||||
|
inv:add_item("main", node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_tool(":creative:pick", {
|
minetest.register_tool(":creative:pick", {
|
||||||
description = "LX 113",
|
description = "LX 113",
|
||||||
inventory_image = "superpick.png",
|
inventory_image = "superpick.png",
|
||||||
wield_scale = {x=2,y=2,z=2},
|
wield_scale = {x=2,y=2,z=2},
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
|
range = 14,
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 0,
|
full_punch_interval = 0,
|
||||||
max_drop_level=3,
|
max_drop_level=3,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
unbreakable={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
|
unbreakable={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
|
||||||
fleshy = {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},
|
choppy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
|
||||||
bendy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
|
bendy={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
|
||||||
@ -30,6 +41,12 @@ if minetest.setting_getbool("creative_mode") then
|
|||||||
minetest.chat_send_player(pname, "?")
|
minetest.chat_send_player(pname, "?")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local pcontrol = placer:get_player_control()
|
||||||
|
if pcontrol.down
|
||||||
|
and pcontrol.up then
|
||||||
|
add_to_inv(placer, node)
|
||||||
|
return
|
||||||
|
end
|
||||||
local nam = node.name
|
local nam = node.name
|
||||||
local par1 = node.param1
|
local par1 = node.param1
|
||||||
local par2 = node.param2
|
local par2 = node.param2
|
||||||
@ -45,7 +62,6 @@ if minetest.setting_getbool("creative_mode") then
|
|||||||
b = par2
|
b = par2
|
||||||
end
|
end
|
||||||
local m = nam.." "..a.." "..b
|
local m = nam.." "..a.." "..b
|
||||||
local pcontrol = placer:get_player_control()
|
|
||||||
if pcontrol.sneak
|
if pcontrol.sneak
|
||||||
and pcontrol.aux1
|
and pcontrol.aux1
|
||||||
and not pcontrol.up then
|
and not pcontrol.up then
|
||||||
@ -60,13 +76,13 @@ if minetest.setting_getbool("creative_mode") then
|
|||||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||||
if puncher:get_wielded_item():get_name() == "creative:pick"
|
if puncher:get_wielded_item():get_name() == "creative:pick"
|
||||||
and node.name ~= "air" then
|
and node.name ~= "air" then
|
||||||
minetest.remove_node(pos)
|
minetest.after(0, function(pos)
|
||||||
local inv = puncher:get_inventory()
|
if not minetest.get_node(pos).name == "air" then
|
||||||
if inv then
|
print("[superpick] force destroying node at ("..pos.x.."|"..pos.y.."|"..pos.z..")")
|
||||||
if not inv:contains_item("main", node) then
|
minetest.remove_node(pos)
|
||||||
inv:add_item("main", node)
|
|
||||||
end
|
end
|
||||||
end
|
end, pos)
|
||||||
|
add_to_inv(puncher, node)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user