Make short grass convert to dirt with grass only after cut grass/hay was removed

This commit is contained in:
Rogier 2015-06-21 10:39:42 +02:00
parent 2b56975993
commit 8b2a32ceae
1 changed files with 5 additions and 1 deletions

View File

@ -190,7 +190,11 @@ minetest.register_abm({
interval = GRASS_REGROWING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle
chance = 100/GRASS_REGROWING_CHANCE,
action = function(pos)
minetest.set_node(pos, {name="default:dirt_with_grass"})
-- Only become dirt with grass if no cut grass or hay lies on top
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
if above.name ~= "dryplants:grass" and above.name ~= "dryplants:hay" then
minetest.set_node(pos, {name="default:dirt_with_grass"})
end
end,
})