summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-08-07 21:38:51 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-08-07 21:38:51 -0400
commit25564985a226ddc6d6d9190245bec14412814d64 (patch)
treeadfa93af22bd3b325392ae0f8e0b0b7e954acc28
parent0d86cf2023336f58a95becfb42c4f8872ce1f2c6 (diff)
combine checks for ignore and trunks into one call
(per tree; effectively treats ignore as another trunk)
-rw-r--r--leafdecay.lua18
1 files 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)