commit
3c5e8e16db
@ -169,6 +169,8 @@ function vmg.generate(minp, maxp, seed)
|
||||
local c_banana_tree = minetest.get_content_id("valleys_mapgen:banana_tree")
|
||||
local c_banana_leaves = minetest.get_content_id("valleys_mapgen:banana_leaves")
|
||||
local c_banana = minetest.get_content_id("valleys_mapgen:banana")
|
||||
local c_birch_tree = minetest.get_content_id("valleys_mapgen:birch_tree")
|
||||
local c_birch_leaves = minetest.get_content_id("valleys_mapgen:birch_leaves")
|
||||
local c_cherryblossom_tree = minetest.get_content_id("valleys_mapgen:cherry_blossom_tree")
|
||||
local c_cherryblossom_leaves = minetest.get_content_id("valleys_mapgen:cherry_blossom_leaves")
|
||||
local c_jungletree = minetest.get_content_id("default:jungletree")
|
||||
@ -428,6 +430,11 @@ function vmg.generate(minp, maxp, seed)
|
||||
if math.random(100) <= 10 then
|
||||
vmg.make_cherry_blossom_tree(pos, data, a, height, radius, c_cherryblossom_tree, c_cherryblossom_leaves, c_air, c_ignore)
|
||||
end
|
||||
elseif temp > 0.5 and temp < 1 and humidity < 1.4 and v13 < 1 and v14 < 0.1 and v15 < 0.75 and y > 10 then -- birch tree
|
||||
local rand = math.random()
|
||||
local height = math.floor(6 + 2.5 * rand)
|
||||
local radius = 2 + rand
|
||||
vmg.make_birch_tree(pos, data, a, height, radius, c_birch_tree, c_birch_leaves, c_air, c_ignore)
|
||||
end
|
||||
elseif plants and math.random() < plant_density and above > 0 then -- make a plant
|
||||
if temp > 1 and temp < 1.8 and water > 0.7 and humidity > 3 and v13 > -0.4 and math.random() < 0.04 then -- Papyrus
|
||||
|
@ -120,12 +120,14 @@ register_dirts("Sandy")
|
||||
|
||||
-- Credits / Notes
|
||||
-- Banana tree: textures by demon_boy
|
||||
-- Birch tree: textures by Gael-de-Sailly
|
||||
-- Cherry Blossom tree: textures by demon_boy
|
||||
-- Fir tree: Fir trees don't exist in the default game. Textures from Forest mod by Gael-de-Sailly
|
||||
|
||||
vmg.treelist = {
|
||||
-- treename treedesc leafname leafdesc leaftiles fruitname fruitdesc droprarity selbox healthpoints
|
||||
{"banana", "Banana", "leaves", "Leaves", "banana_leaves", "banana", "Banana", 20, {-0.35, -0.5, -0.35, 0.35, 0.5, 0.35}, 3},
|
||||
{"birch", "Birch", "leaves", "Leaves", "birch_leaves", nil, nil, 20, nil, nil},
|
||||
{"cherry_blossom", "Cherry Blossom", "leaves", "Leaves", "cherry_blossom_leaves", nil, nil, 20, nil, nil},
|
||||
{"fir", "Fir", "needles", "Needles", "fir_leaves", nil, nil, 20, nil, nil},
|
||||
}
|
||||
|
BIN
textures/vmg_birch_leaves.png
Normal file
BIN
textures/vmg_birch_leaves.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 925 B |
BIN
textures/vmg_birch_sapling.png
Normal file
BIN
textures/vmg_birch_sapling.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 362 B |
BIN
textures/vmg_birch_tree.png
Normal file
BIN
textures/vmg_birch_tree.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 828 B |
BIN
textures/vmg_birch_tree_top.png
Normal file
BIN
textures/vmg_birch_tree_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 530 B |
BIN
textures/vmg_birch_wood.png
Normal file
BIN
textures/vmg_birch_wood.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 376 B |
51
trees.lua
51
trees.lua
@ -43,6 +43,22 @@ minetest.register_abm({
|
||||
end
|
||||
})
|
||||
|
||||
-- Birch sapling growth
|
||||
minetest.register_abm({
|
||||
nodenames = {"valleys_mapgen:birch_sapling"},
|
||||
interval = 20,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
if not can_grow(pos) then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("action", "A birch sapling grows into a tree at "..
|
||||
minetest.pos_to_string(pos))
|
||||
vmg.grow_birch_tree(pos)
|
||||
end
|
||||
})
|
||||
|
||||
-- Cherry Blossom sapling growth
|
||||
minetest.register_abm({
|
||||
nodenames = {"valleys_mapgen:cherry_blossom_sapling"},
|
||||
@ -105,6 +121,26 @@ function vmg.grow_banana_tree(pos)
|
||||
vm:update_map()
|
||||
end
|
||||
|
||||
function vmg.grow_birch(pos)
|
||||
local rand = math.random()
|
||||
local height = math.floor(6 + 2.5 * rand)
|
||||
local radius = 2 + rand
|
||||
|
||||
-- VoxelManip stuff
|
||||
local leaves = minetest.get_content_id("valleys_mapgen:birch_leaves")
|
||||
local trunk = minetest.get_content_id("valleys_mapgen:birch_tree")
|
||||
local air = minetest.get_content_id("air")
|
||||
local ignore = minetest.get_content_id("ignore")
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local emin, emax = vm:read_from_map({x = pos.x - 4, y = pos.y, z = pos.z - 4}, {x = pos.x + 4, y = pos.y + height + 4, z = pos.z + 4})
|
||||
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||
local data = vm:get_data()
|
||||
vmg.make_birch_tree(pos, data, area, height, radius, trunk, leaves, air, ignore)
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
vm:update_map()
|
||||
end
|
||||
|
||||
function vmg.grow_cherry_blossom_tree(pos)
|
||||
-- individual parameters
|
||||
local rand = math.random()
|
||||
@ -229,6 +265,21 @@ function vmg.make_banana_tree(pos, data, area, height, radius, trunk, leaves, fr
|
||||
vmg.make_leavesblob(pos, data, area, leaves, air, ignore, {x = radius, y = radius, z = radius}, np, 0.06, fruit)
|
||||
end
|
||||
|
||||
function vmg.make_birch_tree(pos, data, area, height, radius, trunk, leaves, air, ignore)
|
||||
if vmg.loglevel >= 3 then
|
||||
print("[Valleys Mapgen] Generating birch tree at " .. minetest.pos_to_string(pos) .. " ...")
|
||||
end
|
||||
local ystride = area.ystride -- Useful to get the index above
|
||||
local iv = area:indexp(pos)
|
||||
for i = 1, height do -- Build the trunk
|
||||
data[iv] = trunk
|
||||
iv = iv + ystride -- increment by one node up
|
||||
end
|
||||
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
|
||||
pos.y = pos.y + height - 1
|
||||
vmg.make_leavesblob(pos, data, area, leaves, air, ignore, {x = radius, y = radius, z = radius}, np)
|
||||
end
|
||||
|
||||
function vmg.make_cherry_blossom_tree(pos, data, area, height, radius, trunk, leaves, air, ignore)
|
||||
if vmg.loglevel >= 3 then
|
||||
print("[Valleys Mapgen] Generating cherry blossom tree at " .. minetest.pos_to_string(pos) .. " ...")
|
||||
|
Loading…
x
Reference in New Issue
Block a user