Mod: Growing
I remade the patch for growing papyrus into a mod. The interval and chance need some tweaking though as I'm not exactly sure how they are used. In enviroment.cpp at line 643 the call if(myrand() % i->chance != 0) doesn't really make sense. It should be more like this: if(myrand_range(1, 1000) > i->chance != 0). I don't think doing 'myrand() % value' really works for this kind of use and it seems to be all over the code.
Just put this into a file named init.lua add put that in to a directory under data/mods/growing
Just put this into a file named init.lua add put that in to a directory under data/mods/growing
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
math.randomseed(os.time())
minetest.register_abm(
{nodenames = {"papyrus"},
interval = 360,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
if math.random(1,1000) > 950 then
p_bottom1 = {x=pos.x, y=pos.y-1, z=pos.z}
n_bottom1 = minetest.env:get_node(p_bottom1)
p_bottom2 = {x=pos.x, y=pos.y-2, z=pos.z}
n_bottom2 = minetest.env:get_node(p_bottom2)
p_top = {x=pos.x, y=pos.y+1, z=pos.z}
n_top = minetest.env:get_node(p_top)
if (string.sub(n_bottom1.name,1,string.len("dirt"))=="dirt") or (string.sub(n_bottom2.name,1,string.len("dirt"))=="dirt" and n_bottom1.name == "papyrus") then
if n_top.name == "air" then
minetest.env:add_node(p_top, {name="papyrus"})
end
end
end
end
})