From d6dd9e7ee847c35b1410b032ae39d94ce68ee296 Mon Sep 17 00:00:00 2001 From: NathanSalapat Date: Wed, 20 Jan 2016 14:12:09 -0600 Subject: [PATCH] removed thirst factor change as it crashed server. --- flowers.lua | 43 +++++++++++++++++++++++++++++++++++++++++++ init.lua | 7 +++++++ months.lua | 12 ++++++------ 3 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 flowers.lua diff --git a/flowers.lua b/flowers.lua new file mode 100644 index 0000000..58f3d2d --- /dev/null +++ b/flowers.lua @@ -0,0 +1,43 @@ +minetest.register_abm({ --Flowers die in late fall + nodenames = {'group:flower'}, + interval = 10, + chance = 10, + action = function (pos) + if mymonths.month == 'October' or mymonths.month == 'November' then + minetest.set_node(pos, {name = 'air'}) + end + end +}) + +minetest.register_abm({ --Flowers grow in spring, flower spread ABM is in flower mod, this just gives initial population as that ABM won't grow flowers where there are none. + nodenames = {'group:soil'}, + interval = 240, + chance = 100, + action = function (pos) + if mymonths.month == 'March' or mymonths.month == 'April' then + local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4} + local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4} + local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flower") + if #flowers > 2 then + return + end + pos.y = pos.y+1 + if minetest.get_node(pos).name == 'air' then + local key = math.random(1,6) + if key == 1 then + minetest.set_node(pos, {name = 'flowers:dandelion_white'}) + elseif key == 2 then + minetest.set_node(pos, {name = "flowers:dandelion_yellow"}) + elseif key == 3 then + minetest.set_node(pos, {name = "flowers:geranium"}) + elseif key == 4 then + minetest.set_node(pos, {name = "flowers:rose"}) + elseif key == 5 then + minetest.set_node(pos, {name = "flowers:tulip"}) + elseif key == 6 then + minetest.set_node(pos, {name = "flowers:viola"}) + end + end + end + end +}) diff --git a/init.lua b/init.lua index 50d8b7f..c770900 100644 --- a/init.lua +++ b/init.lua @@ -16,6 +16,9 @@ mymonths.snow_on_ground = true --Puddles appear when raining mymonths.use_puddles = true +--Flowers die in winter, grown in spring +mymonths.flowers_die = true + local modpath = minetest.get_modpath("mymonths") local input = io.open(modpath.."/settings.txt", "r") @@ -69,6 +72,10 @@ if mymonths.leaves == false then minetest.register_alias("mymonths:leaves_sticks", "default:leaves") end +if mymonths.flowers_die == true then + dofile(minetest.get_modpath("mymonths").."/flowers.lua") +end + if minetest.get_modpath("thirsty") then thirst = true end diff --git a/months.lua b/months.lua index 03da282..7c46e20 100644 --- a/months.lua +++ b/months.lua @@ -88,12 +88,12 @@ local day = mymonths.day_counter mymonths.month = m2 mymonths.day_speed = m3 mymonths.night_speed = m4 - if thirst == true then - for _,player in ipairs(minetest.get_connected_players()) do - local name = player:get_player_name() - thirsty.set_thirst_factor(name, m5) - end - end +-- if thirst == true then +-- for _,player in ipairs(minetest.get_connected_players()) do +-- local players_names = player:get_player_name() +-- thirsty.set_thirst_factor(players_names, m5) +-- end +-- end end end