Skip to content
Permalink
Browse files

Restructure default/nodes.lua

  • Loading branch information
PilzAdam authored and Ekdohibs committed Jan 10, 2015
1 parent d1e715e commit 2edfb55c2904c22d6a2a4df6c1e950dee6ebbb0a
Showing with 1,019 additions and 719 deletions.
  1. +39 −0 mods/default/functions.lua
  2. +980 −719 mods/default/nodes.lua
@@ -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.