Compare commits

...

2 Commits

Author SHA1 Message Date
Bram van den Heuvel 565f0c74b2 Finish initial functional version 2024-05-02 00:41:35 +02:00
Bram van den Heuvel 2bdf747429 Add MineClone2 support 2024-05-02 00:38:40 +02:00
3 changed files with 52 additions and 168 deletions

View File

@ -1,3 +1,26 @@
# Noordstar caves
The Noordstar caves mod helps add more caves to MineClone2 and Mineclonia.
For reference, see the [API documentation](API.md).
This mod offers no new features to the player, but it allows programmers to add
custom caves into the world and to lower the world depth.
## Tested & supported on
The mod has been tested on the following games:
- [x] MineClone2
- [ ] Mineclonia
- [ ] MTG
The mod has been tested on the following mapgens:
- [x] v7
- [ ] valleys
- [ ] carpathian
- [ ] v5
- [ ] flat
- [ ] fractal
- [ ] singlenode

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)

View File

@ -2,4 +2,5 @@ name=noordstar_caves
description=A mod that adds more depths and caves to VoxeLibre or Mineclonia
author=Noordstar
title=Noordstar Caves
depends=mcl_init
depends=mcl_init
optional_depends=mcl_init,mcl_worlds