forked from mtcontrib/plantlife_modpack
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:
parent
2af1d996d2
commit
12cfbe3cb5
13
.github/workflows/luacheck.yml
vendored
Normal file
13
.github/workflows/luacheck.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
name: luacheck
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
luacheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: apt
|
||||
run: sudo apt-get install -y luarocks
|
||||
- name: luacheck install
|
||||
run: luarocks install --local luacheck
|
||||
- name: luacheck run
|
||||
run: $HOME/.luarocks/bin/luacheck ./
|
25
.luacheckrc
25
.luacheckrc
|
@ -1,14 +1,21 @@
|
|||
unused_args = false
|
||||
allow_defined_top = true
|
||||
max_line_length = 185
|
||||
|
||||
read_globals = {
|
||||
"biome_lib",
|
||||
"DIR_DELIM",
|
||||
"minetest", "core",
|
||||
"dump",
|
||||
"vector", "nodeupdate",
|
||||
"VoxelManip", "VoxelArea",
|
||||
"PseudoRandom", "ItemStack",
|
||||
"default",
|
||||
exclude_files = {".luacheckrc"}
|
||||
|
||||
globals = {
|
||||
"biome_lib", "abstract_dryplants",
|
||||
"bushes_classic", "abstract_trunks",
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
table = {fields = {"copy"}},
|
||||
|
||||
"minetest", "ItemStack",
|
||||
"vector",
|
||||
|
||||
"default",
|
||||
"moretrees",
|
||||
"dump",
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
@ -29,8 +29,6 @@ abstract_trunks.place_twig = function(pos)
|
|||
if twig_size <= 16 then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)})
|
||||
end
|
||||
-- big twigs
|
||||
if Big_Twigs == true then
|
||||
-- big twig 1
|
||||
if twig_size == 17 then
|
||||
if not (check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z+1})
|
||||
|
@ -148,14 +146,12 @@ abstract_trunks.place_twig = function(pos)
|
|||
elseif twig_size <= 25 then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if Twigs_on_ground == true then
|
||||
biome_lib.register_on_generate({
|
||||
surface = {"default:dirt_with_grass"},
|
||||
max_count = Twigs_on_ground_Max_Count,
|
||||
rarity = Twigs_on_ground_Rarity,
|
||||
max_count = 640,
|
||||
rarity = 66,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
near_nodes = {"group:tree","ferns:fern_03","ferns:fern_02","ferns:fern_01"},
|
||||
|
@ -166,13 +162,11 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
abstract_trunks.place_twig
|
||||
)
|
||||
end
|
||||
|
||||
if Twigs_on_water == true then
|
||||
biome_lib.register_on_generate({
|
||||
surface = {"default:water_source"},
|
||||
max_count = Twigs_on_water_Max_Count,
|
||||
rarity = Twigs_on_water_Rarity,
|
||||
max_count = 320,
|
||||
rarity = 33,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
near_nodes = {"group:tree"},
|
||||
|
@ -183,7 +177,6 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
abstract_trunks.place_twig
|
||||
)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- TRuNKS
|
||||
|
@ -211,7 +204,6 @@ local TRuNKS = {
|
|||
{"moretrees", "willow_trunk", 17},
|
||||
}
|
||||
|
||||
if Horizontal_Trunks == true then -- see settings.txt
|
||||
for i in pairs(TRuNKS) do
|
||||
local MoD = TRuNKS[i][1]
|
||||
local TRuNK = TRuNKS[i][2]
|
||||
|
@ -225,7 +217,6 @@ for i in pairs(TRuNKS) do
|
|||
minetest.register_node(":"..trunkname, temptrunk)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
abstract_trunks.place_trunk = function(pos)
|
||||
|
||||
|
@ -254,7 +245,7 @@ abstract_trunks.place_trunk = function(pos)
|
|||
else
|
||||
minetest.swap_node(right_here, {name="default:tree"})
|
||||
end
|
||||
elseif trunk_type == 2 and Horizontal_Trunks == true then
|
||||
elseif trunk_type == 2 then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
if check_node_buildable_to(north) then
|
||||
minetest.swap_node(north, {name=MoD..":"..TRuNK, param2=4})
|
||||
|
@ -286,7 +277,7 @@ abstract_trunks.place_trunk = function(pos)
|
|||
minetest.swap_node(south2, {name="default:tree", param2=4})
|
||||
end
|
||||
end
|
||||
elseif trunk_type == 3 and Horizontal_Trunks == true then
|
||||
elseif trunk_type == 3 then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
if check_node_buildable_to(west) then
|
||||
minetest.swap_node(west, {name=MoD..":"..TRuNK, param2=12})
|
||||
|
@ -324,8 +315,8 @@ end
|
|||
|
||||
biome_lib.register_on_generate({
|
||||
surface = {"default:dirt_with_grass"},
|
||||
max_count = Trunks_Max_Count, -- 320,
|
||||
rarity = Trunks_Rarity, -- 99,
|
||||
max_count = 320, -- 320,
|
||||
rarity = 99, -- 99,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
avoid_nodes = {"group:tree"},
|
||||
|
@ -342,7 +333,6 @@ biome_lib.register_on_generate({
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- MoSS & FuNGuS -- on ground
|
||||
-----------------------------------------------------------------------------------------------
|
||||
if Moss_on_ground == true then
|
||||
abstract_trunks.grow_moss_on_ground = function(pos)
|
||||
local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local moss_type = math.random(1,21)
|
||||
|
@ -358,8 +348,8 @@ end
|
|||
|
||||
biome_lib.register_on_generate({
|
||||
surface = {"default:dirt_with_grass"},
|
||||
max_count = Moss_on_ground_Max_Count,
|
||||
rarity = Moss_on_ground_Rarity,
|
||||
max_count = 400,
|
||||
rarity = 79,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
near_nodes = {
|
||||
|
@ -375,12 +365,10 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
abstract_trunks.grow_moss_on_ground
|
||||
)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- MoSS & FuNGuS -- on trunks
|
||||
-----------------------------------------------------------------------------------------------
|
||||
if Moss_on_trunk == true then
|
||||
abstract_trunks.grow_moss_on_trunk = function(pos)
|
||||
local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local at_side_n = {x=pos.x, y=pos.y, z=pos.z+1}
|
||||
|
@ -458,8 +446,8 @@ biome_lib.register_on_generate({
|
|||
"moretrees:willow_trunk",
|
||||
"default:mossycobble"
|
||||
},
|
||||
max_count = Moss_on_trunk_Max_Count,
|
||||
rarity = Moss_on_trunk_Rarity,
|
||||
max_count = 640,
|
||||
rarity = 24,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
plantlife_limit = -0.9,
|
||||
|
@ -467,13 +455,10 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
"abstract_trunks.grow_moss_on_trunk"
|
||||
)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- RooTS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
if Roots == true then -- see settings.txt
|
||||
|
||||
abstract_trunks.grow_roots = function(pos)
|
||||
local right_here = {x=pos.x , y=pos.y , z=pos.z }
|
||||
local below = {x=pos.x , y=pos.y-1, z=pos.z }
|
||||
|
@ -523,5 +508,3 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
"abstract_trunks.grow_roots"
|
||||
)
|
||||
|
||||
end
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
abstract_trunks = {}
|
||||
|
||||
dofile(minetest.get_modpath("trunks").."/trunks_settings.txt")
|
||||
dofile(minetest.get_modpath("trunks").."/generating.lua")
|
||||
dofile(minetest.get_modpath("trunks").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("trunks").."/crafting.lua")
|
||||
|
||||
abstract_trunks.loaded = true
|
||||
|
|
150
trunks/nodes.lua
150
trunks/nodes.lua
|
@ -239,98 +239,93 @@ minetest.register_node("trunks:twigs_roof_corner_2", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
if Auto_Roof_Corner == true then
|
||||
local roof = "trunks:twigs_roof"
|
||||
local corner = "trunks:twigs_roof_corner"
|
||||
local corner_2 = "trunks:twigs_roof_corner_2"
|
||||
|
||||
local roof = "trunks:twigs_roof"
|
||||
local corner = "trunks:twigs_roof_corner"
|
||||
local corner_2 = "trunks:twigs_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,
|
||||
})
|
||||
|
||||
-- MM: The following stuff is just for testing purposes for now; no generating of roots.
|
||||
-- I'm not satisfied with this; they should be either bigger or a different drawtype.
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- RooTS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
if Roots == true then -- see settings.txt
|
||||
|
||||
local roots_cube = {-2/16, -1/2, -3/16, 2/16, 1/16, 1/2}
|
||||
|
||||
local roots_sheet = {0, -1/2, -1/2, 0, 1/16, 1/2}
|
||||
|
@ -401,7 +396,6 @@ for i in pairs(TRuNKS) do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_alias("trunks:pine_trunkroot", "trunks:pine_treeroot")
|
||||
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
-- Settings for generation of stuff (at map-generation time)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Horizontal_Trunks = true
|
||||
|
||||
|
||||
|
||||
Trunks_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
|
||||
Trunks_Rarity = 99 -- larger values make trunks more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Big_Twigs = true -- twigs larger than one node
|
||||
Twigs_on_ground = true
|
||||
|
||||
|
||||
|
||||
Twigs_on_ground_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
Twigs_on_ground_Rarity = 66 -- larger values make twigs more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Twigs_on_water = true
|
||||
|
||||
|
||||
|
||||
Twigs_on_water_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
|
||||
Twigs_on_water_Rarity = 33 -- larger values make twigs more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Moss_on_ground = true
|
||||
|
||||
|
||||
|
||||
Moss_on_ground_Max_Count = 400 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
Moss_on_ground_Rarity = 79 -- larger values makes moss more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Moss_on_trunk = true
|
||||
|
||||
|
||||
|
||||
Moss_on_trunk_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
Moss_on_trunk_Rarity = 24 -- larger values makes moss more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
Auto_Roof_Corner = true -- behavior is similar (not the same!) to the one of minecraft stairs
|
||||
|
||||
|
||||
Roots = true
|
Loading…
Reference in New Issue
Block a user