1
0
mirror of https://github.com/mt-mods/plantlife_modpack.git synced 2025-06-28 14:16:11 +02:00

Luacheck things (#53)

* add luacheck workflow

* get rid of ancient settings in dryplants

* toss settings.txt code file

* get rid of settings in trunks

* Update .github/workflows/luacheck.yml

Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>

---------

Co-authored-by: OgelGames <olliverdc28@gmail.com>
Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>
This commit is contained in:
wsor4035
2023-07-21 15:29:53 -04:00
committed by GitHub
parent 2af1d996d2
commit 12cfbe3cb5
12 changed files with 236 additions and 369 deletions

View File

@ -12,17 +12,12 @@ abstract_dryplants = {}
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 +135,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 +181,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 +191,5 @@ minetest.register_abm({
end
end,
})
abstract_dryplants.loaded = true

View File

@ -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,

View File

@ -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,

View File

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

View File

@ -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,

View File

@ -1,52 +0,0 @@
-- Here you can enable/disable the different plants
REEDMACE_GENERATES = true
SMALL_JUNCUS_GENERATES = true
EXTRA_TALL_GRASS_GENERATES = true
-- Amount of Reedmace near water or swamp
REEDMACE_NEAR_WATER_PER_MAPBLOCK = 35 -- plants per 80x80x80 nodes (absolute maximum number)
REEDMACE_NEAR_WATER_RARITY = 40 -- percent
-- Amount of Reedmace in water
REEDMACE_IN_WATER_PER_MAPBLOCK = 35 -- plants per 80x80x80 nodes (absolute maximum number)
REEDMACE_IN_WATER_RARITY = 65 -- percent
-- Amount of Reedmace for oases, tropical beaches and tropical swamps
REEDMACE_FOR_OASES_PER_MAPBLOCK = 35 -- plants per 80x80x80 nodes (absolute maximum number)
REEDMACE_FOR_OASES_RARITY = 90 -- percent
-- growing of reedmace sapling
REEDMACE_GROWING_TIME = 600 -- seconds
REEDMACE_GROWING_CHANCE = 5 -- percent
-- Amount of small Juncus near water or swamp
JUNCUS_NEAR_WATER_PER_MAPBLOCK = 70 -- plants per 80x80x80 nodes (absolute maximum number)
JUNCUS_NEAR_WATER_RARITY = 75 -- percent
-- Amount of small Juncus at dunes/beach
JUNCUS_AT_BEACH_PER_MAPBLOCK = 70 -- plants per 80x80x80 nodes (absolute maximum number)
JUNCUS_AT_BEACH_RARITY = 75 -- percent
-- Tall Grass on dirt with grass
TALL_GRASS_PER_MAPBLOCK = 4800 -- plants per 80x80x80 nodes (absolute maximum number)
TALL_GRASS_RARITY = 75 -- percent
-- short grass becomes dirt with grass again
GRASS_REGROWING_TIME = 1200 -- seconds
GRASS_REGROWING_CHANCE = 5 -- percent
HAY_DRYING_TIME = 3600 -- seconds
REED_WILL_DRY = false -- wet reed nodes will become dry reed nodes
REED_DRYING_TIME = 3600 -- seconds
AUTO_ROOF_CORNER = true