Skip to content

Commit

Permalink
Restructure default/nodes.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
PilzAdam authored and Ekdohibs committed Jan 10, 2015
1 parent d1e715e commit 2edfb55
Show file tree
Hide file tree
Showing 2 changed files with 1,019 additions and 719 deletions.
39 changes: 39 additions & 0 deletions mods/default/functions.lua
Expand Up @@ -298,3 +298,42 @@ minetest.register_abm({
end
})

--
-- Grass growing
--

minetest.register_abm({
nodenames = {"default:dirt"},
interval = 2,
chance = 200,
action = function(pos, node)
local above = {x=pos.x, y=pos.y+1, z=pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none"
and (minetest.get_node_light(above) or 0) >= 13 then
if name == "default:snow" or name == "default:snowblock" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
else
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
end
})

minetest.register_abm({
nodenames = {"default:dirt_with_grass"},
interval = 2,
chance = 20,
action = function(pos, node)
local above = {x=pos.x, y=pos.y+1, z=pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none") then
minetest.set_node(pos, {name = "default:dirt"})
end
end
})

0 comments on commit 2edfb55

Please sign in to comment.