Don't grow papyrus into trees
authorPilzAdam <adam-k@outlook.com>
Sun, 18 Nov 2012 16:25:43 +0000 (17:25 +0100)
committerPilzAdam <adam-k@outlook.com>
Sun, 18 Nov 2012 16:25:43 +0000 (17:25 +0100)
mods/default/mapgen.lua

index 35fc0654937415f41a48426c5adac406ed3f44a1..8b1c1440adac002fc5c654486cd304f4aea52d06 100644 (file)
@@ -69,14 +69,26 @@ end
 function default.make_papyrus(pos, size)
        for y=0,size-1 do
                local p = {x=pos.x, y=pos.y+y, z=pos.z}
-               minetest.env:set_node(p, {name="default:papyrus"})
+               local nn = minetest.env:get_node(p).name
+               if minetest.registered_nodes[nn] and
+                       minetest.registered_nodes[nn].buildable_to then
+                       minetest.env:set_node(p, {name="default:papyrus"})
+               else
+                       return
+               end
        end
 end
 
 function default.make_cactus(pos, size)
        for y=0,size-1 do
                local p = {x=pos.x, y=pos.y+y, z=pos.z}
-               minetest.env:set_node(p, {name="default:cactus"})
+               local nn = minetest.env:get_node(p).name
+               if minetest.registered_nodes[nn] and
+                       minetest.registered_nodes[nn].buildable_to then
+                       minetest.env:set_node(p, {name="default:cactus"})
+               else
+                       return
+               end
        end
 end