Improve ore generation to better match recent Minetest versions (#45)

Co-authored-by: Dirkfried <>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
This commit is contained in:
Dirkfried 2022-01-03 19:42:11 +01:00 committed by GitHub
parent cad7278522
commit fb2d58d8c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 136 additions and 17 deletions

@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased] ## [Unreleased]
### Changed
- [Tweaked ore generation to better fit Minetest's new defaults.](https://github.com/minetest-mods/moreores/pull/45)
- Three layers (two underground and one high air/space) are now used instead of just one layer.
- Chunk size is no longer used as clust size anymore. Clust sizes are usually
just 3 nodes and not the whole area ("chunk"), where the ores are generated.
- Adjusted several default values.
- Mithril is now generated *below* diamond. Note that there was a change
in Minetest 5.0.0 where most ore generation was shifted to much lower
altitude (shifting diamond generation altitude below mithril generation altitude).
- The mithril ores are now also grouped together and not just found as a
single node in one chunk.
- The same overall ore density is retained in the deep layer.
## [2.1.0] - 2021-06-28 ## [2.1.0] - 2021-06-28
### Added ### Added

@ -7,21 +7,74 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Chunk sizes for ore generation (bigger = ore deposits are more scattered around) -- Chunk sizes for ore generation (bigger = ore deposits are more scattered around)
moreores.tin_chunk_size = 7 -- Tin
moreores.silver_chunk_size = 11 moreores.tin_chunk_size_high = 10
moreores.mithril_chunk_size = 11 moreores.tin_chunk_size = 13
moreores.tin_chunk_size_deep = 10
-- Silver
moreores.silver_chunk_size_high = 11
moreores.silver_chunk_size = 13
moreores.silver_chunk_size_deep = 11
-- Mithril
moreores.mithril_chunk_size_high = 19
moreores.mithril_chunk_size = 21
moreores.mithril_chunk_size_deep = 19
-- Amount of ore per chunk (higher = bigger ore deposits) -- Amount of ore per chunk (higher = bigger ore deposits)
moreores.tin_ore_per_chunk = 3 -- Tin
moreores.silver_ore_per_chunk = 4 moreores.tin_ore_per_chunk_high = 5
moreores.mithril_ore_per_chunk = 1 moreores.tin_ore_per_chunk = 4
moreores.tin_ore_per_chunk_deep = 5
-- Minimal depths of ore generation (Y coordinate, 0 being sea level by default) -- Silver
moreores.tin_min_depth = -31000 moreores.silver_ore_per_chunk_high = 4
moreores.silver_min_depth = -31000 moreores.silver_ore_per_chunk = 2
moreores.mithril_min_depth = -31000 moreores.silver_ore_per_chunk_deep = 4
-- Maximal depths of ore generation (Y coordinate, 0 being sea level by default) -- Mithril
moreores.tin_max_depth = 8 moreores.mithril_ore_per_chunk_high = 3
moreores.silver_max_depth = -2 moreores.mithril_ore_per_chunk = 2
moreores.mithril_max_depth = -512 moreores.mithril_ore_per_chunk_deep = 4
-- Clust sizes for ore generation (bigger = ores in ore deposits are less bound together)
-- Tin
moreores.tin_clust_size_high = 3
moreores.tin_clust_size = 3
moreores.tin_clust_size_deep = 3
-- Silver
moreores.silver_clust_size_high = 3
moreores.silver_clust_size = 3
moreores.silver_clust_size_deep = 3
-- Mithril
moreores.mithril_clust_size_high = 3
moreores.mithril_clust_size = 3
moreores.mithril_clust_size_deep = 3
-- Maximal and minimal depths of ore generation (Y coordinate, 0 being sea level by default)
-- Tin
moreores.tin_max_depth_high = 31000
moreores.tin_min_depth_high = 1025
moreores.tin_max_depth = -64 -- For v6 mapgen, -32 fits better
moreores.tin_min_depth = -127
moreores.tin_max_depth_deep = -128
moreores.tin_min_depth_deep = -31000
-- Silver
moreores.silver_max_depth_high = 31000
moreores.silver_min_depth_high = 1025
moreores.silver_max_depth = -64 -- For v6 mapgen, -32 fits better
moreores.silver_min_depth = -127 -- For v6 mapgen, -63 fits better
moreores.silver_max_depth_deep = -128 -- For v6 mapgen, -64 fits better
moreores.silver_min_depth_deep = -31000
-- Mithril
moreores.mithril_max_depth_high = 31000
moreores.mithril_min_depth_high = 2049
moreores.mithril_max_depth = -2048 -- For v6 mapgen, -256 fits better
moreores.mithril_min_depth = -4095 -- For v6 mapgen, -511 fits better
moreores.mithril_max_depth_deep = -4096 -- For v6 mapgen, -512 fits better
moreores.mithril_min_depth_deep = -31000

@ -166,11 +166,21 @@ local function add_ore(modname, description, mineral_name, oredef)
}) })
end end
oredef.oredef_high.ore_type = "scatter"
oredef.oredef_high.ore = modname .. ":mineral_" .. mineral_name
oredef.oredef_high.wherein = "default:stone"
oredef.oredef.ore_type = "scatter" oredef.oredef.ore_type = "scatter"
oredef.oredef.ore = modname .. ":mineral_" .. mineral_name oredef.oredef.ore = modname .. ":mineral_" .. mineral_name
oredef.oredef.wherein = "default:stone" oredef.oredef.wherein = "default:stone"
oredef.oredef_deep.ore_type = "scatter"
oredef.oredef_deep.ore = modname .. ":mineral_" .. mineral_name
oredef.oredef_deep.wherein = "default:stone"
minetest.register_ore(oredef.oredef_high)
minetest.register_ore(oredef.oredef) minetest.register_ore(oredef.oredef)
minetest.register_ore(oredef.oredef_deep)
for tool_name, tooldef in pairs(oredef.tools) do for tool_name, tooldef in pairs(oredef.tools) do
local tdef = { local tdef = {
@ -244,13 +254,27 @@ local oredefs = {
silver = { silver = {
description = "Silver", description = "Silver",
makes = {ore = true, block = true, lump = true, ingot = true, chest = true}, makes = {ore = true, block = true, lump = true, ingot = true, chest = true},
oredef_high= {
clust_scarcity = moreores.silver_chunk_size_high ^ 3,
clust_num_ores = moreores.silver_ore_per_chunk_high,
clust_size = moreores.silver_clust_size_high,
y_min = moreores.silver_min_depth_high,
y_max = moreores.silver_max_depth_high,
},
oredef = { oredef = {
clust_scarcity = moreores.silver_chunk_size ^ 3, clust_scarcity = moreores.silver_chunk_size ^ 3,
clust_num_ores = moreores.silver_ore_per_chunk, clust_num_ores = moreores.silver_ore_per_chunk,
clust_size = moreores.silver_chunk_size, clust_size = moreores.silver_clust_size,
y_min = moreores.silver_min_depth, y_min = moreores.silver_min_depth,
y_max = moreores.silver_max_depth, y_max = moreores.silver_max_depth,
}, },
oredef_deep = {
clust_scarcity = moreores.silver_chunk_size_deep ^ 3,
clust_num_ores = moreores.silver_ore_per_chunk_deep,
clust_size = moreores.silver_clust_size_deep,
y_min = moreores.silver_min_depth_deep,
y_max = moreores.silver_max_depth_deep,
},
tools = { tools = {
pick = { pick = {
groupcaps = { groupcaps = {
@ -288,13 +312,27 @@ local oredefs = {
mithril = { mithril = {
description = "Mithril", description = "Mithril",
makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, makes = {ore = true, block = true, lump = true, ingot = true, chest = false},
oredef_high = {
clust_scarcity = moreores.mithril_chunk_size_high ^ 3,
clust_num_ores = moreores.mithril_ore_per_chunk_high,
clust_size = moreores.mithril_clust_size_high,
y_min = moreores.mithril_min_depth_high,
y_max = moreores.mithril_max_depth_high,
},
oredef = { oredef = {
clust_scarcity = moreores.mithril_chunk_size ^ 3, clust_scarcity = moreores.mithril_chunk_size ^ 3,
clust_num_ores = moreores.mithril_ore_per_chunk, clust_num_ores = moreores.mithril_ore_per_chunk,
clust_size = moreores.mithril_chunk_size, clust_size = moreores.mithril_clust_size,
y_min = moreores.mithril_min_depth, y_min = moreores.mithril_min_depth,
y_max = moreores.mithril_max_depth, y_max = moreores.mithril_max_depth,
}, },
oredef_deep = {
clust_scarcity = moreores.mithril_chunk_size_deep ^ 3,
clust_num_ores = moreores.mithril_ore_per_chunk_deep,
clust_size = moreores.mithril_clust_size_deep,
y_min = moreores.mithril_min_depth_deep,
y_max = moreores.mithril_max_depth_deep,
},
tools = { tools = {
pick = { pick = {
groupcaps = { groupcaps = {
@ -348,13 +386,27 @@ else
oredefs.tin = { oredefs.tin = {
description = "Tin", description = "Tin",
makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, makes = {ore = true, block = true, lump = true, ingot = true, chest = false},
oredef_high = {
clust_scarcity = moreores.tin_chunk_size_high ^ 3,
clust_num_ores = moreores.tin_ore_per_chunk_high,
clust_size = moreores.tin_clust_size_high,
y_min = moreores.tin_min_depth_high,
y_max = moreores.tin_max_depth_high,
},
oredef = { oredef = {
clust_scarcity = moreores.tin_chunk_size ^ 3, clust_scarcity = moreores.tin_chunk_size ^ 3,
clust_num_ores = moreores.tin_ore_per_chunk, clust_num_ores = moreores.tin_ore_per_chunk,
clust_size = moreores.tin_chunk_size, clust_size = moreores.tin_clust_size,
y_min = moreores.tin_min_depth, y_min = moreores.tin_min_depth,
y_max = moreores.tin_max_depth, y_max = moreores.tin_max_depth,
}, },
oredef_deep = {
clust_scarcity = moreores.tin_chunk_size_deep ^ 3,
clust_num_ores = moreores.tin_ore_per_chunk_deep,
clust_size = moreores.tin_clust_size_deep,
y_min = moreores.tin_min_depth_deep,
y_max = moreores.tin_max_depth_deep,
},
tools = {}, tools = {},
} }