removed thirst factor change as it crashed server.

master
NathanSalapat 2016-01-20 14:12:09 -06:00
parent 6309978b10
commit d6dd9e7ee8
3 changed files with 56 additions and 6 deletions

43
flowers.lua Normal file
View File

@ -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
})

View File

@ -16,6 +16,9 @@ mymonths.snow_on_ground = true
--Puddles appear when raining --Puddles appear when raining
mymonths.use_puddles = true mymonths.use_puddles = true
--Flowers die in winter, grown in spring
mymonths.flowers_die = true
local modpath = minetest.get_modpath("mymonths") local modpath = minetest.get_modpath("mymonths")
local input = io.open(modpath.."/settings.txt", "r") 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") minetest.register_alias("mymonths:leaves_sticks", "default:leaves")
end end
if mymonths.flowers_die == true then
dofile(minetest.get_modpath("mymonths").."/flowers.lua")
end
if minetest.get_modpath("thirsty") then if minetest.get_modpath("thirsty") then
thirst = true thirst = true
end end

View File

@ -88,12 +88,12 @@ local day = mymonths.day_counter
mymonths.month = m2 mymonths.month = m2
mymonths.day_speed = m3 mymonths.day_speed = m3
mymonths.night_speed = m4 mymonths.night_speed = m4
if thirst == true then -- if thirst == true then
for _,player in ipairs(minetest.get_connected_players()) do -- for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name() -- local players_names = player:get_player_name()
thirsty.set_thirst_factor(name, m5) -- thirsty.set_thirst_factor(players_names, m5)
end -- end
end -- end
end end
end end