API: ltool.copy_tree
This commit is contained in:
parent
c49c910caa
commit
7538cc4928
14
init.lua
14
init.lua
@ -139,6 +139,20 @@ function ltool.rename_tree(tree_id, new_name)
|
|||||||
ltool.trees[tree_id].name = new_name
|
ltool.trees[tree_id].name = new_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Copies a tree in the database
|
||||||
|
tree_id: ID of the tree to be copied
|
||||||
|
|
||||||
|
returns: the ID of the copy on success;
|
||||||
|
false on failure (tree does not exist)
|
||||||
|
]]
|
||||||
|
function ltool.copy_tree(tree_id)
|
||||||
|
local tree = ltool.trees[tree_id]
|
||||||
|
if(tree == nil) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return ltool.add_tree(tree.name, tree.author, tree.treedef)
|
||||||
|
end
|
||||||
|
|
||||||
--[[ Generates a sapling as an ItemStack to mess around later with
|
--[[ Generates a sapling as an ItemStack to mess around later with
|
||||||
tree_id: ID of tree the sapling will grow
|
tree_id: ID of tree the sapling will grow
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user