2013-02-12 04:07:40 +01:00
|
|
|
-- sapling growth
|
2019-05-23 01:09:41 +02:00
|
|
|
-- these tables only affect hand-placed saplings
|
|
|
|
-- mapgen-placed always use their biome def settings, which are much more
|
|
|
|
-- limited, in the interest of speed.
|
|
|
|
|
|
|
|
local dirt_surfaces = {
|
2019-05-23 02:03:00 +02:00
|
|
|
set = true,
|
2024-05-26 17:08:14 +02:00
|
|
|
[xcompat.materials.dirt] = true,
|
|
|
|
[xcompat.materials.dirt_with_grass] = true,
|
2019-05-23 02:03:00 +02:00
|
|
|
["default:dirt_with_dry_grass"] = true,
|
|
|
|
["default:dirt_with_coniferous_litter"] = true,
|
|
|
|
["default:dirt_with_rainforest_litter"] = true,
|
|
|
|
["woodsoils:dirt_with_leaves_1"] = true,
|
|
|
|
["woodsoils:dirt_with_leaves_2"] = true,
|
|
|
|
["woodsoils:grass_with_leaves_1"] = true,
|
|
|
|
["woodsoils:grass_with_leaves_2"] = true
|
2019-05-23 01:09:41 +02:00
|
|
|
}
|
|
|
|
|
2019-05-23 03:05:04 +02:00
|
|
|
local conifer_surfaces = {
|
|
|
|
set = true,
|
2024-05-26 17:08:14 +02:00
|
|
|
[xcompat.materials.dirt] = true,
|
|
|
|
[xcompat.materials.dirt_with_grass] = true,
|
2019-05-23 03:05:04 +02:00
|
|
|
["default:dirt_with_dry_grass"] = true,
|
|
|
|
["default:dirt_with_coniferous_litter"] = true,
|
|
|
|
["default:dirt_with_rainforest_litter"] = true,
|
|
|
|
["woodsoils:dirt_with_leaves_1"] = true,
|
|
|
|
["woodsoils:dirt_with_leaves_2"] = true,
|
|
|
|
["woodsoils:grass_with_leaves_1"] = true,
|
|
|
|
["woodsoils:grass_with_leaves_2"] = true,
|
|
|
|
["default:dirt_with_snow"] = true
|
|
|
|
}
|
2019-05-23 01:09:41 +02:00
|
|
|
|
|
|
|
local sand_surfaces = {
|
2019-05-23 03:05:04 +02:00
|
|
|
set = true,
|
2024-05-26 17:08:14 +02:00
|
|
|
[xcompat.materials.sand] = true,
|
|
|
|
[xcompat.materials.desert_sand] = true,
|
2019-05-23 02:03:00 +02:00
|
|
|
["cottages:loam"] = true,
|
2019-05-23 01:09:41 +02:00
|
|
|
-- note, no silver sand here.
|
|
|
|
-- too cold for a palm, too... well... sandy for anything else.
|
|
|
|
}
|
2013-02-12 04:07:40 +01:00
|
|
|
|
2022-10-25 01:09:19 +02:00
|
|
|
function moretrees.can_grow(pos, treename)
|
|
|
|
local surfaces
|
|
|
|
|
|
|
|
if treename == "spruce"
|
|
|
|
or treename == "fir"
|
|
|
|
or treename == "cedar"
|
|
|
|
or treename == "pine" then
|
|
|
|
surfaces = conifer_surfaces
|
|
|
|
elseif string.find(treename, "palm") then
|
|
|
|
surfaces = sand_surfaces
|
|
|
|
else
|
|
|
|
surfaces = dirt_surfaces
|
|
|
|
end
|
|
|
|
|
|
|
|
if surfaces[minetest.get_node(vector.new(pos.x, pos.y-1, pos.z)).name] then
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[ for i in ipairs(moretrees.treelist) do
|
2013-02-12 04:07:40 +01:00
|
|
|
local treename = moretrees.treelist[i][1]
|
|
|
|
local tree_model = treename.."_model"
|
|
|
|
local tree_biome = treename.."_biome"
|
2019-05-23 01:09:41 +02:00
|
|
|
local surfaces
|
|
|
|
local grow_function = moretrees[tree_model]
|
2013-02-12 04:07:40 +01:00
|
|
|
|
2019-05-23 01:09:41 +02:00
|
|
|
if treename == "spruce"
|
|
|
|
or treename == "fir"
|
|
|
|
or treename == "cedar"
|
|
|
|
or treename == "pine" then
|
2019-05-23 03:05:04 +02:00
|
|
|
surfaces = conifer_surfaces
|
2019-05-23 01:09:41 +02:00
|
|
|
elseif string.find(treename, "palm") then
|
|
|
|
surfaces = sand_surfaces
|
|
|
|
else
|
|
|
|
surfaces = dirt_surfaces
|
2013-02-12 04:07:40 +01:00
|
|
|
end
|
|
|
|
|
2019-05-23 01:09:41 +02:00
|
|
|
if treename == "spruce"
|
|
|
|
or treename == "fir"
|
|
|
|
or treename == "birch"
|
|
|
|
or treename == "jungletree" then
|
|
|
|
grow_function = "moretrees.grow_"..treename
|
|
|
|
end
|
2013-09-15 04:44:32 +02:00
|
|
|
|
2021-04-07 11:39:26 +02:00
|
|
|
biome_lib.dbg(dump(moretrees[tree_biome].surface), 4)
|
2018-10-25 17:59:44 +02:00
|
|
|
|
|
|
|
biome_lib:grow_plants({
|
2019-05-23 01:09:41 +02:00
|
|
|
grow_delay = moretrees.sapling_interval,
|
|
|
|
grow_chance = moretrees.sapling_chance,
|
|
|
|
grow_plant = "moretrees:"..treename.."_sapling",
|
|
|
|
grow_nodes = surfaces,
|
|
|
|
grow_function = grow_function,
|
2018-10-25 17:59:44 +02:00
|
|
|
})
|
|
|
|
|
2019-05-23 03:05:04 +02:00
|
|
|
biome_lib:grow_plants({
|
|
|
|
grow_delay = 2,
|
|
|
|
grow_chance = 1,
|
|
|
|
grow_plant = "moretrees:"..treename.."_sapling_ongen",
|
|
|
|
grow_nodes = surfaces,
|
|
|
|
grow_function = grow_function,
|
|
|
|
})
|
2022-10-25 01:09:19 +02:00
|
|
|
end ]]
|