diff --git a/.luacheckrc b/.luacheckrc index 0bf2cdd..2e1926c 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -3,7 +3,7 @@ allow_defined_top = true max_line_length = 185 globals = { - "biome_lib", + "biome_lib", "abstract_dryplants", } read_globals = { diff --git a/dryplants/init.lua b/dryplants/init.lua index a3256b9..ebc0584 100644 --- a/dryplants/init.lua +++ b/dryplants/init.lua @@ -14,15 +14,11 @@ local S = minetest.get_translator("dryplants") dofile(minetest.get_modpath("dryplants").."/crafting.lua") dofile(minetest.get_modpath("dryplants").."/settings.txt") dofile(minetest.get_modpath("dryplants").."/reed.lua") -if REEDMACE_GENERATES == true then - dofile(minetest.get_modpath("dryplants").."/reedmace.lua") -end -if SMALL_JUNCUS_GENERATES == true then - dofile(minetest.get_modpath("dryplants").."/juncus.lua") -end -if EXTRA_TALL_GRASS_GENERATES == true then - dofile(minetest.get_modpath("dryplants").."/moregrass.lua") -end + +dofile(minetest.get_modpath("dryplants").."/reedmace.lua") +dofile(minetest.get_modpath("dryplants").."/juncus.lua") +dofile(minetest.get_modpath("dryplants").."/moregrass.lua") + --dofile(minetest.get_modpath("dryplants").."/meadowvariation.lua") ----------------------------------------------------------------------------------------------- @@ -140,7 +136,7 @@ minetest.register_node("dryplants:grass", { ----------------------------------------------------------------------------------------------- minetest.register_abm({ nodenames = {"dryplants:grass"}, - interval = HAY_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle + interval = 3600, --1200, -- 20 minutes: a minetest-day/night-cycle chance = 1, action = function(pos) minetest.swap_node(pos, {name="dryplants:hay"}) @@ -186,8 +182,8 @@ minetest.register_node("dryplants:grass_short", { ----------------------------------------------------------------------------------------------- minetest.register_abm({ nodenames = {"dryplants:grass_short"}, - interval = GRASS_REGROWING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle - chance = 100/GRASS_REGROWING_CHANCE, + interval = 1200, --1200, -- 20 minutes: a minetest-day/night-cycle + chance = 100/1200, action = function(pos) -- Only become dirt with grass if no cut grass or hay lies on top local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) @@ -196,3 +192,5 @@ minetest.register_abm({ end end, }) + +abstract_dryplants.loaded = true diff --git a/dryplants/juncus.lua b/dryplants/juncus.lua index 186b4b0..8c36092 100644 --- a/dryplants/juncus.lua +++ b/dryplants/juncus.lua @@ -105,8 +105,8 @@ biome_lib.register_on_generate({ "sumpf:peat", "sumpf:sumpf" }, - max_count = JUNCUS_NEAR_WATER_PER_MAPBLOCK, - rarity = 101 - JUNCUS_NEAR_WATER_RARITY, + max_count = 70, + rarity = 101 - 75, min_elevation = 1, -- above sea level near_nodes = {"default:water_source","sumpf:dirtywater_source","sumpf:sumpf"}, near_nodes_size = 2, @@ -126,8 +126,8 @@ biome_lib.register_on_generate({ --"sumpf:peat", --"sumpf:sumpf" }, - max_count = JUNCUS_AT_BEACH_PER_MAPBLOCK, - rarity = 101 - JUNCUS_AT_BEACH_RARITY, + max_count = 70, + rarity = 101 - 75, min_elevation = 1, -- above sea level near_nodes = {"default:dirt_with_grass"}, near_nodes_size = 2, diff --git a/dryplants/moregrass.lua b/dryplants/moregrass.lua index e953c27..2f574a4 100644 --- a/dryplants/moregrass.lua +++ b/dryplants/moregrass.lua @@ -15,8 +15,8 @@ biome_lib.register_on_generate( "sumpf:peat", "sumpf:sumpf" }, - max_count = TALL_GRASS_PER_MAPBLOCK, - rarity = 101 - TALL_GRASS_RARITY, + max_count = 4800, + rarity = 101 - 75, min_elevation = 1, -- above sea level plantlife_limit = -0.9, check_air = true, diff --git a/dryplants/reed.lua b/dryplants/reed.lua index f80ffa5..1b7f0b3 100644 --- a/dryplants/reed.lua +++ b/dryplants/reed.lua @@ -75,99 +75,96 @@ minetest.register_node("dryplants:wetreed_roof", { sounds = default.node_sound_leaves_defaults(), }) -if AUTO_ROOF_CORNER == true then - - local CoRNeR = { +local CoRNeR = { -- MaTeRiaL - {"wetreed"}, - {"reed"} - } + {"wetreed"}, + {"reed"} +} - for i in pairs(CoRNeR) do +for i in pairs(CoRNeR) do - local MaTeRiaL = CoRNeR[i][1] - local roof = "dryplants:"..MaTeRiaL.."_roof" - local corner = "dryplants:"..MaTeRiaL.."_roof_corner" - local corner_2 = "dryplants:"..MaTeRiaL.."_roof_corner_2" + local MaTeRiaL = CoRNeR[i][1] + local roof = "dryplants:"..MaTeRiaL.."_roof" + local corner = "dryplants:"..MaTeRiaL.."_roof_corner" + local corner_2 = "dryplants:"..MaTeRiaL.."_roof_corner_2" - minetest.register_abm({ - nodenames = {roof}, - interval = 1, - chance = 1, - action = function(pos) + minetest.register_abm({ + nodenames = {roof}, + interval = 1, + chance = 1, + action = function(pos) - local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }) - local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }) - local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}) - local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) - -- corner 1 - if ((node_west.name == roof and node_west.param2 == 0) - or (node_west.name == corner and node_west.param2 == 1)) - and ((node_north.name == roof and node_north.param2 == 3) - or (node_north.name == corner and node_north.param2 == 3)) - then - minetest.swap_node(pos, {name=corner, param2=0}) - end + local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }) + local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }) + local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}) + local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) + -- corner 1 + if ((node_west.name == roof and node_west.param2 == 0) + or (node_west.name == corner and node_west.param2 == 1)) + and ((node_north.name == roof and node_north.param2 == 3) + or (node_north.name == corner and node_north.param2 == 3)) + then + minetest.swap_node(pos, {name=corner, param2=0}) + end - if ((node_north.name == roof and node_north.param2 == 1) - or (node_north.name == corner and node_north.param2 == 2)) - and ((node_east.name == roof and node_east.param2 == 0) - or (node_east.name == corner and node_east.param2 == 0)) - then - minetest.swap_node(pos, {name=corner, param2=1}) - end + if ((node_north.name == roof and node_north.param2 == 1) + or (node_north.name == corner and node_north.param2 == 2)) + and ((node_east.name == roof and node_east.param2 == 0) + or (node_east.name == corner and node_east.param2 == 0)) + then + minetest.swap_node(pos, {name=corner, param2=1}) + end - if ((node_east.name == roof and node_east.param2 == 2) - or (node_east.name == corner and node_east.param2 == 3)) - and ((node_south.name == roof and node_south.param2 == 1) - or (node_south.name == corner and node_south.param2 == 1)) - then - minetest.swap_node(pos, {name=corner, param2=2}) - end + if ((node_east.name == roof and node_east.param2 == 2) + or (node_east.name == corner and node_east.param2 == 3)) + and ((node_south.name == roof and node_south.param2 == 1) + or (node_south.name == corner and node_south.param2 == 1)) + then + minetest.swap_node(pos, {name=corner, param2=2}) + end - if ((node_south.name == roof and node_south.param2 == 3) - or (node_south.name == corner and node_south.param2 == 0)) - and ((node_west.name == roof and node_west.param2 == 2) - or (node_west.name == corner and node_west.param2 == 2)) - then - minetest.swap_node(pos, {name=corner, param2=3}) - end - -- corner 2 - if ((node_west.name == roof and node_west.param2 == 2) - or (node_west.name == corner_2 and node_west.param2 == 1)) - and ((node_north.name == roof and node_north.param2 == 1) - or (node_north.name == corner_2 and node_north.param2 == 3)) - then - minetest.swap_node(pos, {name=corner_2, param2=0}) - end + if ((node_south.name == roof and node_south.param2 == 3) + or (node_south.name == corner and node_south.param2 == 0)) + and ((node_west.name == roof and node_west.param2 == 2) + or (node_west.name == corner and node_west.param2 == 2)) + then + minetest.swap_node(pos, {name=corner, param2=3}) + end + -- corner 2 + if ((node_west.name == roof and node_west.param2 == 2) + or (node_west.name == corner_2 and node_west.param2 == 1)) + and ((node_north.name == roof and node_north.param2 == 1) + or (node_north.name == corner_2 and node_north.param2 == 3)) + then + minetest.swap_node(pos, {name=corner_2, param2=0}) + end - if ((node_north.name == roof and node_north.param2 == 3) - or (node_north.name == corner_2 and node_north.param2 == 2)) - and ((node_east.name == roof and node_east.param2 == 2) - or (node_east.name == corner_2 and node_east.param2 == 0)) - then - minetest.swap_node(pos, {name=corner_2, param2=1}) - end + if ((node_north.name == roof and node_north.param2 == 3) + or (node_north.name == corner_2 and node_north.param2 == 2)) + and ((node_east.name == roof and node_east.param2 == 2) + or (node_east.name == corner_2 and node_east.param2 == 0)) + then + minetest.swap_node(pos, {name=corner_2, param2=1}) + end - if ((node_east.name == roof and node_east.param2 == 0) - or (node_east.name == corner_2 and node_east.param2 == 3)) - and ((node_south.name == roof and node_south.param2 == 3) - or (node_south.name == corner_2 and node_south.param2 == 1)) - then - minetest.swap_node(pos, {name=corner_2, param2=2}) - end + if ((node_east.name == roof and node_east.param2 == 0) + or (node_east.name == corner_2 and node_east.param2 == 3)) + and ((node_south.name == roof and node_south.param2 == 3) + or (node_south.name == corner_2 and node_south.param2 == 1)) + then + minetest.swap_node(pos, {name=corner_2, param2=2}) + end - if ((node_south.name == roof and node_south.param2 == 1) - or (node_south.name == corner_2 and node_south.param2 == 0)) - and ((node_west.name == roof and node_west.param2 == 0) - or (node_west.name == corner_2 and node_west.param2 == 2)) - then - minetest.swap_node(pos, {name=corner_2, param2=3}) - end + if ((node_south.name == roof and node_south.param2 == 1) + or (node_south.name == corner_2 and node_south.param2 == 0)) + and ((node_west.name == roof and node_west.param2 == 0) + or (node_west.name == corner_2 and node_west.param2 == 2)) + then + minetest.swap_node(pos, {name=corner_2, param2=3}) + end - end, - }) - end + end, + }) end ----------------------------------------------------------------------------------------------- @@ -233,31 +230,28 @@ minetest.register_node("dryplants:wetreed_roof_corner_2", { ----------------------------------------------------------------------------------------------- -- Wet Reed becomes (dry) Reed over time ----------------------------------------------------------------------------------------------- -if REED_WILL_DRY == true then - - local DRyiNG = { +local DRyiNG = { -- WeT DRy - {"dryplants:wetreed", "dryplants:reed"}, - {"dryplants:wetreed_slab", "dryplants:reed_slab"}, - {"dryplants:wetreed_roof", "dryplants:reed_roof"}, - {"dryplants:wetreed_roof_corner", "dryplants:reed_roof_corner"}, - {"dryplants:wetreed_roof_corner_2", "dryplants:reed_roof_corner_2"} - } - for i in pairs(DRyiNG) do + {"dryplants:wetreed", "dryplants:reed"}, + {"dryplants:wetreed_slab", "dryplants:reed_slab"}, + {"dryplants:wetreed_roof", "dryplants:reed_roof"}, + {"dryplants:wetreed_roof_corner", "dryplants:reed_roof_corner"}, + {"dryplants:wetreed_roof_corner_2", "dryplants:reed_roof_corner_2"} +} +for i in pairs(DRyiNG) do - local WeT = DRyiNG[i][1] - local DRy = DRyiNG[i][2] + local WeT = DRyiNG[i][1] + local DRy = DRyiNG[i][2] - minetest.register_abm({ - nodenames = {WeT}, - interval = REED_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle - chance = 1, - action = function(pos) - local direction = minetest.get_node(pos).param2 - minetest.swap_node(pos, {name=DRy, param2=direction}) - end, - }) - end + minetest.register_abm({ + nodenames = {WeT}, + interval = 3600, --1200, -- 20 minutes: a minetest-day/night-cycle + chance = 1, + action = function(pos) + local direction = minetest.get_node(pos).param2 + minetest.swap_node(pos, {name=DRy, param2=direction}) + end, + }) end ----------------------------------------------------------------------------------------------- diff --git a/dryplants/reedmace.lua b/dryplants/reedmace.lua index 3c97f56..6d5ecda 100644 --- a/dryplants/reedmace.lua +++ b/dryplants/reedmace.lua @@ -276,8 +276,8 @@ minetest.register_node("dryplants:reedmace_sapling", { -- abm minetest.register_abm({ nodenames = "dryplants:reedmace_sapling", - interval = REEDMACE_GROWING_TIME, - chance = 100/REEDMACE_GROWING_CHANCE, + interval = 600, + chance = 100/5, action = function(pos, node, _, _) if string.find(minetest.get_node({x = pos.x + 1, y = pos.y, z = pos.z }).name, "default:water") or string.find(minetest.get_node({x = pos.x, y = pos.y, z = pos.z + 1}).name, "default:water") @@ -357,8 +357,8 @@ biome_lib.register_on_generate({ "sumpf:peat", "sumpf:sumpf" }, - max_count = REEDMACE_NEAR_WATER_PER_MAPBLOCK, - rarity = 101 - REEDMACE_NEAR_WATER_RARITY, + max_count = 35, + rarity = 101 - 40, --rarity = 60, min_elevation = 1, -- above sea level near_nodes = {"default:water_source","sumpf:dirtywater_source","sumpf:sumpf"}, @@ -380,8 +380,8 @@ biome_lib.register_on_generate({ "sumpf:peat", "sumpf:sumpf" }, - max_count = REEDMACE_IN_WATER_PER_MAPBLOCK, - rarity = 101 - REEDMACE_IN_WATER_RARITY, + max_count = 35, + rarity = 101 - 65, --rarity = 35, min_elevation = 0, -- a bit below sea level max_elevation = 0, -- "" @@ -398,8 +398,8 @@ biome_lib.register_on_generate({ "default:sand", "sumpf:sumpf" }, - max_count = REEDMACE_FOR_OASES_PER_MAPBLOCK, - rarity = 101 - REEDMACE_FOR_OASES_RARITY, + max_count = 35, + rarity = 101 - 90, --rarity = 10, neighbors = {"default:water_source","sumpf:dirtywater_source","sumpf:sumpf"}, ncount = 1,