diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2013-02-11 12:23:05 -0500 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2013-02-11 12:23:05 -0500 |
commit | a0af3f26de0028e832eac202d3fd9ce93d68f65d (patch) | |
tree | 7a1a08edcbedbeaf3e0145eefabc991ec775e0c8 /leafdecay.lua | |
parent | 1445263d734eabd017d3af1b57e19dc4e9870545 (diff) |
added the ability to redefine apples so that they'll fall when nearby leaves
disappear (defaults to true). Moved leafdecay code into its own file. Moved
sapling configs into settings.lua
Diffstat (limited to 'leafdecay.lua')
-rw-r--r-- | leafdecay.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/leafdecay.lua b/leafdecay.lua new file mode 100644 index 0000000..cab0281 --- /dev/null +++ b/leafdecay.lua @@ -0,0 +1,44 @@ +-- leaf decay + +minetest.register_abm({ + nodenames = moretrees.leaves_list, + interval = moretrees.leafdecay_delay, + chance = moretrees.leafdecay_chance, + action = function(pos, node, active_object_count, active_object_count_wider) + if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, moretrees.trunks_list) then + minetest.env:remove_node(pos) + minetest.env:dig_node(pos) + end + end +}) + +minetest.register_abm({ + nodenames = "moretrees:palm_leaves", + interval = moretrees.leafdecay_delay, + chance = moretrees.leafdecay_chance, + action = function(pos, node, active_object_count, active_object_count_wider) + if not minetest.env:find_node_near(pos, moretrees.palm_leafdecay_radius, moretrees.trunks_list) then + minetest.env:remove_node(pos) + minetest.env:dig_node(pos) + end + end +}) + + +if moretrees.enable_replace_default_trees then + minetest.register_alias("mapgen_tree", "air") + minetest.register_alias("mapgen_leaves", "air") + plantslib:register_generate_plant(moretrees.beech_biome, moretrees.beech_model) +elseif moretrees.enable_default_leafdecay then + minetest.register_abm({ + nodenames = "default:leaves", + interval = moretrees.default_leafdecay_delay, + chance = moretrees.default_leafdecay_chance, + action = function(pos, node, active_object_count, active_object_count_wider) + if not minetest.env:find_node_near(pos, moretrees.default_leafdecay_radius, {"default:tree"}) then + minetest.env:remove_node(pos) + minetest.env:dig_node(pos) + end + end + }) +end |