Flower spread: Only spread to the same surface node
authorparamat <paramat@users.noreply.github.com>
Sun, 11 Feb 2018 08:47:15 +0000 (08:47 +0000)
committerparamat <mat.gregory@virginmedia.com>
Sat, 17 Feb 2018 09:37:27 +0000 (09:37 +0000)
mods/flowers/init.lua

index 011160edb64d3f35c1c0a6f7174f817c53792585..923a7d66b63d291c5ed79447a1bede5d454dc3c8 100644 (file)
@@ -154,11 +154,14 @@ function flowers.flower_spread(pos, node)
        if num_soils >= 1 then
                for si = 1, math.min(3, num_soils) do
                        local soil = soils[math.random(num_soils)]
+                       local soil_name = minetest.get_node(soil).name
                        local soil_above = {x = soil.x, y = soil.y + 1, z = soil.z}
                        light = minetest.get_node_light(soil_above)
                        if light and light >= 13 and
+                                       -- Only spread to same surface node
+                                       soil_name == under.name and
                                        -- Desert sand is in the soil group
-                                       minetest.get_node(soil).name ~= "default:desert_sand" then
+                                       soil_name ~= "default:desert_sand" then
                                minetest.set_node(soil_above, {name = node.name})
                        end
                end