From: HybridDog Date: Sun, 31 Mar 2019 21:20:28 +0000 (+0200) Subject: flowers: Light check optimisation in mushroom spread X-Git-Tag: 5.1.0~70 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b20725026e6e49249f661b741be0826fa8c8a830;p=oweals%2Fminetest_game.git flowers: Light check optimisation in mushroom spread --- diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index 5219a455..49799cf3 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -221,8 +221,10 @@ minetest.register_node("flowers:mushroom_brown", { -- Mushroom spread and death function flowers.mushroom_spread(pos, node) - if minetest.get_node_light(pos, nil) == 15 then - minetest.remove_node(pos) + if minetest.get_node_light(pos, 0.5) > 3 then + if minetest.get_node_light(pos, nil) == 15 then + minetest.remove_node(pos) + end return end local positions = minetest.find_nodes_in_area_under_air( @@ -234,8 +236,7 @@ function flowers.mushroom_spread(pos, node) end local pos2 = positions[math.random(#positions)] pos2.y = pos2.y + 1 - if minetest.get_node_light(pos, 0.5) <= 3 and - minetest.get_node_light(pos2, 0.5) <= 3 then + if minetest.get_node_light(pos2, 0.5) <= 3 then minetest.set_node(pos2, {name = node.name}) end end