Allow to keep sapling when holding down sneak
This commit is contained in:
parent
4cb1437796
commit
ea91d30141
7
init.lua
7
init.lua
@ -31,7 +31,7 @@ ltool.default_edit_fields = {
|
|||||||
minetest.register_node("ltool:sapling", {
|
minetest.register_node("ltool:sapling", {
|
||||||
description = "Custom L-system tree sapling",
|
description = "Custom L-system tree sapling",
|
||||||
_doc_items_longdesc = "This artificial sapling does not come from nature and contains the genome of a genetically engineered L-system tree. Every sapling of this kind is unique. Who knows what might grow from it when you plant it?",
|
_doc_items_longdesc = "This artificial sapling does not come from nature and contains the genome of a genetically engineered L-system tree. Every sapling of this kind is unique. Who knows what might grow from it when you plant it?",
|
||||||
_doc_items_usagehelp = "Place the sapling on any floor and wait 5 seconds for the tree to appear. To create your own saplings, you need to have the “lplant” privilege and pick a tree from the L-System Tree Utility (accessed with the server command “treeform”).",
|
_doc_items_usagehelp = "Place the sapling on any floor and wait 5 seconds for the tree to appear. If you hold down the sneak key while placing it, you will keep a copy of the sapling in your inventory. To create your own saplings, you need to have the “lplant” privilege and pick a tree from the L-System Tree Utility (accessed with the server command “treeform”).",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = { "ltool_sapling.png" },
|
tiles = { "ltool_sapling.png" },
|
||||||
@ -51,6 +51,11 @@ minetest.register_node("ltool:sapling", {
|
|||||||
nodemeta:set_string("treedef", itemmeta)
|
nodemeta:set_string("treedef", itemmeta)
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
timer:start(5)
|
timer:start(5)
|
||||||
|
if placer:get_player_control().sneak == true then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
-- Place tree
|
-- Place tree
|
||||||
|
Loading…
x
Reference in New Issue
Block a user