forked from mtcontrib/moretrees
Compare commits
4 Commits
9560970515
...
lsystem_de
Author | SHA1 | Date | |
---|---|---|---|
76fa9c4398 | |||
1c972a078c | |||
1727fb32bb | |||
c15250a03a |
@ -1,80 +1,79 @@
|
||||
|
||||
moretrees.beech_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
}
|
||||
|
||||
moretrees.palm_biome = {
|
||||
surface = xcompat.materials.sand,
|
||||
place_on = xcompat.materials.sand,
|
||||
min_elevation = -1,
|
||||
max_elevation = 1,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 10,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 10,
|
||||
}
|
||||
|
||||
moretrees.date_palm_biome = {
|
||||
surface = xcompat.materials.desert_sand,
|
||||
place_on = xcompat.materials.desert_sand,
|
||||
min_elevation = -1,
|
||||
max_elevation = 10,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 100,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 100,
|
||||
}
|
||||
|
||||
moretrees.date_palm_biome_2 = {
|
||||
surface = xcompat.materials.desert_sand,
|
||||
place_on = xcompat.materials.desert_sand,
|
||||
min_elevation = 11,
|
||||
max_elevation = 30,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 1,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 1,
|
||||
}
|
||||
|
||||
moretrees.apple_tree_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 1,
|
||||
max_elevation = 10,
|
||||
place_on = {xcompat.materials.dirt_with_grass},
|
||||
biomes = {"deciduous_forest"},
|
||||
fill_ratio = 0.0001,
|
||||
}
|
||||
|
||||
moretrees.oak_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 0,
|
||||
max_elevation = 10,
|
||||
fill_ratio = 0.0003
|
||||
}
|
||||
|
||||
moretrees.sequoia_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 0,
|
||||
max_elevation = 10,
|
||||
fill_ratio = 0.0001,
|
||||
}
|
||||
|
||||
moretrees.birch_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 10,
|
||||
max_elevation = 15,
|
||||
fill_ratio = 0.001,
|
||||
}
|
||||
|
||||
moretrees.willow_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = -5,
|
||||
max_elevation = 5,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 5,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 5,
|
||||
}
|
||||
|
||||
moretrees.rubber_tree_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = -5,
|
||||
max_elevation = 5,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 10,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 10,
|
||||
}
|
||||
|
||||
moretrees.jungletree_biome = {
|
||||
surface = {
|
||||
place_on = {
|
||||
xcompat.materials.dirt,
|
||||
xcompat.materials.dirt_with_grass,
|
||||
"woodsoils:dirt_with_leaves_1",
|
||||
@ -83,74 +82,74 @@ moretrees.jungletree_biome = {
|
||||
"default:dirt_with_rainforest_litter",
|
||||
},
|
||||
min_elevation = 1,
|
||||
near_nodes = minetest.get_modpath("default") and {"default:jungletree"} or nil,
|
||||
near_nodes_count = minetest.get_modpath("default") and 1 or nil,
|
||||
spawn_by = minetest.get_modpath("default") and {"default:jungletree"} or nil,
|
||||
num_spawn_by = minetest.get_modpath("default") and 1 or nil,
|
||||
biomes = {"rainforest", "rainforest_swamp"},
|
||||
}
|
||||
|
||||
moretrees.spruce_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 20,
|
||||
}
|
||||
|
||||
moretrees.cedar_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 0, --Added to solve an issue where cedar trees would sometimes spawn deep underground
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 5,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 5,
|
||||
}
|
||||
|
||||
|
||||
-- Poplar requires a lot of water.
|
||||
moretrees.poplar_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 0,
|
||||
max_elevation = 50,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 1,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 1,
|
||||
}
|
||||
|
||||
-- Spawn an occasional poplar elsewhere.
|
||||
moretrees.poplar_biome_2 = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 0,
|
||||
max_elevation = 50,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 10,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 10,
|
||||
}
|
||||
|
||||
-- Subterranean lakes provide enough water for poplars to grow
|
||||
moretrees.poplar_biome_3 = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 0,
|
||||
max_elevation = 50,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 1,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 1,
|
||||
}
|
||||
|
||||
moretrees.poplar_small_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 0,
|
||||
max_elevation = 50,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 1,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 1,
|
||||
}
|
||||
|
||||
moretrees.poplar_small_biome_2 = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 0,
|
||||
max_elevation = 50,
|
||||
near_nodes = {xcompat.materials.water_source},
|
||||
near_nodes_count = 5,
|
||||
spawn_by = {xcompat.materials.water_source},
|
||||
num_spawn_by = 5,
|
||||
}
|
||||
|
||||
|
||||
moretrees.fir_biome = {
|
||||
surface = xcompat.materials.dirt_with_grass,
|
||||
place_on = xcompat.materials.dirt_with_grass,
|
||||
min_elevation = 25,
|
||||
}
|
||||
|
||||
moretrees.fir_biome_snow = {
|
||||
surface = {"snow:dirt_with_snow", "snow:snow"},
|
||||
place_on = {"snow:dirt_with_snow", "snow:snow"},
|
||||
below_nodes = {xcompat.materials.dirt, xcompat.materials.dirt_with_grass, "snow:dirt_with_snow"},
|
||||
}
|
||||
|
68
init.lua
68
init.lua
@ -134,18 +134,24 @@ function translate_biome_defs(def, treename, index)
|
||||
if not index then index = 1 end
|
||||
local deco_def = {
|
||||
name = treename .. "_" .. index,
|
||||
deco_type = "simple",
|
||||
place_on = def.place_on or def.surface,
|
||||
place_on = def.place_on,
|
||||
sidelen = 16,
|
||||
fill_ratio = def.fill_ratio or 0.001,
|
||||
--biomes eventually?
|
||||
y_min = def.min_elevation,
|
||||
y_max = def.max_elevation,
|
||||
spawn_by = def.near_nodes,
|
||||
num_spawn_by = def.near_nodes_count,
|
||||
decoration = "moretrees:"..treename.."_sapling_ongen"
|
||||
spawn_by = def.spawn_by,
|
||||
num_spawn_by = def.num_spawn_by,
|
||||
}
|
||||
|
||||
if minetest.features.lsystem_decoration_type then
|
||||
deco_def.deco_type = "lsystem"
|
||||
deco_def.treedef = moretrees[treename .. "_model"]
|
||||
else
|
||||
deco_def.deco_type = "simple"
|
||||
deco_def.decoration = "moretrees:"..treename.."_sapling_ongen"
|
||||
end
|
||||
|
||||
deco_ids[#deco_ids+1] = treename .. ("_" .. index or "_1")
|
||||
|
||||
return deco_def
|
||||
@ -176,33 +182,35 @@ minetest.register_decoration(translate_biome_defs(moretrees.poplar_biome_3, "pop
|
||||
minetest.register_decoration(translate_biome_defs(moretrees.poplar_small_biome, "poplar_small", 4))
|
||||
minetest.register_decoration(translate_biome_defs(moretrees.poplar_small_biome_2, "poplar_small", 5))
|
||||
|
||||
--[[
|
||||
this is purposefully wrapped in a on mods loaded callback to that it gets the proper ids
|
||||
if other mods clear the registered decorations
|
||||
]]
|
||||
minetest.register_on_mods_loaded(function()
|
||||
for k, v in pairs(deco_ids) do
|
||||
deco_ids[k] = minetest.get_decoration_id(v)
|
||||
end
|
||||
minetest.set_gen_notify("decoration", deco_ids)
|
||||
end)
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
local g = minetest.get_mapgen_object("gennotify")
|
||||
local locations = {}
|
||||
for _, id in pairs(deco_ids) do
|
||||
local deco_locations = g["decoration#" .. id] or {}
|
||||
for _, pos in pairs(deco_locations) do
|
||||
locations[#locations+1] = pos
|
||||
if not minetest.features.lsystem_decoration_type then
|
||||
--[[
|
||||
this is purposefully wrapped in a on mods loaded callback to that it gets the proper ids
|
||||
if other mods clear the registered decorations
|
||||
]]
|
||||
minetest.register_on_mods_loaded(function()
|
||||
for k, v in pairs(deco_ids) do
|
||||
deco_ids[k] = minetest.get_decoration_id(v)
|
||||
end
|
||||
end
|
||||
minetest.set_gen_notify("decoration", deco_ids)
|
||||
end)
|
||||
|
||||
if #locations == 0 then return end
|
||||
for _, pos in ipairs(locations) do
|
||||
local timer = minetest.get_node_timer({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
timer:start(math.random(2,10))
|
||||
end
|
||||
end)
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
local g = minetest.get_mapgen_object("gennotify")
|
||||
local locations = {}
|
||||
for _, id in pairs(deco_ids) do
|
||||
local deco_locations = g["decoration#" .. id] or {}
|
||||
for _, pos in pairs(deco_locations) do
|
||||
locations[#locations+1] = pos
|
||||
end
|
||||
end
|
||||
|
||||
if #locations == 0 then return end
|
||||
for _, pos in ipairs(locations) do
|
||||
local timer = minetest.get_node_timer({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
timer:start(math.random(2,10))
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Code to spawn a birch tree
|
||||
|
||||
|
@ -261,7 +261,6 @@ moretrees.jungletree_model={
|
||||
trunk_type=nil,
|
||||
thin_branches=true,
|
||||
fruit_chance=15,
|
||||
fruit="vines:vine"
|
||||
}
|
||||
|
||||
moretrees.fir_model={
|
||||
@ -269,7 +268,7 @@ moretrees.fir_model={
|
||||
rules_a=nil,
|
||||
rules_b=nil,
|
||||
trunk="moretrees:fir_trunk",
|
||||
leaves=nil,
|
||||
leaves="moretrees:fir_leaves",
|
||||
angle=45,
|
||||
iterations=7,
|
||||
random_level=5,
|
||||
|
Reference in New Issue
Block a user