]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/main/grass_spread.lua
remove server debug
[Crafter.git] / mods / main / grass_spread.lua
index c94307b65e162921795131f776bea15646b0395e..46bdc02df62acb2da0e0ecff6896e742b91af266 100644 (file)
@@ -1,17 +1,18 @@
+local minetest = minetest
 --grass spread abm
+local light
 minetest.register_abm({
-      label = "Grass Grow",
-      nodenames = {"main:dirt"},
-      neighbors = {"main:grass"},
-      interval = 10,
-      chance = 2000,
-      action = function(pos)
-            local light = minetest.get_node_light(pos, nil)
-            --print(light)
-            if light < 10 then
-                  --print("failed to grow grass at "..dump(pos))
-                  return
-            end
-            minetest.set_node(pos,{name="main:grass"})
-      end,
+       label = "Grass Grow",
+       nodenames = {"main:dirt"},
+       neighbors = {"main:grass", "air"},
+       interval = 10,
+       chance = 1000,
+       action = function(pos)
+               light = minetest.get_node_light(pos, nil)
+               --print(light)
+               if light < 10 then
+                       return
+               end
+               minetest.set_node(pos,{name="main:grass"})
+       end,
 })