diff --git a/flowers.lua b/flowers.lua index 58f3d2d..f206b2d 100644 --- a/flowers.lua +++ b/flowers.lua @@ -3,7 +3,7 @@ minetest.register_abm({ --Flowers die in late fall interval = 10, chance = 10, action = function (pos) - if mymonths.month == 'October' or mymonths.month == 'November' then + if mymonths.month_counter == '10' or mymonths.month_counter == '11' then minetest.set_node(pos, {name = 'air'}) end end @@ -14,7 +14,7 @@ minetest.register_abm({ --Flowers grow in spring, flower spread ABM is in flower interval = 240, chance = 100, action = function (pos) - if mymonths.month == 'March' or mymonths.month == 'April' then + if mymonths.month == '3' or mymonths.month == '4' 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") diff --git a/leaves.lua b/leaves.lua index 50cf954..2fe68b8 100644 --- a/leaves.lua +++ b/leaves.lua @@ -20,10 +20,10 @@ end --ABMs ################## minetest.register_abm({ --leaves changing in September and October. nodenames = {'group:leaves'}, - interval = 60, - chance = 40, + interval = 6, + chance = 4, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'September' or mymonths.month == 'October' then + if mymonths.month_counter == '9' or mymonths.month_counter == '10' then if node.name == 'default:leaves' then minetest.set_node(pos, {name = 'mymonths:leaves_pale_green'}) elseif node.name == 'mymonths:leaves_pale_green' then @@ -46,7 +46,7 @@ minetest.register_abm({ --All leaves should be pale green by mid September interval = 5, chance = 1, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'September' and + if mymonths.month_counter == '9' and mymonths.day_counter >= 8 then minetest.set_node(pos, {name = 'mymonths:leaves_pale_green'}) end @@ -57,7 +57,7 @@ minetest.register_abm({ --All leaves should be orange by October interval = 5, chance = 1, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'October' and + if mymonths.month_counter == '10' and tonumber(mymonths.day_counter) >= 1 and tonumber(mymonths.day_counter) <= 7 then minetest.set_node(pos, {name = 'mymonths:leaves_orange'}) @@ -69,7 +69,7 @@ minetest.register_abm({ --All leaves should be red by mid October interval = 5, chance = 1, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'October' and + if mymonths.month_counter == '10' and mymonths.day_counter >= 8 then minetest.set_node(pos, {name = 'mymonths:leaves_red'}) end @@ -81,7 +81,7 @@ minetest.register_abm({ --leaves 'falling/dying' in October interval = 60, chance = 40, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'October' then + if mymonths.month_counter == '10' then minetest.set_node(pos, {name = 'mymonths:leaves_sticks'}) end end @@ -92,7 +92,7 @@ minetest.register_abm({ --All leaves should be sticks in November and December interval = 5, chance = 1, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'November' or mymonths.month == 'December' or mymonths.month == 'January' or mymonths.month == 'February' then + if mymonths.month_counter == '11' or mymonths.month_counter == '12' or mymonths.month_counter == '1' or mymonths.month_counter == '2' then minetest.set_node(pos, {name = 'mymonths:leaves_sticks'}) end end @@ -103,7 +103,7 @@ minetest.register_abm({ --New growth in spring interval = 60, chance = 40, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'March' or mymonths.month == 'April' then + if mymonths.month_counter == '3' or mymonths.month_counter == '4' then if node.name == 'mymonths:leaves_sticks' then minetest.set_node(pos, {name = 'mymonths:leaves_blooms'}) elseif node.name == 'mymonths:leaves_blooms' then @@ -118,7 +118,7 @@ minetest.register_abm({ --By April all trees should be back to normal interval = 5, chance = 1, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'May' then + if mymonths.month_counter == '5' then minetest.set_node(pos, {name = 'default:leaves'}) end end @@ -133,7 +133,7 @@ minetest.register_abm({ --apples die in November local nodeu2 = minetest.get_node({x=pos.x,y=pos.y-2,z=pos.z}) local nodeu3 = minetest.get_node({x=pos.x,y=pos.y-3,z=pos.z}) local nodeu4 = minetest.get_node({x=pos.x,y=pos.y-4,z=pos.z}) - if mymonths.month == 'November' then + if mymonths.month_counter == '11' then if nodeu1.name == "air" then minetest.spawn_item({x=pos.x,y=pos.y-1,z=pos.z}, 'default:apple') minetest.set_node(pos,{name = 'mymonths:leaves_sticks'}) @@ -158,7 +158,7 @@ minetest.register_abm({ --apples grow in fall interval = 60, chance = 15, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'July' or mymonths.month == 'August' or mymonths.month == 'September' then + if mymonths.month_counter == '7' or mymonths.month_counter == '8' or mymonths.month_counter == '9' then local a = minetest.find_node_near(pos, 3, 'default:apple') if a == nil then minetest.set_node(pos,{name = 'default:apple'}) @@ -172,11 +172,11 @@ minetest.register_abm({ --apples change to leaves or sticks is not in season interval = 1, chance = 1, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'December' or mymonths.month == 'January' or mymonths.month == 'February' then + if mymonths.month_counter == '12' or mymonths.month_counter == '1' or mymonths.month_counter == '2' then minetest.set_node(pos,{name = 'mymonths:leaves_sticks'}) - elseif mymonths.month == 'March' or mymonths.month == 'April' then + elseif mymonths.month_counter == '3' or mymonths.month_counter == '4' then minetest.set_node(pos,{name = 'mymonths:leaves_blooms'}) - elseif mymonths.month == 'May' or mymonths.month == 'June' then + elseif mymonths.month_counter == '5' or mymonths.month_counter == '6' then minetest.set_node(pos,{name = 'default:leaves'}) end end @@ -187,7 +187,7 @@ minetest.register_abm ({ --Acacia blooming interval = 60, chance = 15, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'January' then + if mymonths.month_counter == '1' then minetest.set_node(pos,{name = 'mymonths:leaves_acacia_blooms'}) end end @@ -198,7 +198,7 @@ minetest.register_abm ({ --Acacia blooming interval = 15, chance = 1, action = function (pos, node, active_object_count, active_object_count_wider) - if mymonths.month == 'Febuary' then + if mymonths.month_counter == '2' then minetest.set_node(pos,{name = 'default:acacia_leaves'}) end end