Allow to keep sapling when holding down sneak

master
Wuzzy 2016-11-30 20:19:53 +01:00
parent 4cb1437796
commit ea91d30141
1 changed files with 6 additions and 1 deletions

View File

@ -31,7 +31,7 @@ ltool.default_edit_fields = {
minetest.register_node("ltool: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_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,
drawtype = "plantlike",
tiles = { "ltool_sapling.png" },
@ -51,6 +51,11 @@ minetest.register_node("ltool:sapling", {
nodemeta:set_string("treedef", itemmeta)
local timer = minetest.get_node_timer(pos)
timer:start(5)
if placer:get_player_control().sneak == true then
return true
else
return nil
end
end,
on_timer = function(pos, elapsed)
-- Place tree