X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=mods%2Fmain%2Fgrass_spread.lua;h=46bdc02df62acb2da0e0ecff6896e742b91af266;hb=48aa89197636250b3e494e9124c7c5c6e2d63dea;hp=ea31981b1399c7b18ca3b23138febca2d65b32fd;hpb=af85ddccca55350f4ed5c46477b69d0d9e335804;p=Crafter.git diff --git a/mods/main/grass_spread.lua b/mods/main/grass_spread.lua index ea31981..46bdc02 100644 --- a/mods/main/grass_spread.lua +++ b/mods/main/grass_spread.lua @@ -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 = 2600, - 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, })