mirror of
https://github.com/joe7575/lumberjack.git
synced 2024-11-29 18:33:47 +01:00
initial commit
This commit is contained in:
parent
ca091f57af
commit
da275432db
@ -1,10 +1,4 @@
|
||||
default
|
||||
unifieddyes
|
||||
stairs?
|
||||
moreblocks?
|
||||
moreores?
|
||||
building_blocks?
|
||||
homedecor?
|
||||
|
||||
|
||||
|
||||
|
43
init.lua
43
init.lua
@ -21,28 +21,6 @@ local MY_PARAM1_VAL = 7 -- to identify placed nodes
|
||||
|
||||
local lTrees = {} -- List od registered tree items
|
||||
|
||||
--
|
||||
-- Register the tree node to the lumberjack mod.
|
||||
-- 'radius' the the range (+x/-x/+z/-z), where all available tree nodes will be removed-
|
||||
-- 'stem_height_min' is the minimum number of tree nodes, to be a valid stem (and not the a root)-
|
||||
--
|
||||
function lumberjack.register_tree(name, radius, stem_height_min)
|
||||
local data = minetest.registered_nodes[name]
|
||||
if data == nil then
|
||||
error("[lumberjack] "..name.." is no valid item")
|
||||
end
|
||||
if data.after_dig_node == nil then
|
||||
minetest.override_item(name, {
|
||||
after_dig_node = after_dig_node,
|
||||
on_construct = on_construct,
|
||||
})
|
||||
else
|
||||
error("[lumberjack] "..name.." has already an 'after_dig_node' function")
|
||||
end
|
||||
lTrees[name] = {radius=radius, height_min=stem_height_min}
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Remove all treen nodes in the given range
|
||||
--
|
||||
@ -112,6 +90,27 @@ local function on_construct(pos)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Register the tree node to the lumberjack mod.
|
||||
-- 'radius' the the range (+x/-x/+z/-z), where all available tree nodes will be removed-
|
||||
-- 'stem_height_min' is the minimum number of tree nodes, to be a valid stem (and not the a root)-
|
||||
--
|
||||
function lumberjack.register_tree(name, radius, stem_height_min)
|
||||
local data = minetest.registered_nodes[name]
|
||||
if data == nil then
|
||||
error("[lumberjack] "..name.." is no valid item")
|
||||
end
|
||||
if data.after_dig_node == nil then
|
||||
minetest.override_item(name, {
|
||||
after_dig_node = after_dig_node,
|
||||
on_construct = on_construct,
|
||||
})
|
||||
else
|
||||
error("[lumberjack] "..name.." has already an 'after_dig_node' function")
|
||||
end
|
||||
lTrees[name] = {radius=radius, height_min=stem_height_min}
|
||||
end
|
||||
|
||||
|
||||
lumberjack.register_tree("default:jungletree", 1, 5)
|
||||
lumberjack.register_tree("default:acacia_tree", 2, 3)
|
||||
|
Loading…
Reference in New Issue
Block a user