diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2015-08-15 16:58:17 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2015-08-15 16:58:17 -0400 |
commit | f59fd56257d204e65fbde95f1ecdc8d889209f1f (patch) | |
tree | 2e572520d72ed3f9d4d80222a4dc1c93488892f6 /leafdecay.lua | |
parent | 6694b8da616241ec59072950f60e686464526178 (diff) |
use default leaf decay code for everything.
Diffstat (limited to 'leafdecay.lua')
-rw-r--r-- | leafdecay.lua | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/leafdecay.lua b/leafdecay.lua deleted file mode 100644 index 272192c..0000000 --- a/leafdecay.lua +++ /dev/null @@ -1,87 +0,0 @@ --- leaf decay - --- this function is based on the default leafdecay code -local process_drops = function(pos, name) - local drops = minetest.get_node_drops(name) - for _,dropitem in ipairs(drops) do - if dropitem ~= name - or (string.find(name, "leaves") and moretrees.decay_leaves_as_items) then - local newpos = { - x=pos.x + math.random() - 0.5, - y=pos.y + math.random() - 0.5, - z=pos.z + math.random() - 0.5 - } - minetest.add_item(newpos, dropitem) - end - end -end - -if moretrees.enable_leafdecay then - for i in ipairs(moretrees.treelist) do - local treename = moretrees.treelist[i][1] - if treename ~= "jungletree" and treename ~= "pine" and treename ~= "acacia" and treename ~= "fir" and treename ~= "palm" then - minetest.register_abm({ - nodenames = "moretrees:"..treename.."_leaves", - interval = moretrees.leafdecay_delay, - chance = moretrees.leafdecay_chance, - action = function(pos, node, active_object_count, active_object_count_wider) - if minetest.find_node_near(pos, moretrees.leafdecay_radius, { "ignore", "moretrees:"..treename.."_trunk" }) then return end - process_drops(pos, node.name) - minetest.remove_node(pos) - nodeupdate(pos) - end - }) - end - end - - minetest.register_abm({ - nodenames = {"default:jungleleaves", "moretrees:jungletree_leaves_red", "moretrees:jungletree_leaves_yellow"}, - interval = moretrees.leafdecay_delay, - chance = moretrees.leafdecay_chance, - action = function(pos, node, active_object_count, active_object_count_wider) - if minetest.find_node_near(pos, moretrees.leafdecay_radius, {"ignore", "default:jungletree"}) then return end - process_drops(pos, node.name) - minetest.remove_node(pos) - nodeupdate(pos) - end - }) - - minetest.register_abm({ - nodenames = {"moretrees:fir_leaves", "moretrees:fir_leaves_bright"}, - interval = moretrees.leafdecay_delay, - chance = moretrees.leafdecay_chance, - action = function(pos, node, active_object_count, active_object_count_wider) - if minetest.find_node_near(pos, moretrees.leafdecay_radius, { "ignore", "moretrees:fir_trunk" }) then return end - process_drops(pos, node.name) - minetest.remove_node(pos) - nodeupdate(pos) - 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 minetest.find_node_near(pos, moretrees.palm_leafdecay_radius, { "ignore", "moretrees:palm_trunk" }) then return end - process_drops(pos, node.name) - minetest.remove_node(pos) - nodeupdate(pos) - end - }) -end - --- Decay apple tree blossoms from nature_classic mod -if minetest.get_modpath("nature_classic") then - minetest.register_abm({ - nodenames = "moretrees:apple_blossoms", - interval = moretrees.default_leafdecay_delay, - chance = moretrees.default_leafdecay_chance, - action = function(pos, node, active_object_count, active_object_count_wider) - if minetest.find_node_near(pos, moretrees.leafdecay_radius, { "ignore", "moretrees:apple_tree_trunk" }) then return end - process_drops(pos, "moretrees:apple_tree_leaves") - minetest.remove_node(pos) - nodeupdate(pos) - end - }) -end |