From 25564985a226ddc6d6d9190245bec14412814d64 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Thu, 7 Aug 2014 21:38:51 -0400 Subject: [PATCH] combine checks for ignore and trunks into one call (per tree; effectively treats ignore as another trunk) --- leafdecay.lua | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/leafdecay.lua b/leafdecay.lua index cf6743f..9b5f32a 100644 --- a/leafdecay.lua +++ b/leafdecay.lua @@ -25,8 +25,7 @@ if moretrees.enable_leafdecay then 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, "moretrees:"..treename.."_trunk") then return end - if minetest.find_node_near(pos, moretrees.leafdecay_radius, "ignore") then return end + 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) @@ -40,8 +39,7 @@ if moretrees.enable_leafdecay then 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, {"default:jungletree", "moretrees:jungletree_trunk"}) then return end - if minetest.find_node_near(pos, moretrees.leafdecay_radius, "ignore") then return end + if minetest.find_node_near(pos, moretrees.leafdecay_radius, {"ignore", "default:jungletree", "moretrees:jungletree_trunk"}) then return end process_drops(pos, node.name) minetest.remove_node(pos) nodeupdate(pos) @@ -53,8 +51,7 @@ if moretrees.enable_leafdecay then 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, "moretrees:fir_trunk") then return end - if minetest.find_node_near(pos, moretrees.leafdecay_radius, "ignore") then return end + 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) @@ -66,8 +63,7 @@ if moretrees.enable_leafdecay then 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, "moretrees:palm_trunk") then return end - if minetest.find_node_near(pos, moretrees.palm_leafdecay_radius, "ignore") then return end + 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) @@ -82,8 +78,7 @@ if moretrees.enable_default_leafdecay then 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.default_leafdecay_radius, "default:tree") then return end - if minetest.find_node_near(pos, moretrees.default_leafdecay_radius, "ignore") then return end + if minetest.find_node_near(pos, moretrees.default_leafdecay_radius, { "ignore", "default:tree" }) then return end process_drops(pos, node.name) minetest.remove_node(pos) nodeupdate(pos) @@ -98,8 +93,7 @@ if moretrees.enable_default_jungle_leafdecay then interval = moretrees.default_jungle_leafdecay_delay, chance = moretrees.default_jungle_leafdecay_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if minetest.find_node_near(pos, moretrees.default_jungle_leafdecay_radius, "default:jungletree") then return end - if minetest.find_node_near(pos, moretrees.default_jungle_leafdecay_radius, "ignore") then return end + if minetest.find_node_near(pos, moretrees.default_jungle_leafdecay_radius, { "ignore", "default:jungletree" }) then return end process_drops(pos, node.name) minetest.remove_node(pos) nodeupdate(pos) -- 2.30.2