Rename mod to ns_cavegen

main
Bram van den Heuvel 2024-09-10 18:09:42 +02:00
parent 147b8a59c2
commit baeda1ac7a
4 changed files with 44 additions and 44 deletions

24
API.md
View File

@ -10,9 +10,9 @@ Underground caves have varying shapes, and the variable
For shapes, the following functions are available:
- `noordstar_caves.register_shape(shape def)` Define a new cave shape
- `noordstar_caves.unregister_shape(name)` Remove a defined cave shape
- `noordstar_caves.clear_registered_shapes()` Remove all known cave shapes
- `ns_cavegen.register_shape(shape def)` Define a new cave shape
- `ns_cavegen.unregister_shape(name)` Remove a defined cave shape
- `ns_cavegen.clear_registered_shapes()` Remove all known cave shapes
Generally, it is recommended to keep the number of cave shapes below 100.
A good number of shapes is 10 for diversity but performance.
@ -21,7 +21,7 @@ The shapes are defined as follows:
```lua
{
name = "noordstar_caves:bubbles",
name = "ns_cavegen:bubbles",
-- Unique name identifying the shape
-- Namespacing is not required but recommended
@ -105,15 +105,15 @@ caves. The cave biomes are independent of the cave shapes.
For shapes, the following functions are available:
- `noordstar_caves.register_biome(biome def)` Define a new cave biome
- `noordstar_caves.unregister_biome(name)` Remove a defined cave biome
- `noordstar_caves.clear_registered_biomes()` Remove all known cave biomes
- `ns_cavegen.register_biome(biome def)` Define a new cave biome
- `ns_cavegen.unregister_biome(name)` Remove a defined cave biome
- `ns_cavegen.clear_registered_biomes()` Remove all known cave biomes
The biomes are defined as follows:
```lua
{
name = "noordstar_caves:tundra",
name = "ns_cavegen:tundra",
-- Unique name identifying the biome
-- Namespacing is not required but recommended
@ -165,8 +165,8 @@ structures to cave biomes.
For decorations, the following functions are defined:
- `noordstar_caves.register_decoration(decoration def)` Define a new cave decoration
- `noordstar_caves.clear_registered_decorations()` Remove all known cave decorations
- `ns_cavegen.register_decoration(decoration def)` Define a new cave decoration
- `ns_cavegen.clear_registered_decorations()` Remove all known cave decorations
The decorations are defined as follows:
@ -181,7 +181,7 @@ The decorations are defined as follows:
fill_ratio = 0.02,
-- Percentage of surface nodes on which this decoration will spawn
biomes = { "noordstar_caves:tundra", "foo:desert" },
biomes = { "ns_cavegen:tundra", "foo:desert" },
-- List of (cave!) biomes that this decoration will spawn in. Occurs in all
-- biomes if this is omitted.
@ -271,7 +271,7 @@ this.
In case you wish to do a few other operations, here's a few other functions
that might be helpful to you:
- `noordstar_caves.set_world_depth(h)` Set the world's depth to a given number.
- `ns_cavegen.set_world_depth(h)` Set the world's depth to a given number.
This feature is currently only supported in VoxeLibre. Contributions that help
change the world depth in other games, are very welcome.

View File

@ -49,7 +49,7 @@ local internal = {}
-------------------------------------------------------------------------------
function internal.cave_vastness(pos)
local v = ns_caves.cave_vastness(pos)
local v = ns_cavegen.cave_vastness(pos)
if not v then
return 0
@ -208,7 +208,7 @@ end
-- Get connectivity noise params
function internal.connectivity_noise_params()
local factor = math.max(1, math.abs(#ns_caves.registered_shapes) ^ 0.5)
local factor = math.max(1, math.abs(#ns_cavegen.registered_shapes) ^ 0.5)
return {
offset = 50,
@ -229,7 +229,7 @@ end
-- Get a default cave biome in case no biomes are registered
function internal.default_biome()
return internal.clean_biome_def(
{ name = "noordstar_caves:default_biome"
{ name = "ns_cavegen:default_biome"
, heat_point = OUTLANDISH_POINT
, humidity_point = OUTLANDISH_POINT
}
@ -239,7 +239,7 @@ end
-- Get a default cave shape in case no shapes are registered
function internal.default_shape()
return internal.clean_shape_def(
{ name = "noordstar_caves:none"
{ name = "ns_cavegen:none"
, connectivity_point = OUTLANDISH_POINT
, verticality_point = OUTLANDISH_POINT
, func = function (pos, v) return 0 end
@ -270,7 +270,7 @@ function internal.find_biome_allocations(heat, humidity)
local biome_name
-- Find the appropriate biome
for name, def in pairs(ns_caves.registered_biomes) do
for name, def in pairs(ns_cavegen.registered_biomes) do
local def_d = internal.euclidian(
e, def.heat_point, u, def.humidity_point
)
@ -303,7 +303,7 @@ function internal.find_shape_allocations(connectivity, verticality)
local shape_name
-- Find the appropriate shape
for name, def in pairs(ns_caves.registered_shapes) do
for name, def in pairs(ns_cavegen.registered_shapes) do
local def_d = internal.euclidian(
c, def.connectivity_point, v, def.verticality_point
)
@ -337,7 +337,7 @@ function internal.find_shape_values(used_shapes, minp, maxp, va)
if name == nil then
shape = default_shape
else
shape = ns_caves.registered_shapes[name]
shape = ns_cavegen.registered_shapes[name]
end
if captured_shapes[shape] == nil then
@ -544,13 +544,13 @@ end
-- Register a new biome
function internal.register_biome(biome)
biome = internal.clean_biome_def(biome)
ns_caves.registered_biomes[biome.name] = biome
ns_cavegen.registered_biomes[biome.name] = biome
end
-- Register a new decoration
function internal.register_decoration(deco)
table.insert(
ns_caves.registered_decorations,
ns_cavegen.registered_decorations,
internal.clean_deco_def(deco)
)
end
@ -558,7 +558,7 @@ end
-- Register a new shape
function internal.register_shape(shape)
shape = internal.clean_shape_def(shape)
ns_caves.registered_shapes[shape.name] = shape
ns_cavegen.registered_shapes[shape.name] = shape
end
-- Convert all shape noise into clarifications whether a node is wall or air.
@ -581,7 +581,7 @@ end
-- Get verticality noise params
function internal.verticality_noise_params()
local factor = math.max(1, math.abs(#ns_caves.registered_shapes) ^ 0.5)
local factor = math.max(1, math.abs(#ns_cavegen.registered_shapes) ^ 0.5)
return {
offset = 50,
@ -615,7 +615,7 @@ function internal.write_classified_node(vm_data, va, used_biomes, classified_nod
if biome == default_biome.name then
biome_def = default_biome
else
biome_def = ns_caves.registered_biomes[biome] or default_biome
biome_def = ns_cavegen.registered_biomes[biome] or default_biome
end
if biome_def[biome_key] == nil then
@ -644,7 +644,7 @@ function internal.write_classified_node(vm_data, va, used_biomes, classified_nod
end
function internal.write_schematic_ceiling_decoration(vmanip, used_biomes, classified_nodes, sva, claimed_spots)
for _, def in pairs(ns_caves.registered_decorations) do
for _, def in pairs(ns_cavegen.registered_decorations) do
if def.deco_type == "schematic" and def.place_on == "ceiling" then
-- Place the decoration, if they're in the appropriate biome
for _, i in ipairs(classified_nodes) do
@ -699,7 +699,7 @@ function internal.write_schematic_ceiling_decoration(vmanip, used_biomes, classi
end
function internal.write_schematic_floor_decoration(vmanip, used_biomes, classified_nodes, sva, claimed_spots)
for _, def in pairs(ns_caves.registered_decorations) do
for _, def in pairs(ns_cavegen.registered_decorations) do
if def.deco_type == "schematic" and def.place_on == "floor" then
-- Place the decoration, if they're in the appropriate biome
for _, i in ipairs(classified_nodes) do
@ -741,7 +741,7 @@ end
function internal.write_simple_ceiling_decorations(vm_data, va, used_biomes, classified_nodes, sva)
local claimed_spots = {}
for _, def in pairs(ns_caves.registered_decorations) do
for _, def in pairs(ns_cavegen.registered_decorations) do
if def.deco_type == "simple" and def.place_on == "ceiling" then
-- Place the decoration, if they're in the appropriate biome.
for _, i in ipairs(classified_nodes) do
@ -795,7 +795,7 @@ end
function internal.write_simple_floor_decorations(vm_data, va, used_biomes, classified_nodes, sva)
local claimed_spots = {}
for _, def in pairs(ns_caves.registered_decorations) do
for _, def in pairs(ns_cavegen.registered_decorations) do
if def.deco_type == "simple" and def.place_on == "floor" then
-- Place the decoration, if they're in the appropriate biome.
for _, i in ipairs(classified_nodes) do
@ -866,7 +866,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
internal.mapgen(minp, maxp, blockseed, vm, va)
end)
ns_caves = {
ns_cavegen = {
cave_vastness = function(pos)
if pos.y > 0 or pos.y < WORLD_DEPTH then
return 0

View File

@ -1,5 +1,5 @@
ns_caves.register_shape({
name = "ns_caves:bubbles",
ns_cavegen.register_shape({
name = "ns_cavegen:bubbles",
noise_params = {
offset = -0.2,
scale = 0.5,
@ -16,8 +16,8 @@ ns_caves.register_shape({
verticality_point = 10,
})
ns_caves.register_shape({
name = "ns_caves:cliffs",
ns_cavegen.register_shape({
name = "ns_cavegen:cliffs",
noise_params = {
offset = -0.4,
scale = 0.9,
@ -34,8 +34,8 @@ ns_caves.register_shape({
verticality_point = 80,
})
ns_caves.register_biome({
name = "ns_caves:snow",
ns_cavegen.register_biome({
name = "ns_cavegen:snow",
node_dust = "mcl_core:snow",
node_floor = "mcl_crimson:shroomlight",
node_wall = "mcl_core:cobble",
@ -45,8 +45,8 @@ ns_caves.register_biome({
humidity_point = 50,
})
ns_caves.register_biome({
name = "ns_caves:drip",
ns_cavegen.register_biome({
name = "ns_cavegen:drip",
node_floor = "dripstone:dry_dripstone_block",
node_wall = "dripstone:dry_dripstone_block",
node_roof = "dripstone:dry_dripstone_block",
@ -54,17 +54,17 @@ ns_caves.register_biome({
humidity_point = 0,
})
ns_caves.register_decoration({
ns_cavegen.register_decoration({
deco_type = "simple",
place_on = "ceiling",
fill_ratio = 0.25,
biomes = { "ns_caves:snow" },
biomes = { "ns_cavegen:snow" },
decoration = "mcl_core:water_source",
height = 1,
place_offset_y = 2,
})
ns_caves.register_decoration({
ns_cavegen.register_decoration({
deco_type = "simple",
place_on = "ceiling",
fill_ratio = 0.025,
@ -73,7 +73,7 @@ ns_caves.register_decoration({
height_max = 7,
})
ns_caves.register_decoration({
ns_cavegen.register_decoration({
deco_type = "simple",
place_on = "floor",
fill_ratio = 0.025,

View File

@ -1,6 +1,6 @@
name=ns_caves
description=A mod that adds more depths and caves to VoxeLibre or Mineclonia
name=ns_cavegen
description=A custom cave generator engine
author=Noordstar
title=Noordstar Caves
title=Cave Generator
depends=dripstone,mcl_init
optional_depends=mcl_init,mcl_worlds