Rezepte bearbeitet, nicht verwendete mods gelöscht, Höhlen schöner gemacht

This commit is contained in:
N-Nachtigal 2025-05-19 17:01:55 +02:00
parent cf017b2ca1
commit 11f0b9fb09
695 changed files with 3432 additions and 15035 deletions

View file

@ -22,18 +22,17 @@ minetest.register_on_joinplayer(function(player)
end)
--]]
--load companion lua files
dofile(modpath.."/config.lua") --configuration file; holds various constants
dofile(modpath.."/crafting.lua") --crafting recipes
dofile(modpath.."/nodes.lua") --node definitions
dofile(modpath.."/functions.lua") --function definitions
dofile(modpath.."/plants.lua")
dofile(modpath.."/hotsprings.lua")
dofile(modpath .. "/config.lua") --configuration file; holds various constants
dofile(modpath .. "/crafting.lua") --crafting recipes
dofile(modpath .. "/nodes.lua") --node definitions
dofile(modpath .. "/functions.lua") --function definitions
dofile(modpath .. "/plants.lua")
dofile(modpath .. "/hotsprings.lua")
if minetest.get_modpath("mobs_monster") then
if caverealms.config.dm_spawn == true then
dofile(modpath.."/dungeon_master.lua") --special DMs for DM's Lair biome
dofile(modpath .. "/dungeon_master.lua") --special DMs for DM's Lair biome
end
end
@ -61,30 +60,65 @@ local DM_TOP = caverealms.config.dm_top -- -4000 --level at which Dungeon Master
local DM_BOT = caverealms.config.dm_bot -- -5000 --level at which "" ends
local DEEP_CAVE = caverealms.config.deep_cave -- -7000 --level at which deep cave biomes take over
-- 3D noise for caves
local np_cave = {
offset = 0,
scale = 1,
spread = { x = 512, y = 256, z = 512 }, -- squashed 2:1
seed = 59033,
octaves = 6,
persist = 0.63,
}
-- 3D noise for wave
local np_wave = {
offset = 0,
scale = 1,
spread = { x = 256, y = 256, z = 256 },
seed = -400000000089,
octaves = 3,
persist = 0.67,
}
-- 2D noise for biome
local np_biome = {
offset = 0,
scale = 1,
spread = { x = 250, y = 250, z = 250 },
seed = 9130,
octaves = 3,
persist = 0.5,
}
-- 2D noise for biome
local np_biome_evil = {
offset = 0,
scale = 1,
spread = {x=200, y=200, z=200},
spread = { x = 200, y = 200, z = 200 },
seed = 9130,
octaves = 3,
persist = 0.5
persist = 0.5,
}
local np_biome_wonder = {
offset = 0,
scale = 1,
spread = {x=400, y=400, z=400},
spread = { x = 400, y = 400, z = 400 },
seed = 8943,
octaves = 2,
persist = 0.45
persist = 0.45,
}
-- Stuff
subterrain = {}
local yblmin = YMIN + BLEND * 1.5
local yblmax = YMAX - BLEND * 1.5
-- On generated function
@ -102,13 +136,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
local x0 = minp.x
local y0 = minp.y
local z0 = minp.z
--print ("[caverealms] chunk minp ("..x0.." "..y0.." "..z0..")") --tell people you are generating a chunk
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
local data = vm:get_data()
--grab content IDs
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
@ -116,10 +150,10 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_sandstone = minetest.get_content_id("default:sandstone")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_sand = minetest.get_content_id("default:sand")
local c_water = minetest.get_content_id("default:water_source")
local c_lava = minetest.get_content_id("default:lava_source")
local c_ice = minetest.get_content_id("default:ice")
local c_iced = minetest.get_content_id("default:ice")
local c_ice = minetest.get_content_id("default:sand")
local c_ice = minetest.get_content_id("default:silver_sand")
local c_thinice = minetest.get_content_id("caverealms:thin_ice")
@ -149,7 +183,54 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_bflame = minetest.get_content_id("caverealms:constant_flame_blue")
local c_firefly = minetest.get_content_id("fireflies:firefly")
local c_bluefly = minetest.get_content_id("caverealms:butterfly_blue")
-- ethereal
--if minetest.get_modpath("ethereal") then
local c_bluegrass = minetest.get_content_id("ethereal:crystalgrass")
--else
--end
--too_many_stones
--if minetest.get_modpath("too_many_stones") then
local c_torangecrys = minetest.get_content_id("too_many_stone:crocoite_crystal")
local c_tredcrys = minetest.get_content_id("too_many_stone:eudialite_crystal")
local c_tblackcrys = minetest.get_content_id("too_many_stone:eudialite_crystal")
local c_fakesalt = minetest.get_content_id("too_many_stone:rose_quartz_crystal")
--else
--end
--everness
--if minetest.get_modpath("everness") then
local c_bluetwist = minetest.get_content_id("everness:twisted_crytal_grass")
local c_icevine = minetest.get_content_id("everness:lumabus_vine_1")
local c_purplevine = minetest.get_content_id("everness:whispering_gourd_vine_1")
local c_icicles_c = minetest.get_content_id("everness:frosted_icicle")
local c_icicles_f = minetest.get_content_id("everness:frosted_icicle_floor")
local c_crystcyan = minetest.get_content_id("everness:crystal_cyan")
local c_crystorange = minetest.get_content_id("everness:crystal_orange")
local c_crystpurple = minetest.get_content_id("everness:crystal_purple")
local c_flamepurple = minetest.get_content_id("everness:flame_permanent_purple")
local c_flameblue = minetest.get_content_id("everness:flame_permanent_blue")
local c_frostedice = minetest.get_content_id("everness:frosted_ice")
local c_mosspurple = minetest.get_content_id("everness:ivis_moss")
local c_bluelant = minetest.get_content_id("everness:blue_vine_lantern")
local c_redlant = minetest.get_content_id("everness:glowing_pillar")
--else
--end
--herbs
--if minetest.get_modpath("herbs") then
--else
--end
--riesenpilz
-- if minetest.get_modpath("riesenpilz") then
local c_blueglowshroom = minetest.get_content_id("riesenpilz:glowshroom")
--else
--end
-- crystals
local c_crystore = minetest.get_content_id("caverealms:glow_ore")
local c_emerald = minetest.get_content_id("caverealms:glow_emerald")
@ -164,7 +245,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_amethore = minetest.get_content_id("caverealms:glow_amethyst_ore")
local c_hotspring = minetest.get_content_id("caverealms:hotspring_water_source")
local stone_nodes = {
[c_stone] = 1,
[c_desertstone] = 1,
@ -174,7 +254,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
[c_desand] = 1,
[c_obsidian] = 1,
}
if nil ~= minetest.get_modpath("geology") then
stone_nodes[minetest.get_content_id("geology:gneiss")] = 1
stone_nodes[minetest.get_content_id("geology:slate")] = 1
@ -189,63 +269,57 @@ minetest.register_on_generated(function(minp, maxp, seed)
stone_nodes[minetest.get_content_id("geology:schist")] = 1
stone_nodes[minetest.get_content_id("geology:anthracite")] = 1
end
--mandatory values
local sidelen = x1 - x0 + 1 --length of a mapblock
local chulens = {x=sidelen, y=sidelen, z=sidelen} --table of chunk edges
local chulens2D = {x=sidelen, y=sidelen, z=1}
local minposxyz = {x=x0, y=y0, z=z0} --bottom corner
local minposxz = {x=x0, y=z0} --2D bottom corner
local nvals_biome_e = minetest.get_perlin_map(np_biome_evil, chulens2D):get2dMap_flat({x=x0+150, y=z0+50}) --2D noise for biomes (will be 3D humidity/temp later)
local nvals_biome_w = minetest.get_perlin_map(np_biome_wonder, chulens2D):get2dMap_flat({x=x0+150, y=z0+50}) --2D noise for biomes (will be 3D humidity/temp later)
local chulens = { x = sidelen, y = sidelen, z = sidelen } --table of chunk edges
local chulens2D = { x = sidelen, y = sidelen, z = 1 }
local minposxyz = { x = x0, y = y0, z = z0 } --bottom corner
local minposxz = { x = x0, y = z0 } --2D bottom corner
local nvals_biome_e = minetest.get_perlin_map(np_biome_evil, chulens2D):get2dMap_flat({ x = x0 + 150, y = z0 + 50 }) --2D noise for biomes (will be 3D humidity/temp later)
local nvals_biome_w =
minetest.get_perlin_map(np_biome_wonder, chulens2D):get2dMap_flat({ x = x0 + 150, y = z0 + 50 }) --2D noise for biomes (will be 3D humidity/temp later)
local nixyz = 1 --3D node index
local nixz = 1 --2D node index
local nixyz2 = 1 --second 3D index for second loop
for z = z0, z1 do -- for each xy plane progressing northwards
--increment indices
nixyz = nixyz + 1
--decoration loop
for y = y0, y1 do -- for each x row progressing upwards
local is_deep = false
if y < DEEP_CAVE then
is_deep = true
end
local vi = area:index(x0, y, z)
for x = x0, x1 do -- for each node do
local ai = area:index(x,y+1,z) --above index
local bi = area:index(x,y-1,z) --below index
local ai = area:index(x, y + 1, z) --above index
local bi = area:index(x, y - 1, z) --below index
local mode = 0 -- nothing, 1 = ground, 2 = ceiling
if data[vi] == c_air then
if stone_nodes[data[bi]] ~= nil then --ground
mode = 1
elseif stone_nodes[data[bi]] ~= nil and y < y1 then -- ceiling
elseif stone_nodes[data[ai]] ~= nil and y < y1 then -- ceiling
mode = 2
end
end
if mode > 0 then
local a2i = area:index(x,y+2,z) --above index
local a2i = area:index(x, y + 2, z) --above index
--determine biome
local biome = 0 --preliminary declaration
local n_biome_e = nvals_biome_e[nixz] --make an easier reference to the noise
local n_biome_w = nvals_biome_w[nixz] --make an easier reference to the noise
local n_biome_e = nvals_biome_e[nixz] --make an easier reference to the noise
local n_biome_w = nvals_biome_w[nixz] --make an easier reference to the noise
local n_biome = (n_biome_e + n_biome_w) / 2
local floor = c_hcobble
local floor_depth = 1
local worms = {}
@ -255,35 +329,41 @@ minetest.register_on_generated(function(minp, maxp, seed)
local decos = {}
local decos2 = {}
local deco_mul = 1
local wiggle = (math.random() - 0.5) / 20
n_biome_e = n_biome_e + wiggle
n_biome_w = n_biome_w + wiggle
if n_biome_e < -0.33 then
if n_biome_w < -0.33 then -- algae
floor = c_algae
worms = {c_worm_green}
worms = { c_worm_green }
worm_max_len = 3
decos = {c_mycena}
decos = { c_mycena }
if mode == 1 and data[ai] == c_air and math.random() < 0.03 then
data[ai] = c_firefly
end
elseif n_biome_w < 0.33 then -- moss
floor = c_moss
worms = {c_worm_green, c_worm_blue}
worms = { c_worm_green, c_worm_blue }
worm_max_len = 3
decos = {c_mycena}
decos = { c_mycena }
deco_mul = 2.0
if mode == 1 and data[ai] == c_air and math.random() < 0.001 then
caverealms:grow_green_mushroom(x,y-1,z, area, data)
caverealms:grow_green_mushroom(x, y - 1, z, area, data)
end
else -- lichen
if is_deep then --magical lichen deco
worms = { c_crystpurple, c_crystpurple, c_purplevine }
decos = { c_mosspurple, c_flamepurple, c_crystpurple, c_bluetwist }
else -- normal lichen
worms = { c_worm_blue }
decos = { c_mycena, c_fungus, c_fungus }
end
floor = c_lichen
worms = {c_worm_blue}
worm_max_len = 3
decos = {c_mycena, c_fungus, c_fungus}
deco_mul = 3.3
if mode == 1 and data[ai] == c_air and math.random() < 0.003 then
data[ai] = c_bluefly
@ -291,44 +371,56 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
elseif n_biome_e < 0.33 then
if n_biome_w < -0.33 then -- desert
if math.random() < 0.05 then
floor = c_coalblock
elseif math.random() < 0.15 then
floor = c_coaldust
else
floor = c_desand
if is_deep then
floor = c_hcobble
else
floor = c_desand
end
end
floor_depth = 2
worms = {c_worm_red}
worms = { c_worm_red }
worm_max_len = 1
decos = {c_flame, c_spike}
decos = { c_flame, c_spike }
elseif n_biome_w < 0.33 then -- salt
floor = c_salt
floor_depth = 2
worms = {c_icid}
worms = { c_fakesalt }
worm_max_len = 1
no_mites = true
decos = {c_saltgem}
else -- glacial
floor = c_thinice
floor_depth = 2
worms = {c_icid}
worm_max_len = 1
decos = {c_gem}
decos = { c_saltgem }
else
if is_deep then --magic deep glacial
floor = c_frostedice
floor_depth = 2
worms = { c_icevine, c_crystcyan, c_crystcyan }
worm_max_len = 1
decos = { c_crystcyan, c_blueglowshroom }
else --glacial
floor = c_thinice
floor_depth = 2
worms = { c_icid }
worm_max_len = 1
decos = { c_gem, c_iciu }
end
end
else
if n_biome_w < -0.33 then -- hotspring
floor = c_hcobble
worms = {c_icid}
worms = { c_icid }
worm_max_len = 1
if mode == 1 and math.random() < 0.005 then
caverealms:spawn_hotspring(x,y,z, area, data, math.random(4) + 2)
caverealms:spawn_hotspring(x, y, z, area, data, math.random(4) + 2)
end
decos = {c_fire_vine}
decos = { c_fire_vine }
deco_mul = 0.7
elseif n_biome_w < 0.33 then -- dungeon
if math.random() < 0.5 then
@ -336,136 +428,222 @@ minetest.register_on_generated(function(minp, maxp, seed)
else
floor = c_gobsidian2
end
worms = {c_worm_red}
worms = { c_worm_red }
worm_max_len = 4
decos = {c_flame, c_flame, c_fire_vine}
decos = { c_flame, c_flame, c_fire_vine }
else -- deep glacial
floor = c_ice
floor_depth = 3
worms = {c_icid}
worms = { c_icid }
worm_max_len = 1
decos = {c_bflame}
decos = { c_bflame, c_iciu }
end
end
-- place floor
if mode == 1 then --ground
for i = 1,floor_depth do
local ii = area:index(x,y-i,z)
for i = 1, floor_depth do
local ii = area:index(x, y - i, z)
if stone_nodes[data[bi]] ~= nil then
data[ii] = floor
end
end
-- decorations
if math.random() < ICICHA * deco_mul and data[bi] ~= c_hotspring then
data[vi] = decos[math.random(1, #decos)]
end
-- salt crystals
if floor == c_salt and math.random() < SALTCRYCHA then
caverealms:salt_stalagmite(x,y-1,z, area, data)
caverealms:salt_stalagmite(x, y - 1, z, area, data)
end
-- stone stalagmites
if math.random() < STAGCHA then
caverealms:stalagmite(x,y,z, area, data)
caverealms:stalagmite(x, y, z, area, data)
end
-- crystal stalagmites
if not no_mites and math.random() < CRYSTAL then
local ore
local cry
if n_biome_e < 0 then -- non-evil
if n_biome_w < -0.33 then
ore = c_crystore
cry = c_crystal
elseif n_biome_w < 0.33 then
--for randomness - for stalagmites or stalagtites in a different color
local mode = 1
if math.random(15) == 1 then --chance 1/15
mode = 2
end
if biome == 3 then
if math.random(25) == 1 then --chance 1/25
mode = 2
else
mode = 1
end
end
if biome == 4 or biome == 5 then
if math.random(3) == 1 then --chance 1/3
mode = 2
end
end
if n_biome_e < -0.33 then -- non-evil
if n_biome_w < -0.33 then --algae
ore = c_emore
cry = c_emerald
else
ore = c_amethore
cry = c_ameth
elseif n_biome_w < 0.33 then --moss
ore = c_emore
cry = c_emerald
else --lichen
if is_deep then --magical lichen
if math.random(10) == 1 then --chance 1/10 for mese
ore = c_meseore
cry = c_mesecry
else
ore = c_amethore
cry = c_ameth
end
else --lichen
ore = c_amethore
cry = c_ameth
end
end
elseif n_biome_e < 0.4 then -- moderately evil
if n_biome_w < 0 then
elseif n_biome_e < 0.33 then -- moderately evil
if n_biome_w < -0.33 then --desert / sand
ore = c_citore
cry = c_citrine
if is_deep then --hot cobble
ore = c_rubore
cry = c_ruby
end
elseif n_biome_w < 0.33 then --salt
ore = c_meseore
cry = c_mesecry
else
ore = c_citore
cry = c_citrine
if is_deep then --magic deep glacial
if math.random(3) == 1 then
ore = c_iced
cry = c_thinice
else
ore = c_crystore
cry = c_crystal
end
else --glacial
ore = c_crystore
cry = c_crystal
end
end
else -- very evil
ore = c_rubore
cry = c_ruby
if n_biome_w < -0.33 then --hotcobble-hotsprings
ore = c_rubore
cry = c_ruby
elseif n_biome_w < 0.33 then --obsidian-dungeon
ore = c_rubore
cry = c_ruby
else --deep_glacial
if math.random(3) == 1 then
ore = c_iced
cry = c_thinice
else
ore = c_crystore
cry = c_crystal
end
end
end
local base = floor
caverealms:crystal_stalagmite(x,y-1,z, area, data, ore, cry, base)
caverealms:crystal_stalagmite(x, y - 1, z, area, data, ore, cry, base)
end
if n_biome_w > 0.5 and n_biome_e < -0.33 and math.random() < GIANTCHA then --giant mushrooms
caverealms:giant_shroom(x, y, z, area, data)
end
elseif mode == 2 then -- place ceiling
if math.random() < ICICHA then
local worm = worms[math.random(1,#worms)]
local worm = worms[math.random(1, #worms)]
local wdepth = math.random(1, worm_max_len)
for i = 0,wdepth-1 do
local ii = area:index(x,y-i,z)
for i = 0, wdepth - 1 do
local ii = area:index(x, y - i, z)
if data[ii] == c_air then
data[ii] = worm
end
end
end
-- stalactites
if not no_tites and math.random() < CRYSTAL then
local ore
local cry
if n_biome_e < 0 then -- non-evil
if n_biome_w < -0.33 then
ore = c_crystore
cry = c_crystal
elseif n_biome_w < 0.33 then
--for randomness - for stalagmites or stalagtites in a different color
local mode = 1
if math.random(15) == 1 then --chance 1/15
mode = 2
end
if biome == 3 then
if math.random(25) == 1 then --chance 1/25
mode = 2
else
mode = 1
end
end
if biome == 4 or biome == 5 then
if math.random(3) == 1 then --chance 1/3
mode = 2
end
end
if n_biome_e < -0.33 then -- non-evil
if n_biome_w < -0.33 then --algae
ore = c_emore
cry = c_emerald
else
ore = c_amethore
cry = c_ameth
elseif n_biome_w < 0.33 then --moss
ore = c_emore
cry = c_emerald
else --lichen
if is_deep then --magical lichen
ore = c_amethore
cry = c_ameth
else --lichen
ore = c_amethore
cry = c_ameth
end
end
elseif n_biome_e < 0.4 then -- moderately evil
if n_biome_w < 0 then
ore = c_meseore
cry = c_mesecry
else
elseif n_biome_e < 0.33 then -- moderately evil
if n_biome_w < -0.33 then --desert / sand
ore = c_citore
cry = c_citrine
if is_deep then --hot cobble
ore = c_rubore
cry = c_ruby
end
elseif n_biome_w < 0.33 then --salt
ore = c_meseore
cry = c_mesecry
else --glacial
ore = c_crystore
cry = c_crystal
end
else -- very evil
ore = c_rubore
cry = c_ruby
if n_biome_w < -0.33 then --hotcobble-hotsprings
ore = c_rubore
cry = c_ruby
elseif n_biome_w < 0.33 then --obsidian-dungeon
ore = c_rubore
cry = c_ruby
else --deep_glacial
ore = c_crystore
cry = c_crystal
end
end
local base = c_stone
caverealms:crystal_stalactite(x,y,z, area, data, ore, cry, base)
caverealms:crystal_stalactite(x, y, z, area, data, ore, cry, base)
end
end
end
nixyz2 = nixyz2 + 1
nixz = nixz + 1
vi = vi + 1
@ -478,7 +656,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
--send data back to voxelmanip
vm:set_data(data)
--calc lighting
vm:set_lighting({day=0, night=0})
vm:set_lighting({ day = 0, night = 0 })
vm:calc_lighting()
--write it to world
vm:write_to_map(data)