1
0
mirror of https://github.com/mt-mods/moretrees.git synced 2024-11-15 23:10:20 +01:00

fix some luacheck warnings

This commit is contained in:
unknown 2022-07-01 15:41:33 -04:00
parent 20c369a138
commit 03ae8b6adf
3 changed files with 31 additions and 13 deletions

View File

@ -83,7 +83,10 @@ local date_regrow_abm_spec = {
interval = moretrees.dates_flower_interval,
chance = moretrees.dates_flower_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
local dates = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y, z=pos.z-2}, {x=pos.x+2, y=pos.y, z=pos.z+2}, "group:moretrees_dates")
local dates = minetest.find_nodes_in_area(
{x=pos.x-2, y=pos.y, z=pos.z-2}, {x=pos.x+2, y=pos.y, z=pos.z+2},
"group:moretrees_dates"
)
-- New blossom interval increases exponentially with number of dates already hanging
-- In addition: if more dates are hanging, the chance of picking an empty spot decreases as well...
@ -228,7 +231,8 @@ local function find_fruit_trunks_near(ftpos, sect)
-- Skip the search if it is consuming too much CPU time
if sect_search_stats.count > 0 and moretrees.dates_blossom_search_iload > 0
and sect_search_stats.sum / sect_search_stats.count > moretrees.dates_blossom_search_time_treshold
and t0us - sect_search_stats.last_us < moretrees.dates_blossom_search_iload * (sect_search_stats.sum / sect_search_stats.count) then
and t0us - sect_search_stats.last_us < moretrees.dates_blossom_search_iload
* (sect_search_stats.sum / sect_search_stats.count) then
sect_search_stats.skip = sect_search_stats.skip + 1
return nil
end
@ -481,7 +485,10 @@ local function find_male_blossom_with_ftrunk(fbpos,ftpos)
end
-- Else do a new search
if not mpalms.sect[sect_old] then
mpalms.sect[sect_old], fpalms_list, all_mpalms_list = find_fruit_trunks_near(ftpos, {x = (sect_old + 4) % 3 - 1, z = (sect_old + 4) / 3 - 1})
mpalms.sect[sect_old], fpalms_list, all_mpalms_list = find_fruit_trunks_near(
ftpos,
{x = (sect_old + 4) % 3 - 1, z = (sect_old + 4) / 3 - 1}
)
cache_changed = true
if sect_old == 0 then
-- Save the results if it is sector 0

View File

@ -245,7 +245,10 @@ function moretrees.grow_jungletree(pos)
end
minetest.swap_node(pos, {name = "air"})
local leaves = minetest.find_nodes_in_area({x = pos.x-1, y = pos.y, z = pos.z-1}, {x = pos.x+1, y = pos.y+10, z = pos.z+1}, "default:leaves")
local leaves = minetest.find_nodes_in_area(
{x = pos.x-1, y = pos.y, z = pos.z-1}, {x = pos.x+1, y = pos.y+10, z = pos.z+1},
"default:leaves"
)
for leaf in ipairs(leaves) do
minetest.swap_node(leaves[leaf], {name = "air"})
end
@ -272,7 +275,11 @@ function moretrees.grow_fir(pos)
moretrees.fir_model.random_level = 5
minetest.swap_node(pos, {name = "air"})
local leaves = minetest.find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves")
local leaves = minetest.find_nodes_in_area(
{x = pos.x, y = pos.y, z = pos.z},
{x = pos.x, y = pos.y+5, z = pos.z},
"default:leaves"
)
for leaf in ipairs(leaves) do
minetest.swap_node(leaves[leaf], {name = "air"})
end
@ -299,7 +306,11 @@ function moretrees.grow_fir_snow(pos)
moretrees.fir_model.random_level = 2
minetest.swap_node(pos, {name = "air"})
local leaves = minetest.find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves")
local leaves = minetest.find_nodes_in_area(
{x = pos.x, y = pos.y, z = pos.z},
{x = pos.x, y = pos.y+5, z = pos.z},
"default:leaves"
)
for leaf in ipairs(leaves) do
minetest.swap_node(leaves[leaf], {name = "air"})
end

View File

@ -5,19 +5,19 @@ moretrees.avoidnodes = {}
moretrees.treelist = {
{"beech", S("Beech Tree")},
{"apple_tree", S("Apple Tree")},
{"oak", S("Oak Tree"), "acorn", S("Acorn"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"oak", S("Oak Tree"), "acorn", S("Acorn"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"sequoia", S("Giant Sequoia")},
{"birch", S("Birch Tree")},
{"palm", S("Palm Tree"), "palm_fruit_trunk_gen", S("Palm Tree"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 1.0 },
{"date_palm", S("Date Palm Tree"), "date_palm_fruit_trunk", S("Date Palm Tree"), {0, 0, 0, 0, 0, 0}, 0.0 },
{"spruce", S("Spruce Tree"), "spruce_cone", S("Spruce Cone"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"cedar", S("Cedar Tree"), "cedar_cone", S("Cedar Cone"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"palm", S("Palm Tree"), "palm_fruit_trunk_gen", S("Palm Tree"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 1.0 },
{"date_palm", S("Date Palm Tree"), "date_palm_fruit_trunk",S("Date Palm Tree"), {0, 0, 0, 0, 0, 0}, 0.0 },
{"spruce", S("Spruce Tree"), "spruce_cone", S("Spruce Cone"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"cedar", S("Cedar Tree"), "cedar_cone", S("Cedar Cone"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"poplar", S("Poplar Tree")},
{"poplar_small", S("Poplar Tree")},
{"willow", S("Willow Tree")},
{"rubber_tree", S("Rubber Tree")},
{"fir", S("Douglas Fir"), "fir_cone", S("Fir Cone"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"jungletree", S("Jungle Tree"), nil, nil, nil, nil, "default_junglesapling.png" },
{"fir", S("Douglas Fir"), "fir_cone", S("Fir Cone"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"jungletree", S("Jungle Tree"), nil, nil, nil, nil, "default_junglesapling.png" },
}
moretrees.treedesc = {