Clean up cave biomes.

This commit is contained in:
Duane 2016-06-09 01:04:53 -05:00
parent e447a3f506
commit 3ddce086ca
3 changed files with 242 additions and 196 deletions

View file

@ -2,10 +2,6 @@ local deco_depth = -30 -- place cave stuff this far beneath the surface
local light_depth = -13 -- depth above which to place corals/sea plants local light_depth = -13 -- depth above which to place corals/sea plants
local water_level = 1 local water_level = 1
local fluid_compression = -200 -- the depth to start planting lava/water local fluid_compression = -200 -- the depth to start planting lava/water
local dirt_ratio = 10 -- place this many stones for every dirt in caves
local radioactive_ratio = 500 -- place this much salt for every radioactive ore
local coalblock_ratio = 100 -- place this many sand for every coalblock
local fungal_stone_ratio = 50 -- place this many stones for every glowing fungus
local water_lily_ratio = 15 -- place this many water for every lily local water_lily_ratio = 15 -- place this many water for every lily
local max_depth = 31000 local max_depth = 31000
@ -158,7 +154,7 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
end end
local biome_val = biome_n[index3d] local biome_val = biome_n[index3d]
local stone_type = node["default:stone"] local stone_type = "default:stone"
local stone_depth = 1 local stone_depth = 1
-- Compress biomes at the surface to avoid fluids. -- Compress biomes at the surface to avoid fluids.
@ -168,43 +164,34 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
------------------- -------------------
--biome_val = -0.75 --biome_val = -0.75
------------------- -------------------
local biome = nil
if underzone and y < (underzone.ceiling + underzone.floor) / 2 then if underzone and y < (underzone.ceiling + underzone.floor) / 2 then
stone_type = node[underzone.floor_node] biome = underzone
stone_type = underzone.floor_node
stone_depth = 2 stone_depth = 2
elseif underzone then elseif underzone then
stone_type = node[underzone.ceiling_node] biome = underzone
stone_depth = 2 stone_type = underzone.ceiling_node
elseif biome_val < -0.65 then
stone_type = node["default:ice"]
stone_depth = 2
elseif biome_val < -0.6 then
stone_type = node["fun_caves:thin_ice"]
stone_depth = 2
elseif biome_val < -0.5 then
stone_type = node["fun_caves:stone_with_lichen"]
elseif biome_val < -0.3 then
stone_type = node["fun_caves:stone_with_moss"]
elseif biome_val < -0.0 then
stone_type = node["fun_caves:stone_with_lichen"]
elseif biome_val < 0.2 then
stone_type = node["fun_caves:stone_with_algae"]
elseif y <= undersea then
-- This is seperate to prevent the hot biomes spawning underwater.
stone_type = node["default:dirt"]
stone_depth = 2
elseif biome_val < 0.35 then
stone_type = node["fun_caves:stone_with_salt"]
stone_depth = 2
elseif biome_val < 0.5 then
stone_type = node["default:sand"]
stone_depth = 2
elseif biome_val < 0.6 then
stone_type = node["fun_caves:black_sand"]
stone_depth = 2 stone_depth = 2
else else
stone_type = node["fun_caves:hot_cobble"] for _, bi in pairs(fun_caves.cave_biomes) do
if biome_val >= bi.biome_val_low and biome_val < bi.biome_val_high then
biome = bi
end end
-- "glow" end
if not biome then
print(("* Error in biome selection: %s"):format(biome_val))
end
if not biome or (y < undersea and not biome.underwater) then
biome = fun_caves.cave_biomes['algae']
end
stone_type = biome.stone_type
stone_depth = biome.stone_depth
end
local node_below local node_below
if y > minp.y then if y > minp.y then
@ -212,17 +199,19 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
end end
local node_above = data[ivm + area.ystride] local node_above = data[ivm + area.ystride]
if underzone and underzone.name == 'Minauros' and y < underzone.floor + 10 and data[ivm] == node['air'] then if underzone and underzone.lake and y < underzone.floor + underzone.lake_level and data[ivm] == node['air'] then
data[ivm] = node["fun_caves:water_poison_source"] data[ivm] = node[underzone.lake]
write = true
break
elseif underzone and underzone.name == 'Phlegethos' and y < underzone.floor + 5 and data[ivm] == node['air'] then
data[ivm] = node["default:lava_source"]
write = true write = true
break break
end end
if data[ivm] == node["default:stone"] then if data[ivm] == node["default:stone"] then
if node_above == node["air"] and biome and biome.dirt and rand(biome.dirt_chance) == 1 then
data[ivm] = node[biome.dirt]
write = true
break
end
local air_above = false local air_above = false
for i = 1, stone_depth do for i = 1, stone_depth do
if data[ivm + area.ystride * i] == node["air"] or (y < undersea and data[ivm + area.ystride * i] == node["default:water_source"]) then if data[ivm + area.ystride * i] == node["air"] or (y < undersea and data[ivm + area.ystride * i] == node["default:water_source"]) then
@ -230,26 +219,13 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
end end
end end
if node_above == node["air"] and (stone_type == node["fun_caves:stone_with_algae"] or stone_type == node["fun_caves:stone_with_lichen"]) and rand(dirt_ratio) == 1 then
data[ivm] = node["dirt"]
write = true
break
end
if air_above then if air_above then
if stone_type == node["fun_caves:stone_with_salt"] and rand(radioactive_ratio) == 1 then if biome and biome.deco and rand(biome.deco_chance) == 1 then
data[ivm] = node["fun_caves:radioactive_ore"] data[ivm] = node[biome.deco]
write = true
break
elseif stone_type == node["fun_caves:black_sand"] and rand(coalblock_ratio) == 1 then
data[ivm] = node["default:coalblock"]
break
elseif node_above == node["air"] and stone_type == node["fun_caves:stone_with_moss"] and rand(fungal_stone_ratio) == 1 then
data[ivm] = node["fun_caves:glowing_fungal_stone"]
write = true write = true
break break
else else
data[ivm] = stone_type data[ivm] = node[stone_type]
write = true write = true
break break
end end
@ -262,33 +238,26 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
end end
end end
if not air_above and stone_type == node["default:sand"] then if not air_above and stone_type == "default:sand" then
data[ivm] = node["default:sandstone"] data[ivm] = node["default:sandstone"]
write = true write = true
break break
end end
if data[ivm] == node["default:stone"] and air_below then if air_below then
if stone_type == node["fun_caves:stone_with_salt"] and rand(radioactive_ratio) == 1 then if biome and biome.deco and rand(biome.deco_chance) == 1 then
data[ivm] = node["fun_caves:radioactive_ore"] data[ivm] = node[biome.deco]
write = true
break
elseif stone_type == node["fun_caves:black_sand"] and rand(coalblock_ratio) == 1 then
data[ivm] = node["default:coalblock"]
write = true
break
elseif node_below == node["air"] and (stone_type == node["fun_caves:stone_with_lichen"] or stone_type == node["fun_caves:stone_with_moss"]) and rand(fungal_stone_ratio) == 1 then
data[ivm] = node["fun_caves:glowing_fungal_stone"]
write = true write = true
break break
else else
data[ivm] = stone_type data[ivm] = node[stone_type]
write = true write = true
break break
end end
end end
end end
-- smallest city generator ever
if underzone and underzone.name == 'Dis' and data[ivm] == node['air'] and floor((x - minp.x) / 8) % 2 == 0 and floor((z - minp.z) / 8) % 2 == 0 and y - underzone.floor < dis_map[floor((x - minp.x) / 8)][floor((z - minp.z) / 8)] * 4 + 1 and y - underzone.floor >= 0 then if underzone and underzone.name == 'Dis' and data[ivm] == node['air'] and floor((x - minp.x) / 8) % 2 == 0 and floor((z - minp.z) / 8) % 2 == 0 and y - underzone.floor < dis_map[floor((x - minp.x) / 8)][floor((z - minp.z) / 8)] * 4 + 1 and y - underzone.floor >= 0 then
local dx = (x - minp.x) % 16 local dx = (x - minp.x) % 16
local dy = y - underzone.floor + 1 local dy = y - underzone.floor + 1
@ -308,73 +277,26 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
if data[ivm] == node["air"] and y < maxp.y then if data[ivm] == node["air"] and y < maxp.y then
-- hanging down -- hanging down
if node_above == node["default:stone"] and rand(12) == 1 then -- stone hasn't yet been changed
if stone_type == node["default:ice"] then if biome and biome.stalactite and node_above == node["default:stone"] and rand(biome.stalactite_chance) == 1 then
data[ivm] = node["fun_caves:icicle_down"] data[ivm] = node[biome.stalactite]
write = true write = true
break break
elseif stone_type == node["fun_caves:stone_with_algae"] then
data[ivm] = node["fun_caves:stalactite_slimy"]
write = true
break
elseif stone_type == node["fun_caves:stone_with_moss"] then
data[ivm] = node["fun_caves:stalactite_mossy"]
write = true
break
elseif stone_type == node["fun_caves:stone_with_lichen"] then
data[ivm] = node["fun_caves:stalactite"]
write = true
break
elseif stone_type == node["default:stone"] then
data[ivm] = node["fun_caves:stalactite"]
write = true
break
end
end end
-- fluids -- fluids
if not underzone and y > minp.y and (node_below == node["default:stone"] or node_below == node["fun_caves:hot_cobble"]) and rand(300) == 1 then if y > minp.y and biome and biome.fluid and node_below == node[stone_type] and rand(biome.fluid_chance) == 1 then
data[ivm] = node["default:lava_source"] data[ivm] = node[biome.fluid]
write = true
break
elseif node_below == node["fun_caves:stone_with_moss"] and rand(300) == 1 then
data[ivm] = node["default:water_source"]
write = true
break
elseif underzone and underzone.name == 'Phlegethos' and node_below == node["fun_caves:hot_cobble"] and rand(1200) == 1 then
data[ivm] = node["default:lava_source"]
write = true
break
elseif node_below == node["fun_caves:polluted_dirt"] and rand(2000) == 1 then
data[ivm] = node["fun_caves:water_poison_source"]
write = true write = true
break break
-- standing up -- standing up
elseif node_below == node["default:ice"] and rand(12) == 1 then elseif node_below == node[stone_type] and biome and biome.stalagmite and rand(biome.stalagmite_chance) == 1 then
data[ivm] = node["fun_caves:icicle_up"] if type(biome.stalagmite) == 'table' then
write = true data[ivm] = node[biome.stalagmite[rand(#biome.stalagmite)]]
break else
elseif node_below == node["fun_caves:stone_with_algae"] and rand(12) == 1 then data[ivm] = node[biome.stalagmite]
data[ivm] = node["fun_caves:stalagmite_slimy"] end
write = true
break
elseif node_below == node["fun_caves:stone_with_moss"] and rand(12) == 1 then
data[ivm] = node["fun_caves:stalagmite_mossy"]
write = true
break
elseif node_below == node["fun_caves:stone_with_lichen"] and rand(12) == 1 then
data[ivm] = node["fun_caves:stalagmite"]
write = true
break
elseif node_below == node["default:stone"] and rand(12) == 1 then
data[ivm] = node["fun_caves:stalagmite"]
write = true
break
elseif node_below == node["fun_caves:hot_cobble"] and rand(50) == 1 then
data[ivm] = node[fun_caves.hot_spikes[rand(#fun_caves.hot_spikes)]]
elseif node_below == node["fun_caves:black_sand"] and rand(50) == 1 then
data[ivm] = node["fun_caves:constant_flame"]
write = true write = true
break break
@ -397,7 +319,7 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
place_schematic(minp, maxp, data, p2data, area, node, {x=x,y=y,z=z}, fun_caves.schematics['decaying_tree'], true) place_schematic(minp, maxp, data, p2data, area, node, {x=x,y=y,z=z}, fun_caves.schematics['decaying_tree'], true)
end end
end end
elseif node_below == node["default:dirt"] and (stone_type == node["fun_caves:stone_with_lichen"] or stone_type == node["fun_caves:stone_with_algae"]) and biome_val >= -0.5 then elseif node_below == node["default:dirt"] and biome and biome.fungi then
if rand(10) == 1 then if rand(10) == 1 then
data[ivm] = node["flowers:mushroom_red"] data[ivm] = node["flowers:mushroom_red"]
write = true write = true

View file

@ -75,71 +75,195 @@ end
fun_caves.underzones = { fun_caves.underzones = {
Caina={ Caina = {
name='Caina', name = 'Caina',
ceiling=-4852, ceiling = -4852,
ceiling_node='default:ice', ceiling_node = 'default:ice',
column_node='default:ice', column_node = 'default:ice',
column_node_rare = 'fun_caves:thin_ice', column_node_rare = 'fun_caves:thin_ice',
floor=-4972, floor = -4972,
floor_node='default:ice', floor_node = 'default:ice',
lower_bound=-4992, lower_bound = -4992,
regular_columns=false, regular_columns = false,
upper_bound=-4832, stalactite = 'fun_caves:icicle_down',
vary=true, stalactite_chance = 12,
upper_bound = -4832,
vary = true,
}, },
Phlegethos={ Phlegethos = {
name='Phlegethos', name = 'Phlegethos',
ceiling=-9892, ceiling = -9892,
ceiling_node='fun_caves:black_sand', ceiling_node = 'fun_caves:black_sand',
column_node='default:stone', column_node = 'default:stone',
column_node_rare = 'fun_caves:hot_stone', column_node_rare = 'fun_caves:hot_stone',
floor=-10012, floor = -10012,
floor_node='fun_caves:hot_cobble', floor_node = 'fun_caves:hot_cobble',
lower_bound=-10032, fluid = 'default:lava_source',
regular_columns=false, fluid_chance = 1200,
upper_bound=-9872, lake = 'default:lava_source',
vary=true, lake_level = 5,
lower_bound = -10032,
regular_columns = false,
upper_bound = -9872,
vary = true,
}, },
Dis={ Dis = {
name='Dis', name = 'Dis',
ceiling=-14914, ceiling = -14914,
ceiling_node='fun_caves:hot_brass', ceiling_node = 'fun_caves:hot_brass',
column_node='default:steelblock', column_node = 'default:steelblock',
column_node_rare = nil, column_node_rare = nil,
floor=-14982, floor = -14982,
floor_node='fun_caves:hot_brass', floor_node = 'fun_caves:hot_brass',
lower_bound=-14992, lower_bound = -14992,
regular_columns=true, regular_columns = true,
upper_bound=-14912, upper_bound = -14912,
vary=false, vary = false,
}, },
Minauros={ Minauros = {
name='Minauros', name = 'Minauros',
ceiling=-19812, ceiling = -19812,
ceiling_node='fun_caves:black_sand', ceiling_node = 'fun_caves:black_sand',
column_node='fun_caves:polluted_dirt', column_node = 'fun_caves:polluted_dirt',
column_node_rare = 'fun_caves:glowing_fungal_stone', column_node_rare = 'fun_caves:glowing_fungal_stone',
floor=-19932, floor = -19932,
floor_node='fun_caves:polluted_dirt', floor_node = 'fun_caves:polluted_dirt',
lower_bound=-19952, fluid = 'fun_caves:water_poison_source',
regular_columns=false, fluid_chance = 2000,
upper_bound=-19792, lake = 'fun_caves:water_poison_source',
vary=true, lake_level = 10,
lower_bound = -19952,
regular_columns = false,
upper_bound = -19792,
vary = true,
}, },
Styx={ Styx = {
name='Styx', name = 'Styx',
ceiling=-29812, ceiling = -29812,
ceiling_node='default:dirt', ceiling_node = 'default:dirt',
column_node=nil, column_node = nil,
column_node_rare = nil, column_node_rare = nil,
floor=-30012, floor = -30012,
floor_node='default:dirt', floor_node = 'default:dirt',
lower_bound=-30032, lower_bound = -30032,
regular_columns=false, regular_columns = false,
sealevel=-29842, sealevel = -29842,
upper_bound=-29792, upper_bound = -29792,
vary=true, vary = true,
},
}
fun_caves.cave_biomes = {
algae = {
biome_val_low = 0,
biome_val_high = 0.2,
dirt = 'default:dirt',
dirt_chance = 10,
fungi = true,
stalactite = 'fun_caves:stalactite_slimy',
stalactite_chance = 12,
stalagmite = 'fun_caves:stalagmite_slimy',
stalagmite_chance = 12,
stone_type = 'fun_caves:stone_with_algae',
stone_depth = 1,
underwater = true,
},
coal = {
biome_val_low = 0.5,
biome_val_high = 0.6,
deco = 'default:coalblock',
deco_chance = 100,
fungi = nil,
stalagmite = 'fun_caves:constant_flame',
stalagmite_chance = 50,
stone_type = 'fun_caves:black_sand',
stone_depth = 2,
underwater = false,
},
hot = {
biome_val_low = 0.6,
biome_val_high = 99,
fluid = 'default:lava_source',
fluid_chance = 300,
stalagmite = fun_caves.hot_spikes,
stalagmite_chance = 50,
stone_type = 'fun_caves:hot_cobble',
stone_depth = 1,
underwater = false,
},
ice = {
biome_val_low = -99,
biome_val_high = -0.6,
stalactite = 'fun_caves:icicle_down',
stalactite_chance = 12,
stalagmite = 'fun_caves:icicle_up',
stalagmite_chance = 12,
stone_type = 'default:ice',
stone_depth = 2,
underwater = true,
},
ice_thin = {
biome_val_low = -0.6,
biome_val_high = -0.5,
stone_type = 'fun_caves:thin_ice',
stone_depth = 2,
underwater = true,
},
lichen = {
biome_val_low = -0.3,
biome_val_high = 0,
dirt = 'default:dirt',
dirt_chance = 10,
fungi = true,
stalactite = 'fun_caves:stalactite',
stalactite_chance = 12,
stalagmite = 'fun_caves:stalagmite',
stalagmite_chance = 12,
stone_type = 'fun_caves:stone_with_lichen',
stone_depth = 1,
underwater = true,
},
lichen_dead = {
biome_val_low = -0.6,
biome_val_high = -0.5,
stalactite = 'fun_caves:stalactite',
stalactite_chance = 12,
stalagmite = 'fun_caves:stalagmite',
stalagmite_chance = 12,
stone_type = 'fun_caves:stone_with_lichen',
stone_depth = 1,
underwater = true,
},
moss = {
biome_val_low = -0.5,
biome_val_high = -0.3,
deco = 'fun_caves:glowing_fungal_stone',
deco_chance = 50,
fluid = 'default:water_source',
fluid_chance = 300,
stalactite = 'fun_caves:stalactite_mossy',
stalactite_chance = 12,
stalagmite = 'fun_caves:stalagmite_mossy',
stalagmite_chance = 12,
stone_type = 'fun_caves:stone_with_moss',
stone_depth = 1,
underwater = true,
},
salt = {
biome_val_low = 0.2,
biome_val_high = 0.35,
deco = 'fun_caves:radioactive_ore',
deco_chance = 500,
stone_type = 'fun_caves:stone_with_salt',
stone_depth = 2,
underwater = false,
},
sand = {
biome_val_low = 0.35,
biome_val_high = 0.5,
stone_type = 'default:sand',
stone_depth = 2,
underwater = true,
}, },
} }

View file

@ -249,17 +249,17 @@ end
if minetest.registered_entities["mobs_slimes:green_big"] then if minetest.registered_entities["mobs_slimes:green_big"] then
mobs:spawn_specific("mobs_slimes:green_big", mobs:spawn_specific("mobs_slimes:green_big",
{"fun_caves:stone_with_moss", "fun_caves:stone_with_algae"}, {"fun_caves:stone_with_moss", "fun_caves:stone_with_algae", 'fun_caves:polluted_dirt'},
{"air"}, {"air"},
4, 20, 30, 30000, 1, -31000, 31000 4, 20, 30, 30000, 1, -31000, 31000
) )
mobs:spawn_specific("mobs_slimes:green_medium", mobs:spawn_specific("mobs_slimes:green_medium",
{"fun_caves:stone_with_moss", "fun_caves:stone_with_algae"}, {"fun_caves:stone_with_moss", "fun_caves:stone_with_algae", 'fun_caves:polluted_dirt'},
{"air"}, {"air"},
4, 20, 30, 30000, 2, -31000, 31000 4, 20, 30, 30000, 2, -31000, 31000
) )
mobs:spawn_specific("mobs_slimes:green_small", mobs:spawn_specific("mobs_slimes:green_small",
{"default:dirt_with_grass", "default:junglegrass", "default:mossycobble", "ethereal:green_dirt_top"}, {"default:dirt_with_grass", "default:junglegrass", "default:mossycobble", "ethereal:green_dirt_top", 'fun_caves:polluted_dirt'},
{"air"}, {"air"},
4, 20, 30, 30000, 3, -31000, 31000 4, 20, 30, 30000, 3, -31000, 31000
) )