Finish initial functional version

main
Bram van den Heuvel 2024-05-02 00:41:35 +02:00
parent 2bdf747429
commit 565f0c74b2
1 changed files with 27 additions and 167 deletions

194
init.lua
View File

@ -10,7 +10,7 @@ local internal =
{ a = nil
-- Average size of a cave biome
, biome_size = { x = 50, y = 50, z = 50 }
, biome_size = { x = 250, y = 250, z = 250 }
-- Average blob size of connectivity noise params
, cnct_blob = { x = 250, y = 100, z = 250 }
@ -91,7 +91,9 @@ noordstar_caves =
-- - Make sure that the output changes VERY SLOWLY over time
-- - Keep the function performant as it will be executed many, many times
, cave_vastness = function(pos)
return pos.y / internal.world_depth
local y = math.abs(pos.y)
local d = math.abs(internal.world_depth / 2)
return 1 - (math.abs(y - d) / d)
end
-- A public list of all registered biomes
@ -1123,6 +1125,26 @@ function internal.shape_def_distance(def, cnct, vrtcl)
return dx^2 + dy^2
end
-- Prevent v7 from spawning large caves underground
function internal.stop_v7_caverns()
local s = minetest.get_mapgen_setting("mgv7_spflags")
if s then
s = s:gsub(", nocaverns", "")
s = s:gsub(", caverns" , "")
s = s:gsub("nocaverns, ", "")
s = s:gsub("caverns, " , "")
s = s:gsub("nocaverns" , "")
s = s:gsub("caverns" , "")
if s == "" then
minetest.set_mapgen_setting("mgv7_spflags", "nocaverns", true)
else
minetest.set_mapgen_setting("mgv7_spflags", s .. ", nocaverns", true)
end
end
end
-- Get verticality noise params
function internal.verticality_noise_params()
local factor = math.max(
@ -1303,174 +1325,12 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
timer.stop()
end)
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Prevent v7 from spawning large caves underground
internal.stop_v7_caverns()
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- For show, the following code COULD in theory be run elsewhere
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
noordstar_caves.register_shape({
name = "noordstar_caves:bubbles",
noise_params = {
offset = 0.5,
scale = 0.5,
spread = { x = 20, y = 20, z = 20 },
seed = 248039,
octaves = 2,
persistence = 0.6,
lacunarity = 2.0,
flags = "eased"
},
func = function(pos, n)
return n
end,
-- TODO: Implement y limits
-- y_min = -31000,
-- y_max = 31000,
connectivity_point = 10,
verticality_point = 40,
})
noordstar_caves.register_shape({
name = "noordstar_caves:cliffs",
noise_params = {
offset = 0.4,
scale = 0.5,
spread = { x = 20, y = 100, z = 20 },
seed = 97354,
octaves = 4,
persistence = 0.6,
lacunarity = 2.0,
flags = ""
},
func = function(pos, n)
return n
end,
connectivity_point = 30,
verticality_point = 80,
})
noordstar_caves.register_shape({
name = "noordstar_caves:donuts",
noise_params = {
offset = 0.0,
scale = 1.0,
spread = { x = 30, y = 30, z = 30 },
seed = 3934,
octaves = 1,
persistence = 0.6,
lacunarity = 2.0,
flags = "eased"
},
func = function(pos, n)
return 1 - 2 * math.abs(n)^0.5
end,
connectivity_point = 50,
verticality_point = 40,
})
noordstar_caves.register_shape({
name = "noordstar_caves:wall",
func = function(pos, n)
return -0.5
end,
connectivity_point = 0,
verticality_point = 0,
})
-- noordstar_caves.set_world_depth(-60)
-- noordstar_caves.cave_vastness = function(pos) return math.abs(pos.y - 60) / 120 end
noordstar_caves.register_biome({
name = "nc:glowing_floor",
node_floor = "mcl_core:crying_obsidian",
node_wall = "mcl_core:sand",
node_roof = "mcl_ocean:sea_lantern",
node_dust = "mcl_core:snow",
heat_point = 20,
humidity_point = 0,
})
noordstar_caves.register_biome({
name = "nc:crazy_glowin_walls",
node_floor = "mcl_amethyst:amethyst_block",
node_wall = "mcl_crimson:shroomlight",
node_roof = "mcl_colorblocks:glazed_terracotta_silver",
heat_point = 100,
humidity_point = 0,
})
noordstar_caves.register_biome({
name = "nc:regular",
heat_point = 50,
humidity_point = 50,
})
noordstar_caves.register_biome({
name = "nc:cold",
node_dust = "mcl_core:snow",
node_roof = "mcl_core:ice",
heat_point = 10,
humidity_point = 100,
})
noordstar_caves.register_biome({
name = "nc:grass",
node_floor = "mcl_core:dirt_with_grass",
heat_point = 50,
humidity_point = 70,
})
noordstar_caves.register_biome({
name = "nc:dangerous_lava",
node_floor = "mcl_core:lava_source",
y_max = -40,
heat_point = 100,
humidity_point = 100,
})
noordstar_caves.register_decoration({
deco_type = "simple",
place_on = "floor",
fill_ratio = 0.01,
decoration = "mcl_core:cactus",
height = 3,
height_max = 8,
biomes = { "nc:glowing_floor" },
})
noordstar_caves.register_decoration({
deco_type = "simple",
place_on = "ceiling",
fill_ratio = 0.1,
decoration = "mcl_ocean:sea_lantern",
height = 1,
height_max = 4,
biomes = { "nc:crazy_glowin_walls" },
place_offset_y = -3,
})
noordstar_caves.register_decoration({
deco_type = "schematic",
place_on = "floor",
fill_ratio = 0.001,
schematic = squeak,
rotation = "random",
-- place_offset_y = 5,
})
noordstar_caves.set_world_depth(-993)