From 6b2a7785da402d3c80579fd1e9ef7c4a6de645ba Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Fri, 22 Aug 2014 17:48:38 +1000 Subject: [PATCH] Random lady fern face direction --- ferns/fern.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ferns/fern.lua b/ferns/fern.lua index 7e6bd2d..c0680f3 100644 --- a/ferns/fern.lua +++ b/ferns/fern.lua @@ -18,16 +18,17 @@ assert(abstract_ferns.config.enable_lady_fern == true) abstract_ferns.grow_fern = function(pos) local fern_size = math.random(1,4) local right_here = {x=pos.x, y=pos.y+1, z=pos.z} + local fdir = math.random(0, 179) - if minetest.get_node(right_here).name == "air" -- instead of check_air = true, - or minetest.get_node(right_here).name == "default:junglegrass" then + if minetest.get_node(right_here).name == "air" + or minetest.get_node(right_here).name == "default:junglegrass" then if fern_size == 1 then - minetest.set_node(right_here, {name="ferns:fern_01"}) - elseif fern_size <= 3 then - minetest.set_node(right_here, {name="ferns:fern_02"}) + minetest.set_node(right_here, {name="ferns:fern_01", param2=fdir}) + elseif fern_size < 4 then + minetest.set_node(right_here, {name="ferns:fern_02", param2=fdir}) else -- fern_size == 4 then - minetest.set_node(right_here, {name="ferns:fern_03"}) + minetest.set_node(right_here, {name="ferns:fern_03", param2=fdir}) end end end