Add acacia trees and rotation.
parent
c67e7a17b7
commit
edd82cce62
|
@ -12,3 +12,46 @@ minetest.add_group("default:pine_needles", {leafdecay = 5})
|
|||
dofile(loud_walking.path.."/deco_deciduous.lua")
|
||||
dofile(loud_walking.path.."/deco_conifer.lua")
|
||||
dofile(loud_walking.path.."/deco_jungle.lua")
|
||||
|
||||
|
||||
loud_walking.schematics.acacia_trees = {}
|
||||
local mz = 9
|
||||
local mx = 9
|
||||
local my = 7
|
||||
local s = loud_walking.schematic_array(mx, my, mz)
|
||||
for i = 1, #s.data do
|
||||
s.data[i] = { name = "air", prob = 0 }
|
||||
end
|
||||
|
||||
local y1 = 5
|
||||
for z1 = 0, 5, 5 do
|
||||
for x1 = 0, 5, 5 do
|
||||
if x1 ~= z1 then
|
||||
for z = 0, 3 do
|
||||
for x = 0, 3 do
|
||||
local i = (z + z1) * mx * my + y1 * mx + x1 + x + 1
|
||||
s.data[i] = { name = "default:acacia_leaves", prob = 240 }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
y1 = 6
|
||||
for z1 = 4, 0, -4 do
|
||||
for x1 = 0, 4, 4 do
|
||||
if x1 == z1 then
|
||||
for z = 0, 4 do
|
||||
for x = 0, 4 do
|
||||
local i = (z + z1) * mx * my + y1 * mx + x1 + x + 1
|
||||
s.data[i] = { name = "default:acacia_leaves", prob = 240 }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local trunk = {{4,0,4}, {4,1,4}, {4,2,4}, {4,3,4}, {3,4,3}, {5,4,5}, {3,3,5}, {5,3,3}, {2,5,2}, {6,5,6}, {2,4,6}, {6,4,2}}
|
||||
for _, p in pairs(trunk) do
|
||||
local i = p[3] * mx * my + p[2] * mx + p[1] + 1
|
||||
s.data[i] = { name = "default:acacia_tree", prob = 255 }
|
||||
end
|
||||
loud_walking.schematics.acacia_trees[#loud_walking.schematics.acacia_trees+1] = s
|
||||
|
|
30
mapgen.lua
30
mapgen.lua
|
@ -36,9 +36,14 @@ do
|
|||
tree_biomes["rainforest"] = {"jungle_trees"}
|
||||
tree_biomes["rainforest_swamp"] = {"jungle_trees"}
|
||||
tree_biomes["coniferous_forest"] = {"conifer_trees"}
|
||||
tree_biomes["savanna"] = {"acacia_trees"}
|
||||
|
||||
for i, obiome in pairs(minetest.registered_biomes) do
|
||||
local biome = table.copy(obiome)
|
||||
biome.special_tree_prob = 2
|
||||
if biome.name == "savanna" then
|
||||
biome.special_tree_prob = 30
|
||||
end
|
||||
local rarity = "common"
|
||||
biome.terrain_scale = biome_terrain_scale[biome] or 0.5
|
||||
if string.find(biome.name, "ocean") then
|
||||
|
@ -75,6 +80,7 @@ mushroom_stones[node("loud_walking:stone_with_algae")] = true
|
|||
mushroom_stones[node("loud_walking:stone_with_lichen")] = true
|
||||
|
||||
local function place_schematic(pos, schem, center)
|
||||
local rot = math.random(4) - 1
|
||||
local yslice = {}
|
||||
if schem.yslice_prob then
|
||||
for _, ys in pairs(schem.yslice_prob) do
|
||||
|
@ -87,13 +93,23 @@ local function place_schematic(pos, schem, center)
|
|||
pos.z = pos.z - math.floor(schem.size.z / 2)
|
||||
end
|
||||
|
||||
for z = 0, schem.size.z - 1 do
|
||||
local dz = pos.z - minp.z + z
|
||||
for x = 0, schem.size.x - 1 do
|
||||
for z1 = 0, schem.size.z - 1 do
|
||||
for x1 = 0, schem.size.x - 1 do
|
||||
local x, z
|
||||
if rot == 0 then
|
||||
x, z = x1, z1
|
||||
elseif rot == 1 then
|
||||
x, z = schem.size.z - z1 - 1, x1
|
||||
elseif rot == 2 then
|
||||
x, z = schem.size.x - x1 - 1, schem.size.z - z1 - 1
|
||||
elseif rot == 3 then
|
||||
x, z = z1, schem.size.x - x1 - 1
|
||||
end
|
||||
local dz = pos.z - minp.z + z
|
||||
local dx = pos.x - minp.x + x
|
||||
if pos.x + x > minp.x and pos.x + x < maxp.x and pos.z + z > minp.z and pos.z + z < maxp.z then
|
||||
local ivm = a:index(pos.x + x, pos.y, pos.z + z)
|
||||
local isch = z * schem.size.y * schem.size.x + x + 1
|
||||
local isch = z1 * schem.size.y * schem.size.x + x1 + 1
|
||||
for y = 0, schem.size.y - 1 do
|
||||
local dy = pos.y - minp.y + y
|
||||
if math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) > bevel then
|
||||
|
@ -189,7 +205,7 @@ local function get_biome(px, pz)
|
|||
end
|
||||
local biome = biome_names[rarity][math.random(#biome_names[rarity])]
|
||||
return biome
|
||||
--return "sandstone_grassland"
|
||||
--return "savanna"
|
||||
end
|
||||
|
||||
local function get_decoration(biome)
|
||||
|
@ -422,13 +438,13 @@ function loud_walking.generate(p_minp, p_maxp, seed)
|
|||
print(biome)
|
||||
for dz = 0, 75, 5 do
|
||||
for dx = 0, 75, 5 do
|
||||
if math.random(2) == 1 then
|
||||
if biomes[biome].special_tree_prob and math.random(biomes[biome].special_tree_prob) == 1 then
|
||||
local x = minp.x + dx + math.random(5) - 1
|
||||
local z = minp.z + dz + math.random(5) - 1
|
||||
local y = minp.y + get_height(x - minp.x, z - minp.z, biomes[biome].terrain_scale, ocean) + ground
|
||||
|
||||
local ivm = a:index(x, y, z)
|
||||
if (swamp or data[ivm + a.ystride] ~= node("default:water_source")) and (data[ivm] == node("default:dirt") or data[ivm] == node("default:dirt_with_grass") or data[ivm] == node("default:dirt_with_snow")) then
|
||||
if (swamp or data[ivm + a.ystride] ~= node("default:water_source")) and (data[ivm] == node(node_top)) then
|
||||
if biomes[biome].special_trees then
|
||||
local tree_type = biomes[biome].special_trees[math.random(#biomes[biome].special_trees)]
|
||||
if tree_type then
|
||||
|
|
Loading…
Reference in New Issue