added Acacia blooms

master
NathanSalapat 2015-11-11 16:19:36 -06:00
parent c0d41e992e
commit 3e47c73afc
4 changed files with 36 additions and 16 deletions

View File

@ -24,8 +24,8 @@ minetest.register_chatcommand("setmonth", {
func = function(name, param)
if param == "1" or "January" or "january" or "jan" then
mymonths.month = "January"
elseif param == "2" or "Febuary" or "febuary" or "feb" then
mymonths.month = "Febuary"
elseif param == "2" or "February" or "february" or "feb" then
mymonths.month = "February"
elseif param == "3" or "March" or "march" or "mar" then
mymonths.month = "March"
elseif param == "4" or "April" or "april" or "apr" then
@ -36,7 +36,7 @@ minetest.register_chatcommand("setmonth", {
mymonths.month = "June"
elseif param == "7" or "July" or "july" or "jul" then
mymonths.month = "July"
elseif param == "8" or "Augest" or "augest" or "aug" then
elseif param == "8" or "August" or "august" or "aug" then
mymonths.month = "Augest"
elseif param == "9" or "September" or "september" or "sept" then
mymonths.month = "September"

View File

@ -78,7 +78,7 @@ minetest.register_globalstep(function(dtime)
mymonths.day_speed = t5
mymonths.night_speed = t1
minetest.chat_send_all("The date is "..mymonths.month.." "..mymonths.day_counter)
--Febuary
--February
elseif mymonths.month_counter == 2 then
mymonths.month = "February"
mymonths.day_speed = t5
@ -114,7 +114,7 @@ minetest.register_globalstep(function(dtime)
mymonths.day_speed = t1
mymonths.night_speed = t5
minetest.chat_send_all("The date is "..mymonths.month.." "..mymonths.day_counter)
--Augest
--August
elseif mymonths.month_counter == 8 then
mymonths.month = "August"
mymonths.day_speed = t1
@ -165,7 +165,7 @@ minetest.register_globalstep(function(dtime)
minetest.chat_send_all("Looks like snow is on it's way")
save_table()
end
elseif mymonths.month_counter == 2 then--Febuary
elseif mymonths.month_counter == 2 then--February
if math.random(1, 10000) == 1 then
mymonths.weather = "snow"
minetest.chat_send_all("Looks like snow is on it's way")
@ -205,7 +205,7 @@ minetest.register_globalstep(function(dtime)
minetest.chat_send_all("Might be a rainy day")
save_table()
end
elseif mymonths.month_counter == 8 then --Augest
elseif mymonths.month_counter == 8 then --August
if math.random(1, 50000) == 1 then
mymonths.weather = "rain"
minetest.chat_send_all("Might be a rainy day")

View File

@ -5,6 +5,7 @@ local leaves_table = {--name, tex
{'red', 'red'}, --third stage
{'sticks', 'sticks'}, --after leaves fall
{'blooms', 'blooms'}, --Spring!!!
{'acacia_blooms', 'acacia_blooms'}, --Acacia blooms for January
}
for i in ipairs (leaves_table) do
@ -56,7 +57,7 @@ minetest.register_abm({ --All leaves should be red in October
minetest.register_abm({ --leaves 'falling/dying' in October
nodenames = {'mymonths:leaves_red'},
interval = 10.0,
interval = 10,
chance = 10,
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.month == 'October' then
@ -108,7 +109,7 @@ minetest.register_abm({ --apples die in November
chance = 10,
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.month == 'November' then
minetest.set_node(pos,{name = 'air'})
minetest.set_node(pos,{name = 'mymonths:leaves_sticks'})
end
end
})
@ -119,14 +120,33 @@ minetest.register_abm({ --apples grow in spring
chance = 20,
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.month == 'July' or 'August' or 'September' then
local posbelow = {x=pos.x, y=pos.y-1, z=pos.z}
local below = minetest.get_node(posbelow)
if below.name == 'air' then
local a = minetest.find_node_near(pos, 3, 'default:apple')
if a == nil then
minetest.set_node(posbelow,{name = 'default:apple'})
end
local a = minetest.find_node_near(pos, 3, 'default:apple')
if a == nil then
minetest.set_node(pos,{name = 'default:apple'})
end
end
end
})
minetest.register_abm({ --Flowery blooms for the Acacia trees
nodenames = {'default:acacia_leaves'},
interval = 60,
chance = 50,
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.month == 'January' then
minetest.swap_node(pos, {name = 'mymonths:leaves_acacia_blooms'})
end
end
})
minetest.register_abm({ --Kill the blooms for the Acacia trees
nodenames = {'mymonths:leaves_acacia_blooms'},
interval = 5,
chance = 5,
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.month == 'February' then
print 'does this even run?'
minetest.swap_node(pos, {name = 'default:acacia_leaves'})
end
end
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B