Allow use of most mapgens. Add some dungeon variety.

This commit is contained in:
Duane 2016-06-23 20:21:38 -05:00
parent 1aebdf3b47
commit 3e3e0c17d6
11 changed files with 280 additions and 211 deletions

View file

@ -27,7 +27,11 @@ local plant_noise = {offset = 0.0, scale = 1.0, spread = {x = 200, y = 200, z =
-- Air needs to be placed prior to decorations.
fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, biome_ids, underzone, dis_map)
csize = vector.add(vector.subtract(maxp, minp), 1)
local biomemap = minetest.get_mapgen_object("biomemap")
local biomemap
if fun_caves.use_bi_hi then
biomemap = minetest.get_mapgen_object("biomemap")
end
local map_max = {x = csize.x, y = csize.y + 2, z = csize.z}
local map_min = {x = minp.x, y = minp.y - 1, z = minp.z}
@ -306,7 +310,7 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
local node_below = data[ivm - area.ystride]
local node_above = data[ivm + area.ystride]
if y < water_level and data[ivm] == node["default:sand"] and node_above == node["default:water_source"] and data[ivm + area.ystride * 2] == node["default:water_source"] and coral_biomes[biome] and pn < -0.1 and math_random(5) == 1 and fun_caves.surround(node, data, area, ivm) then
if y < water_level and data[ivm] == node["default:sand"] and node_above == node["default:water_source"] and data[ivm + area.ystride * 2] == node["default:water_source"] and (not biomemap or coral_biomes[biome]) and pn < -0.1 and math_random(5) == 1 and fun_caves.surround(node, data, area, ivm) then
if math_random(100) == 1 then
data[ivm] = node["fun_caves:precious_coral_water_sand"]
else
@ -314,7 +318,7 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
end
write = true
break
elseif y < water_level and node_below == node["default:sand"] and node_above == node["default:water_source"] and data[ivm] == node["default:water_source"] and coral_biomes[biome] and pn < -0.1 and math_random(5) < 3 then
elseif y < water_level and node_below == node["default:sand"] and node_above == node["default:water_source"] and data[ivm] == node["default:water_source"] and (not biomemap or coral_biomes[biome]) and pn < -0.1 and math_random(5) < 3 then
if math_random(15) == 1 then
data[ivm] = node["fun_caves:brain_coral"]
write = true
@ -358,14 +362,14 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
end
end
if node_match_cache[desc.content_id][data[ivm]] == "good" and desc.fill_ratio and (not desc.biomes or (biome and desc.biomes and table.contains(desc.biomes, biome))) and math_random() <= desc.fill_ratio then
if node_match_cache[desc.content_id][data[ivm]] == "good" and desc.fill_ratio and (not desc.biomes or (not biomemap) or (biome and desc.biomes and table.contains(desc.biomes, biome))) and math_random() <= desc.fill_ratio then
data[ivm] = desc.content_id
write = true
break
end
end
end
elseif y > minp.y and node_below == node["default:river_water_source"] and data[ivm] == node["air"] and water_lily_biomes[biome] and pn > 0.5 and math_random(water_lily_ratio) == 1 then
elseif y > minp.y and node_below == node["default:river_water_source"] and data[ivm] == node["air"] and (not biomemap or water_lily_biomes[biome]) and pn > 0.5 and math_random(water_lily_ratio) == 1 then
-- on top of the water
-- I haven't figured out what the decoration manager is
-- doing with the noise functions, but this works ok.