Compare commits
100 Commits
pre-rewrit
...
last-usabl
Author | SHA1 | Date | |
---|---|---|---|
7c7b7715bc | |||
64e01a2aab | |||
08636f4b22 | |||
f82fd46656 | |||
668d2f2262 | |||
1de45a1dd4 | |||
b203d77ffe | |||
b183c489ee | |||
f0f1edc94e | |||
5864a396f5 | |||
b9ad0a251c | |||
7574b0f463 | |||
b193a9825b | |||
06feda37c3 | |||
a4fcb25897 | |||
a59eb82757 | |||
f42f17c509 | |||
9ed5bdfbd4 | |||
59737a0652 | |||
7a5d600e0c | |||
75c1cfa108 | |||
73b796a836 | |||
447f73b064 | |||
7fbc4e907b | |||
063c22b61a | |||
a38ae12ea4 | |||
2bb9685f10 | |||
a82e9ccac2 | |||
838305401f | |||
dc59acb6e6 | |||
7e3c0c6026 | |||
57a2e6800e | |||
558bfcc50d | |||
891a10d681 | |||
8ac2730e58 | |||
a0dc566981 | |||
798b56768d | |||
776695b720 | |||
23cef526da | |||
683b918c32 | |||
5760f24090 | |||
fb55165611 | |||
e5e2a75fd7 | |||
8159669a2a | |||
016f5aab0f | |||
b63c3e627c | |||
912fad6ff2 | |||
377bd99adc | |||
475a413d2f | |||
2c06f0486e | |||
45ad16ea4d | |||
6d6b711d25 | |||
af7e78500e | |||
0bd4d6bfa8 | |||
b51f854b1c | |||
f4973d1b69 | |||
8f4b02bd1e | |||
08ea4423a8 | |||
a1091cf94c | |||
8a1bf6d522 | |||
d1b9fb7183 | |||
c9f1e7256a | |||
9f82e118eb | |||
697a50d5f7 | |||
093310ed4b | |||
0fde0e8f15 | |||
7c6d02e2ed | |||
da6c1a9bf0 | |||
0b3e25ca6b | |||
a642d6311a | |||
d1bc2638f3 | |||
97b9170653 | |||
59c5eaf5b4 | |||
091f2e0b57 | |||
e7d4f3b0db | |||
c02b173bf0 | |||
aaa6ddeb3f | |||
e0f0dfdac7 | |||
c3167e8720 | |||
eef1902490 | |||
0dae800739 | |||
b8dfc5dedd | |||
7113f0f950 | |||
14b16d55ca | |||
32ae5e4fb5 | |||
0068977a3d | |||
450da72080 | |||
bb7d89bf7d | |||
65f286f233 | |||
c1cf871d2c | |||
4d7d8cd80d | |||
229e0e4e80 | |||
dbbd865125 | |||
f02a668c22 | |||
57b51fa10f | |||
292ad18921 | |||
21d2a4779d | |||
cd3c2b2586 | |||
6693f103a1 | |||
12f7c99e9f |
138
AmplifiedMGv7.txt
Normal file
@ -0,0 +1,138 @@
|
||||
# world_dir/map_meta.txt
|
||||
chunksize = 5
|
||||
mg_biome_np_heat = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 3
|
||||
offset = 50
|
||||
persistence = 0.5
|
||||
scale = 50
|
||||
seed = 5349
|
||||
spread = (500,500,500)
|
||||
}
|
||||
mg_biome_np_humidity = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 3
|
||||
offset = 50
|
||||
persistence = 0.5
|
||||
scale = 50
|
||||
seed = 842
|
||||
spread = (500,500,500)
|
||||
}
|
||||
mg_flags = trees, caves, nodungeons, noflat, light
|
||||
mg_name = v7
|
||||
mgv7_np_cave1 = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.5
|
||||
scale = 12
|
||||
seed = 52534
|
||||
spread = (100,100,100)
|
||||
}
|
||||
mgv7_np_cave2 = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.5
|
||||
scale = 12
|
||||
seed = 10325
|
||||
spread = (100,100,100)
|
||||
}
|
||||
mgv7_np_filler_depth = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.7
|
||||
scale = 1.2
|
||||
seed = 261
|
||||
spread = (150,150,150)
|
||||
}
|
||||
mgv7_np_height_select = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 5
|
||||
offset = -0.5
|
||||
persistence = 0.69
|
||||
scale = 1
|
||||
seed = 4213
|
||||
spread = (250,250,250)
|
||||
}
|
||||
mgv7_np_mount_height = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 6
|
||||
offset = 630
|
||||
persistence = 0.6
|
||||
scale = 250
|
||||
seed = 72449
|
||||
spread = (2000,2000,2000)
|
||||
}
|
||||
mgv7_np_mountain = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 5
|
||||
offset = -0.6
|
||||
persistence = 0.68
|
||||
scale = 1
|
||||
seed = 5333
|
||||
spread = (750,1400,750)
|
||||
}
|
||||
mgv7_np_ridge = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.75
|
||||
scale = 1
|
||||
seed = 6467
|
||||
spread = (100,100,100)
|
||||
}
|
||||
mgv7_np_ridge_uwater = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 4
|
||||
offset = 0
|
||||
persistence = 0.6
|
||||
scale = 1
|
||||
seed = 85039
|
||||
spread = (500,500,500)
|
||||
}
|
||||
mgv7_np_terrain_alt = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 5
|
||||
offset = 4
|
||||
persistence = 0.6
|
||||
scale = 50
|
||||
seed = 5934
|
||||
spread = (1200,1200,1200)
|
||||
}
|
||||
mgv7_np_terrain_base = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 6
|
||||
offset = 4
|
||||
persistence = 0.7
|
||||
scale = 70
|
||||
seed = 82341
|
||||
spread = (300,300,300)
|
||||
}
|
||||
mgv7_np_terrain_persist = {
|
||||
flags = defaults
|
||||
lacunarity = 2
|
||||
octaves = 3
|
||||
offset = 0.6
|
||||
persistence = 0.6
|
||||
scale = 0.1
|
||||
seed = 539
|
||||
spread = (500,500,500)
|
||||
}
|
||||
mgv7_spflags = mountains, ridges
|
||||
seed = 9237944289836255171
|
||||
water_level = 1
|
||||
[end_of_params]
|
161
a.txt
@ -4,107 +4,142 @@ Geological layer generator for [Minetest] "rocks"
|
||||
Aim of this mod is to replace all generic stone (default:stone) and
|
||||
generate underground layers of different rocks.
|
||||
|
||||
Currently everithing generated above ground, in air. This is for debugging.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* layers of different rocks: sort of working
|
||||
* ore veins: nothing
|
||||
* extensibility, api: ok
|
||||
* ore veins: being added
|
||||
* extensibility, api: changed million times
|
||||
|
||||
** Work in progress! **
|
||||
|
||||
* Git clone: [https](https://gitorious.org/mt/rocks.git)
|
||||
* git clone git://repo.or.cz/rocks.git ([show](http://repo.or.cz/rocks.git/))
|
||||
* (old) Git clone: [https](https://gitorious.org/mt/rocks.git)
|
||||
* Forum [post](https://forum.minetest.net/viewtopic.php?f=9&t=11779)
|
||||
|
||||
This mod nor minetest_game/default do not define meaningful biomes.
|
||||
So if you do not want unlimited grassland I suggest installing the
|
||||
[Paramat's biomesdev mod](https://github.com/paramat/biomesdev) and adding
|
||||
"rocks?" to depends.txt file inside the biomesdev folder. This is needed,
|
||||
becouse "rocks" overrides the standard biome registration callback to patch
|
||||
in it's own sedimentary rocks.
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
|
||||
* Layers: 
|
||||
* Coal pane: 
|
||||
* Vein: 
|
||||
all were out of date
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
* My Code: GNU General Public License v2 or higher.
|
||||
* Media: see txt files in the texture folder
|
||||
* stated in the corresponding file
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
How the underground is generated: *todo*.
|
||||
|
||||
Underground is divided into horizontal layers. Bottom of each layer is at
|
||||
fixed height and moved up or down by 2d perlin noise.
|
||||
Mod has been rewritten, so no doc yet.
|
||||
|
||||
In every layer there can be multiple veins. Veins are blob-shaped volumes
|
||||
of different rocks. Borders of vein are defined by 3d perlin noise. Veins
|
||||
often contain ores.
|
||||
The sedimentary layer
|
||||
-------------
|
||||
|
||||
In every vein, ores are distributed randomly. Some ores
|
||||
may occur in specific areas of the vein (where noise is higher than
|
||||
treshold) or distributed randomly in specific amount (chance based on
|
||||
pseudorandom number) or combination of both.
|
||||
Is implemented by modifiing MGv7 biomes to use rocks's sedimentary rocks.
|
||||
This means that you need mapgen v7 enabled. I also suggest enabling caves
|
||||
and dungeons, as they are cool.
|
||||
|
||||
There is 1 2d perlin noise per layer, 1 3d perlin noise per vein and 1
|
||||
pseudorandom number generator per ore.
|
||||
Soil is normlly 50-70 cm deep in real life, so I made soil (dirt) only 1
|
||||
block thick. Under this thin layer of dirt an sedimentary layer is located.
|
||||
In RL, there is clay and other stuff.
|
||||
|
||||
Modding Interface
|
||||
-----------------
|
||||
There are various types of sedimentary rock. They are generated according
|
||||
to 2D noises described below.
|
||||
|
||||
"Rocks" exposes api to add new ores, veins and layers. The api is defined
|
||||
in [register](register.lua).
|
||||
types = Clastic, Biochemical, Chemical, Vulcano/Other
|
||||
|
||||
### Register layer
|
||||
| X | tp2<0.76 | tp2>0.7 |
|
||||
|--------|--------------|--------|
|
||||
| tp1<0.2 | Clastic | Chemical |
|
||||
| tp1>0.2 | BioChemical | Vu/Ot |
|
||||
|
||||
rocks.register_layer=function(name,params,rock)
|
||||
- Noise_tp1( 50)= type1
|
||||
- Noise_tp2( 70)= type2
|
||||
- Noise_vc(100)= particle size
|
||||
- Noise_sp(220)= pressue/ hardness
|
||||
|
||||
I. 2D: fast, acceptable imho <-(used)
|
||||
II. 3D: nice
|
||||
|
||||
This function registers a layer. Layer is identified by unique string name.
|
||||
Location of layer is specified in params and node, the layer should be
|
||||
composed of is defined by rock.
|
||||
### Clastic sediments
|
||||
|
||||
Field "params.gain" sets how height of the layer should vary. Field
|
||||
"params.height" sets height of bottom of the layer. Field "params.limit" is
|
||||
value of noise above which the layer is not generated. Set to 2 to disable
|
||||
this feature. Last field "params.seed" is offset to world seed to seed the
|
||||
noise.
|
||||
Made from large or small particles. Either loose or bound into stones.
|
||||
|
||||
### Register vein
|
||||
(particle size: top-large botom-small)
|
||||
|
||||
rocks.register_vein=function(name,params)
|
||||
(hargness: loose -> solid)
|
||||
|
||||
This function registers a vein with name "name" to be generated according
|
||||
to params.
|
||||
1. gravel -> conglomerate
|
||||
2. sand -> sandstone
|
||||
3. mudstone
|
||||
4. clay -> claystone -> slate
|
||||
|
||||
Field "params.spread" {x,y,z} defines how the vein should look like. X
|
||||
shoudd be equal to z. If y=x=z then the vein is equal in all directions. To
|
||||
make the vein taller, set y to higher value. Larger values make larger and
|
||||
less frequent veins.
|
||||
### BioChemical sediments
|
||||
|
||||
Field "params.treshold" specifies rarity of the vein. It should be betveen
|
||||
-2 and +2, mapgen will use this or per-ore treshold if per-ore treshold is
|
||||
larger.
|
||||
Made from acient plants and creatures that died long ago and turned into rock.
|
||||
|
||||
- 2 never generate
|
||||
- 1 extremly rare
|
||||
- 0 50% chance
|
||||
- less than 0 = SPAM
|
||||
Noise_vs: kind of sediment: (top) oil, Limestone, other, carbon-based
|
||||
|
||||
Field "params.seed" is added to world seed to form seed for noise function.
|
||||
Noise_sp: low quality -> high quality
|
||||
|
||||
Depths, where the wein should generate can be controlled by fields hmin and
|
||||
hmax. They can be set to nil to generate everywhere.
|
||||
1. oil: ?
|
||||
2. Limestone
|
||||
3. other: fosfates, silicates, hornfels (unimp)
|
||||
4. carbon-based: Lignite -> Coal -> Anthracite
|
||||
|
||||
Layers, where the vein should generate in must be listed in Field
|
||||
"params.layer".
|
||||
### Chemical sediments
|
||||
|
||||
## Register ore
|
||||
Created by chemical or physics/chemical reactions.
|
||||
|
||||
rocks.register_ore=function( vein, node, params )
|
||||
- Evaporites (unimp)
|
||||
|
||||
This function registers ore or rock to be generated in vein "vein". Node to
|
||||
be generated is "node". Params specify parameters, where the rock should
|
||||
spawn.
|
||||
### Vulanic and extraterrestrial sediments
|
||||
|
||||
If noise is larger than Params.treshold, the ore is spawned (set to 2 to
|
||||
spawn everywhere in the vein, 0.8=only in middle). Params.chance specify
|
||||
the chance (/100%) of ore being spawned (0=never 1=always 0.5=50%).
|
||||
???
|
||||
|
||||
If multiple ores pass the treshhold and chance tests, ore with highest
|
||||
treshold and smallest chance is spawned.
|
||||
The Igenous layer
|
||||
--------------
|
||||
|
||||
Default stone is aliased to basalt, but for some reason the alias is not
|
||||
working so please treat stone as basalt until I find way to fix it.
|
||||
|
||||
Everything below sedimentary and (unimp) metamorphic layer is of igneous origin. Primary rock is basalt. But about half of basalt is replaced by granite. Some smaller fraction (like 20%) is then replaced by diorite and gabbro.
|
||||
These are the primary rocks, and more should come.
|
||||
|
||||
### Mineral distribution
|
||||
|
||||
Mineral ore is placed only in nodes of correct rock and only if the region
|
||||
for the ore is right. These "mineral biomes" can and do overlap and change
|
||||
every like 100 nodes. Following regions are defined:
|
||||
|
||||
| Region | minerals
|
||||
|---------|----------
|
||||
| Copper | Chalcopyrite, Malachyte
|
||||
| Pb/Zn | Sphalerite, Galena
|
||||
| Iron | Magnetite
|
||||
|
||||
### Skarn deposits
|
||||
|
||||
Are larg-ish (15-20m) blobs of skarn stone. They spawn only in granite and
|
||||
limestone. Copper, Lead, Zinc and Iron ores often enrich the skarn stone.
|
||||
Some deposits may (unimp) contain considerable amounts of Molybenium,
|
||||
Uranium and Wolfram ores.
|
||||
|
||||
Concentration of the minerals is quite high, as to regard the player for
|
||||
finding a not-so-common skarn vein.
|
||||
|
||||
### Pegmatite veis
|
||||
|
||||
Spawn only in granite. Are bit larger than skarn veins. Contain minerals
|
||||
like skarn and more exotic minerals.
|
||||
|
BIN
coal-pane0.png
Before Width: | Height: | Size: 154 KiB |
@ -1,126 +0,0 @@
|
||||
local CcHard=3
|
||||
local CcStrong=3
|
||||
local CcMed=3
|
||||
local CcSoft=3
|
||||
|
||||
--
|
||||
-- Main rocks (top to bottom)
|
||||
--
|
||||
|
||||
-- Granite In/Felsic hard Very common, below sed on land
|
||||
minetest.register_node( "rocks:granite", {
|
||||
description = S("Granite"),
|
||||
tiles = { "rocks_Granite.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=CcStrong, stone=1},
|
||||
})
|
||||
rocks.register_layer( "granite",{ gain=20, height=-22, limit=2, seed=1 }, "rocks:granite")
|
||||
|
||||
-- Diorite In/Inter vhard Below granite
|
||||
minetest.register_node( "rocks:diorite", {
|
||||
description = S("Diorite"),
|
||||
tiles = { "rocks_Diorite.png" },
|
||||
groups = {cracky=CcHard, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "diorite",{ gain=20, height=-55, limit=2, seed=2 }, "rocks:diorite")
|
||||
|
||||
-- Basalt Ex/Mafic hard same as diorite, byt limit=0.5
|
||||
minetest.register_node( "rocks:basalt", {
|
||||
description = S("Basalt"),
|
||||
tiles = { "rocks_Basalt.png" },
|
||||
groups = {cracky=CcStrong, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "basalt",{ gain=20, height=-60, limit=-0.7, seed=2 }, "rocks:basalt")
|
||||
|
||||
-- Gabbro In/Mafic vhard Below basalt/diorite (mtns, ocean)
|
||||
minetest.register_node( "rocks:gabbro", {
|
||||
description = S("Gabbro"),
|
||||
tiles = { "rocks_Gabbro.png" },
|
||||
groups = {cracky=CcHard, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "gabbro",{ gain=20, height=-70, limit=2, seed=3 }, "rocks:gabbro")
|
||||
|
||||
-- Peridotite In/UMafic vhard Rarely under gabbro
|
||||
minetest.register_node( "rocks:peridotite", {
|
||||
description = S("Peridotite"),
|
||||
tiles = { "rocks_Peridotite.png" },
|
||||
groups = {cracky=CcStrong, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "peridotite",{ gain=20, height=-120, limit=-0.8, seed=4 }, "rocks:peridotite")
|
||||
|
||||
-- Komatiite Ex/UMafic - Too deep
|
||||
minetest.register_node( "rocks:komatiite", {
|
||||
description = S("Komatiite"),
|
||||
tiles = { "default_stone.png" }, -- no texture, yet
|
||||
groups = {cracky=CcHard, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "komatiite",{ gain=20, height=-130, limit=2, seed=5 }, "rocks:komatiite")
|
||||
|
||||
--
|
||||
-- top sedimentary rocks
|
||||
--
|
||||
|
||||
-- Mudstone Sed soft Ocean, beach, river, glaciers
|
||||
minetest.register_node( "rocks:mudstone", {
|
||||
description = S("Mudstone"),
|
||||
tiles = { "rocks_Mudstone.png" },
|
||||
groups = {cracky=CcSoft, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "mudstone",{ gain=10, height=10, limit=2, seed=4 }, "rocks:mudstone")
|
||||
|
||||
-- Slate MM/barro med Under mud/clay/siltstone
|
||||
minetest.register_node( "rocks:slate", {
|
||||
description = S("slate"),
|
||||
tiles = { "rocks_Slate.png" },
|
||||
groups = {cracky=CcMed, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- rocks.register_layer( "slate",{ gain=10, height=-7, limit=2, seed=5 }, "rocks:slate")
|
||||
|
||||
-- Schist MM/barro med Under slate, sometimes igneous
|
||||
minetest.register_node( "rocks:schist", {
|
||||
description = S("schist"),
|
||||
tiles = { "rocks_Schist.png" },
|
||||
groups = {cracky=CcMed, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "schist",{ gain=10, height=-15, limit=2, seed=5 }, "rocks:schist")
|
||||
|
||||
-- Gneiss MM/barro hard Under schist, sometimes igneous
|
||||
minetest.register_node( "rocks:gneiss", {
|
||||
description = S("gneiss"),
|
||||
tiles = { "rocks_Gneiss.png" },
|
||||
groups = {cracky=CcStrong, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "gneiss",{ gain=10, height=-19, limit=2, seed=6 }, "rocks:gneiss")
|
||||
|
||||
--
|
||||
-- peak rocks
|
||||
--
|
||||
|
||||
-- Rhyolite Ex/Felsic hard Mountains, top
|
||||
minetest.register_node( "rocks:rhyolite", {
|
||||
description = S("Rhyolite"),
|
||||
tiles = { "rocks_Rhyolite.png" },
|
||||
groups = {cracky=CcHard, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "rhyolite",{ gain=8, height=80, limit=2, seed=4 }, "rocks:rhyolite")
|
||||
|
||||
-- Andesite Ex/Inter hard Mountains, below rhyolite
|
||||
minetest.register_node( "rocks:andesite", {
|
||||
description = S("Andesite"),
|
||||
tiles = { "rocks_Andesite.png" },
|
||||
groups = {cracky=CcHard, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
rocks.register_layer( "andesite",{ gain=8, height=22, limit=2, seed=4 }, "rocks:andesite")
|
||||
|
||||
print("[rocks/geologicaLayers] loaded.")
|
@ -1,75 +0,0 @@
|
||||
local CcHard=3
|
||||
local CcStrong=3
|
||||
local CcMed=3
|
||||
local CcSoft=3
|
||||
|
||||
--
|
||||
-- Sedimentary
|
||||
--
|
||||
|
||||
-- Claystone Sed soft in mudstone
|
||||
rocks.register_vein("clay",{
|
||||
spread = {x=30, y=10, z=30},
|
||||
treshold=0.26, -- clay should be plenty
|
||||
seed = 9,
|
||||
layers={ "mudstone" },
|
||||
})
|
||||
rocks.register_ore( "clay", "default:clay", {treshold=0, chance=85 } )
|
||||
|
||||
-- Breccia Mixture soft in mudstone
|
||||
-- Conglomerate Sed soft in mudstone
|
||||
|
||||
-- Coal Ocean, inland 2x swamp
|
||||
rocks.register_vein("coal",{
|
||||
spread = {x=20, y=10, z=20},
|
||||
treshold=0.48, -- coal shold be less
|
||||
seed = 10,
|
||||
layers={ "mudstone" },
|
||||
})
|
||||
rocks.register_ore( "coal", "default:stone_with_coal", {treshold=0, chance=85 } )
|
||||
|
||||
-- Pyrolusite Swamp
|
||||
-- Diatomite Volcanic, desert
|
||||
-- Glauconite Ocean 20% sandstone
|
||||
-- Apatite Any Metamorphic depth
|
||||
-- Zeolite Volcanic
|
||||
-- Fuller's Earth Desert
|
||||
-- Kaolinite Tropics
|
||||
|
||||
--
|
||||
-- Misc rocks
|
||||
--
|
||||
|
||||
-- Limestone Sed med in Rhyolite, Andesite in mountains
|
||||
minetest.register_node( "rocks:limestone", {
|
||||
description = S("Limestone"),
|
||||
tiles = { "rocks_Limestone.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=CcMed, stone=1},
|
||||
})
|
||||
rocks.register_vein("limestone",{
|
||||
spread = {x=60, y=60, z=60},
|
||||
treshold=0.4,
|
||||
seed = 10,
|
||||
layers={ "rhyolite", "andesite" },
|
||||
})
|
||||
rocks.register_ore( "limestone", "rocks:limestone", {treshold=0, chance=100} )
|
||||
|
||||
-- Dolomite Sed med in Rhyolite, Andesite in mountains
|
||||
minetest.register_node( "rocks:dolomite", {
|
||||
description = S("Dolomite"),
|
||||
tiles = { "rocks_Dolomite.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=CcMed, stone=1},
|
||||
})
|
||||
rocks.register_vein("dolomite",{
|
||||
spread = {x=60, y=60, z=60},
|
||||
treshold=0.4,
|
||||
seed = 11,
|
||||
layers={ "rhyolite", "andesite" },
|
||||
})
|
||||
rocks.register_ore( "dolomite", "rocks:dolomite", {treshold=0, chance=100} )
|
||||
|
||||
-- Quartzite MM/contact vhard sandstone
|
||||
|
||||
print("[rocks/geologicaStrata] loaded.")
|
@ -1,15 +0,0 @@
|
||||
local CcHard=3
|
||||
local CcStrong=3
|
||||
local CcMed=3
|
||||
local CcSoft=3
|
||||
|
||||
--
|
||||
-- Veins
|
||||
--
|
||||
|
||||
-- Skarn MM/contact med in rhyo/ande in mountains
|
||||
-- Hornfels MM/contact vhard in skarn
|
||||
-- Marble MM/contact hard in skarn
|
||||
-- Limestone Sed med in skarn
|
||||
|
||||
print("[rocks/geologicaVeins] loaded.")
|
42
init.lua
@ -1,42 +0,0 @@
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
dofile(modpath.."/register.lua")
|
||||
|
||||
rocks.noiseparams_layers = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=80, y=80, z=80},
|
||||
octaves = 2,
|
||||
persist = 0.7
|
||||
}
|
||||
|
||||
dofile(modpath.."/mapgen.lua")
|
||||
--dofile(modpath.."/testing.lua")
|
||||
|
||||
print("[rocks] core loaded.")
|
||||
|
||||
dofile(modpath.."/geologicaLayers.lua")
|
||||
dofile(modpath.."/geologicaStrata.lua")
|
||||
dofile(modpath.."/geologicaVeins.lua")
|
||||
|
||||
minetest.register_on_mapgen_init(function(mapgen_params)
|
||||
|
||||
for i,d in pairs(rocks.layers_name) do table.insert(rocks.layers,d) end
|
||||
table.sort(rocks.layers,function(a,b)
|
||||
return a.height<b.height
|
||||
end)
|
||||
|
||||
-- todo: disable caves and ores
|
||||
|
||||
print("[rocks] mapgen initalized ("..#rocks.layers.." layers)")
|
||||
|
||||
end)
|
BIN
layers0.png
Before Width: | Height: | Size: 674 KiB |
125
mapgen.lua
@ -1,125 +0,0 @@
|
||||
--
|
||||
-- layer generator
|
||||
--
|
||||
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
stone_ctx= minetest.get_content_id("default:stone")
|
||||
air_ctx= minetest.get_content_id("air")
|
||||
local timebefore=os.clock();
|
||||
local manipulator, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local nodes = manipulator:get_data()
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local side_length = (maxp.x - minp.x) + 1
|
||||
local map_lengths_xyz = {x=side_length, y=side_length, z=side_length}
|
||||
|
||||
-- sort out unused layers
|
||||
-- generate noises
|
||||
avl={}
|
||||
for i,d in ipairs(rocks.layers) do
|
||||
-- h je normaalna vyyska horného konca vrstvy
|
||||
if (d.height+d.gain)>=minp.y then -- ak je to mimo zdola tak ju vyhodime
|
||||
-- urobime sum pre vrstvu
|
||||
local np=rocks.noiseparams_layers
|
||||
np.seed=d.seed
|
||||
np.scale=d.gain
|
||||
np.offset=d.height
|
||||
d.nmap=minetest.get_perlin_map(np,map_lengths_xyz):get2dMap_flat({x=minp.x, y=minp.z})
|
||||
-- contene_id kamenov
|
||||
d.rock.ctx=d.rock.ctx or minetest.get_content_id(d.rock.node)
|
||||
-- veiny
|
||||
local veinstodo={}
|
||||
for veinname,vd in pairs(d.veins) do
|
||||
-- todo: do not generate noise for blocks outside the layer
|
||||
veinstodo[veinname]=vd
|
||||
end
|
||||
for veinname,vd in pairs(veinstodo) do
|
||||
-- noise pre vein
|
||||
np=vd.np
|
||||
vd.nmap=minetest.get_perlin_map(np,map_lengths_xyz):get3dMap_flat(minp)
|
||||
vd.prng=PseudoRandom(np.seed)
|
||||
vd.sum=0
|
||||
for i,ore in pairs(vd.ores) do
|
||||
-- contntid pre rudu
|
||||
ore.ctx=ore.ctx or minetest.get_content_id(ore.node)
|
||||
-- sum sanci pre vein
|
||||
vd.sum=vd.sum+ore.chance
|
||||
end
|
||||
end
|
||||
table.insert(avl,d) -- pridame vrstvu
|
||||
if (d.height-d.gain)>maxp.y then break end -- ak je mimo zhora tak uz dalsie nehladaj
|
||||
else
|
||||
--print(" no higher "..d.height.." than "..minp.y)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
print("[rocks] gen2 "..os.clock()-timebefore.." #layers="..#avl.." minp.y="..minp.y.." maxp.y="..maxp.y)
|
||||
for lh,ld in ipairs(avl) do
|
||||
print(" "..lh.."->"..ld.name.." top="..ld.height)
|
||||
for vn,vd in pairs(ld.veins) do
|
||||
print(" "..vn.."->"..#vd.ores)
|
||||
end
|
||||
end
|
||||
|
||||
local noise2d_ix = 1
|
||||
local noise3d_ix = 1
|
||||
|
||||
for z=minp.z,maxp.z,1 do
|
||||
for y=minp.y,maxp.y,1 do
|
||||
for x=minp.x,maxp.x,1 do
|
||||
local p_pos = area:index(x, y, z)
|
||||
local layer,vein
|
||||
local rock
|
||||
|
||||
--* select layer
|
||||
for lh,ld in ipairs(avl) do
|
||||
if (y<ld.nmap[noise2d_ix])and(ld.nmap[noise2d_ix]<ld.limit) then
|
||||
layer=ld
|
||||
rock=layer.rock
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if layer then
|
||||
--* select vein
|
||||
for veinname,vd in pairs(layer.veins) do
|
||||
if vd.nmap[noise3d_ix]>vd.treshold then
|
||||
vein=vd
|
||||
--rock not changed
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if vein then
|
||||
--* select ore
|
||||
local chance=vein.prng:next(0,vein.sum)
|
||||
for i,ore in pairs(vein.ores) do
|
||||
chance=chance-ore.chance
|
||||
if chance<=0 then
|
||||
rock=ore
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--* place rocks
|
||||
if (rock) and(nodes[p_pos]==stone_ctx) then
|
||||
nodes[p_pos] = rock.ctx
|
||||
end
|
||||
|
||||
noise3d_ix =noise3d_ix+1
|
||||
noise2d_ix = noise2d_ix+1
|
||||
end
|
||||
noise2d_ix = noise2d_ix-side_length
|
||||
end
|
||||
end
|
||||
manipulator:set_data(nodes)
|
||||
--manipulator:calc_lighting()
|
||||
--manipulator:set_lighting({day=15,night=15})
|
||||
--manipulator:update_liquids()
|
||||
manipulator:write_to_map()
|
||||
print("[rocks] gen0 "..os.clock()-timebefore)
|
||||
end)
|
||||
|
2
mineral/depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
rocks
|
||||
default
|
38
mineral/init.lua
Normal file
@ -0,0 +1,38 @@
|
||||
--
|
||||
-- The minerals mod.
|
||||
--
|
||||
|
||||
minetest.log("info","/mineral mod initializing")
|
||||
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
local function GetNoiseParams()
|
||||
return {
|
||||
scale=1, offset=0, seed=rocksl.GetNextSeed(), octaves=1, persist=1,
|
||||
spread={ x=100, y=100, z=100 } }
|
||||
end
|
||||
|
||||
mineral={}
|
||||
mineral.noise={}
|
||||
|
||||
local print=function(text)
|
||||
minetest.log("info","/mineral "..text)
|
||||
end
|
||||
|
||||
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
mineral.noise.Copper=GetNoiseParams()
|
||||
mineral.noise.PbZn=GetNoiseParams()
|
||||
mineral.noise.Iron=GetNoiseParams()
|
||||
mineral.noise.Tin=GetNoiseParams()
|
||||
|
||||
dofile(modpath.."/skarn.lua")
|
||||
dofile(modpath.."/pegmatite.lua")
|
||||
|
42
mineral/pegmatite.lua
Normal file
@ -0,0 +1,42 @@
|
||||
--
|
||||
-- Pegmatite deposit
|
||||
--
|
||||
|
||||
local function GetNoiseParams()
|
||||
return {
|
||||
scale=1, offset=0, seed=rocksl.GetNextSeed(), octaves=1, persist=1,
|
||||
spread={ x=100, y=100, z=100 } }
|
||||
end
|
||||
|
||||
-- ores have to be redefined for pegmatite background
|
||||
|
||||
-- Ore/Mineral Percent
|
||||
-- Spodumene 7%
|
||||
-- Muscovite (mica) 7%
|
||||
-- Kyanite 5%
|
||||
-- Lepidolite 2.5%
|
||||
-- Tantalite 2%
|
||||
-- Cassiterite 1.5%
|
||||
-- Wolframite 1%
|
||||
-- Pollucite 0.1%
|
||||
|
||||
|
||||
-- Cassiterite
|
||||
minetest.register_node( "mineral:pegmatite_cassiterite", {
|
||||
description = S("Cassiterite"),
|
||||
tiles = { "rocks_Pegmatite.png^mineral_cassiterite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
wherein="rocks:pegmatite",
|
||||
ore="mineral:pegmatite_cassiterite",
|
||||
clust_size=3,
|
||||
clust_num_ores=9,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=-0.1,
|
||||
noise_params=mineral.noise.Tin
|
||||
})
|
||||
|
||||
-- ~ Tomas Brod
|
123
mineral/skarn.lua
Normal file
@ -0,0 +1,123 @@
|
||||
--
|
||||
-- Skarn deposit
|
||||
--
|
||||
|
||||
-- ores have to be redefined for skarn background
|
||||
|
||||
-- Chalcopyrite
|
||||
minetest.register_node( "mineral:skarn_chalcopyrite", {
|
||||
description = S("Chalcopyrite"),
|
||||
tiles = { "rocks_Skarn.png^mineral_Chalcopyrite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Malachyte
|
||||
minetest.register_node( "mineral:skarn_malachyte", {
|
||||
description = S("Malachyte"),
|
||||
tiles = { "rocks_Skarn.png^mineral_Chalcopyrite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Chalcopyrite/Malachyte skarn mix
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_chalcopyrite",
|
||||
clust_size=3,
|
||||
clust_num_ores=12,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.333,
|
||||
noise_params=mineral.noise.Copper
|
||||
})
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_malachyte",
|
||||
clust_size=3,
|
||||
clust_num_ores=11,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.333,
|
||||
noise_params=mineral.noise.Copper
|
||||
})
|
||||
|
||||
-- Sphalerite
|
||||
minetest.register_node( "mineral:skarn_sphalerite", {
|
||||
description = S("Sphalerite"),
|
||||
tiles = { "rocks_Skarn.png^mineral_sphalerite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Galena
|
||||
minetest.register_node( "mineral:skarn_galena", {
|
||||
description = S("Galena"),
|
||||
tiles = { "rocks_Skarn.png^mineral_galena.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Pb Zn skarn mix
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_sphalerite",
|
||||
clust_size=3,
|
||||
clust_num_ores=9,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.38,
|
||||
noise_params=mineral.noise.PbZn
|
||||
})
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_galena",
|
||||
clust_size=3,
|
||||
clust_num_ores=10,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.38,
|
||||
noise_params=mineral.noise.PbZn
|
||||
})
|
||||
-- marble and hornfels, as well as unchanged limestone.
|
||||
-- { ore="rocks:marble", percent=10 },
|
||||
-- { ore="rocks:hornfels", percent=10 },
|
||||
-- { ore="rocks:skarn_galena", percent=25 },
|
||||
-- { ore="rocks:skarn_sphalerite", percent=25 },
|
||||
|
||||
-- Magnetite
|
||||
minetest.register_node( "mineral:skarn_magnetite", {
|
||||
description = S("Magnetite"),
|
||||
tiles = { "rocks_Skarn.png^mineral_Magnetite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Fe skarn mix
|
||||
minetest.register_ore({
|
||||
wherein="rocks:skarn",
|
||||
ore="mineral:skarn_magnetite",
|
||||
clust_size=3,
|
||||
clust_num_ores=13,
|
||||
clust_scarcity=4^3,
|
||||
noise_treshold=0.3,
|
||||
noise_params=mineral.noise.Iron
|
||||
})
|
||||
-- marble and hornfels, as well as unchanged limestone.
|
||||
-- { ore="rocks:marble", percent=10 },
|
||||
-- { ore="rocks:hornfels", percent=10 },
|
||||
-- { ore="rocks:skarn_magnetite", percent=40 },
|
||||
|
||||
-- Magnesite
|
||||
minetest.register_node( "mineral:skarn_magnesite", {
|
||||
description = S("Magnesite"),
|
||||
tiles = { "rocks_Skarn.png^mineral_Magnesite.png" },
|
||||
groups = {cracky=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- Vermiculite (fixme: move to CommonRocks)
|
||||
minetest.register_node( "mineral:vermiculite", {
|
||||
description = S("Vermiculite"),
|
||||
tiles = { "mineral_Vermiculite.png" },
|
||||
groups = {crumbly=3},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
-- magnesite/vermiculite skarn mix
|
||||
-- marble and hornfels, as well as unchanged limestone.
|
||||
-- { ore="rocks:marble", percent=10 },
|
||||
-- { ore="rocks:hornfels", percent=10 },
|
||||
-- { ore="rocks:skarn_magnesite", percent=30 },
|
||||
-- { ore="rocks:vermiculite", percent=20 },
|
||||
|
||||
-- ~ Tomas Brod
|
BIN
mineral/textures/mineral_Chalcopyrite.png
Normal file
After Width: | Height: | Size: 870 B |
BIN
mineral/textures/mineral_Magnesite.png
Normal file
After Width: | Height: | Size: 774 B |
BIN
mineral/textures/mineral_Magnetite.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
mineral/textures/mineral_Vermiculite.png
Normal file
After Width: | Height: | Size: 929 B |
BIN
mineral/textures/mineral_cassiterite.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
mineral/textures/mineral_galena.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
mineral/textures/mineral_sphalerite.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
1
modpack.txt
Normal file
@ -0,0 +1 @@
|
||||
# This is now a modpack, for you to ask why :)
|
61
register.lua
@ -1,61 +0,0 @@
|
||||
-- global table and register_* functions
|
||||
|
||||
rocks = {}
|
||||
|
||||
rocks.layers = {}
|
||||
rocks.layers_name = {}
|
||||
rocks.veins = {}
|
||||
rocks.ores = {}
|
||||
|
||||
rocks.register_layer=function(name,params,rock)
|
||||
assert(name)
|
||||
assert(params)
|
||||
assert(rock)
|
||||
assert(params.gain)
|
||||
assert(params.height)
|
||||
local maxheight
|
||||
|
||||
local ld= {
|
||||
gain=params.gain,
|
||||
height=params.height,
|
||||
maxheight=maxheight,
|
||||
limit=(params.limit*params.gain)+params.height,
|
||||
seed=params.seed or 0,
|
||||
rock={ node=rock },
|
||||
veins={},
|
||||
name=name
|
||||
}
|
||||
rocks.layers_name[name]= ld
|
||||
print("[rocks] layer "..ld.name.." height="..ld.height.." limit="..ld.limit)
|
||||
end
|
||||
|
||||
rocks.register_vein=function(name,params)
|
||||
assert(name)
|
||||
assert(params)
|
||||
assert(not rocks.veins[name])
|
||||
rocks.veins[name]={
|
||||
np={
|
||||
offset=0, scale=1, octaves=1, presist=0.8,
|
||||
spread={x=params.spread.x, y=params.spread.y, z=params.spread.z},
|
||||
-- swapped, becouse we generate by horizontal layers
|
||||
seed=params.seed
|
||||
},
|
||||
treshold=params.treshold,
|
||||
hmin=params.hmin, hmax=params.hmax,
|
||||
layers=params.layers,
|
||||
ores={}
|
||||
}
|
||||
for i,layername in pairs(params.layers) do
|
||||
rocks.layers_name[layername].veins[name]=rocks.veins[name]
|
||||
print("[rocks] vein "..name.." in "..layername)
|
||||
end
|
||||
end
|
||||
|
||||
rocks.register_ore=function( vein, node, params )
|
||||
-- params= {treshold=0, chance=1 }
|
||||
ore={ node=node }
|
||||
ore.treshold=(params.treshold or rocks.veins[vein].treshold)
|
||||
ore.chance= (params.chance or 1)
|
||||
table.insert(rocks.veins[vein].ores, ore)
|
||||
print("[rocks] ore "..node.." in "..vein.." chance="..ore.chance.." treshold="..ore.treshold)
|
||||
end
|
205
rocks/gensed.lua
Normal file
@ -0,0 +1,205 @@
|
||||
-- experimental sedimentary layer generator
|
||||
|
||||
local np_elv = {
|
||||
offset = 0, octaves = 2, persist = 0.4,
|
||||
scale = 8,
|
||||
spread = {x=25, y=25, z=25},
|
||||
seed = -546,
|
||||
}
|
||||
local np_typ1 = {
|
||||
offset = 0, octaves = 2, persist = 0.33,
|
||||
scale = 1,
|
||||
spread = {x=50, y=50, z=50},
|
||||
seed = -5500,
|
||||
}
|
||||
local np_typ2 = {
|
||||
offset = 0, octaves = 2, persist = 0.33,
|
||||
scale = 1,
|
||||
spread = {x=70, y=70, z=70},
|
||||
seed = -5472,
|
||||
}
|
||||
local np_vc = {
|
||||
offset = 0, octaves = 2, persist = 0.33,
|
||||
scale = 1,
|
||||
spread = {x=100, y=100, z=100},
|
||||
seed = 749,
|
||||
}
|
||||
local np_sp = {
|
||||
offset = 0, octaves = 2, persist = 0.33,
|
||||
scale = 1,
|
||||
spread = {x=150, y=150, z=150},
|
||||
seed = -1284,
|
||||
}
|
||||
|
||||
local stats
|
||||
stats={ total=0 }
|
||||
|
||||
rocksl.gensed = function (minp, maxp, seed, vm, area)
|
||||
local t1 = os.clock()
|
||||
local data = vm:get_data()
|
||||
|
||||
local chunksize = maxp.x - minp.x + 1
|
||||
local pmapsize = {x = chunksize, y = chunksize, z = chunksize}
|
||||
local minpxz = {x = minp.x, y = minp.z}
|
||||
local c_stone= minetest.get_content_id("default:stone")
|
||||
local c_dwg= c_stone
|
||||
|
||||
local sla = {
|
||||
{min=18, sd=169},
|
||||
{min=9, sd=324},
|
||||
{min=0, sd=-230},
|
||||
{min=-6, sd=850},
|
||||
{min=-12, sd=-643},
|
||||
{min=-18, sd=0},
|
||||
}
|
||||
if minp.y<(sla[#sla].min-10) then return end
|
||||
local biomes = {
|
||||
lava={ mod="default" },
|
||||
nyancat={ mod="default" },
|
||||
wood={ mod="default" },
|
||||
gravel={ mod="default" },
|
||||
sand={ mod="default" },
|
||||
sandstone={ mod="default" },
|
||||
clay={ mod="default" },
|
||||
claystone={ mod="rocks" },
|
||||
slate={ mod="rocks" },
|
||||
conglomerate={ mod="rocks" },
|
||||
mudstone={ mod="rocks" },
|
||||
limestone={ mod="rocks" },
|
||||
blackcoal={ mod="rocks" },
|
||||
lignite={ mod="rocks" },
|
||||
anthracite={ mod="rocks" },
|
||||
}
|
||||
for k,v in pairs(biomes) do
|
||||
v.ctx=v.ctx or minetest.get_content_id(v.mod..":"..k)
|
||||
if stats and (stats[k]==nil) then stats[k]=0 end
|
||||
end
|
||||
n_elv= minetest.get_perlin_map(np_elv, pmapsize) : get2dMap_flat(minp)
|
||||
|
||||
local generated
|
||||
local nixz= 0
|
||||
local nixyz= 0
|
||||
for z=minp.z, maxp.z do for x=minp.x, maxp.x do
|
||||
nixz= nixz+1
|
||||
-- loop
|
||||
local bi
|
||||
local li
|
||||
for y=maxp.y, minp.y, -1 do
|
||||
nixyz=nixyz+1
|
||||
local di=area:index(x,y,z)
|
||||
local yn=y +n_elv[nixz]
|
||||
if (data[di]==c_stone) and ((not bi)or(yn<sla[li].min)) then
|
||||
-- go to deeper layer
|
||||
if not li then li=1 end
|
||||
while (li<=#sla)and(sla[li].min>yn) do
|
||||
li=li+1
|
||||
end
|
||||
-- create noises for this layer
|
||||
if li>#sla then break end -- break y loop if too low
|
||||
if (not sla[li].n_tp1) then
|
||||
local altminpxz={ x=minp.x+sla[li].sd,
|
||||
y=minp.z-sla[li].sd}
|
||||
sla[li].n_tp1= minetest.get_perlin_map(np_typ1, pmapsize) : get2dMap_flat(altminpxz)
|
||||
sla[li].n_tp2= minetest.get_perlin_map(np_typ2, pmapsize) : get2dMap_flat(altminpxz)
|
||||
sla[li].n_vc= minetest.get_perlin_map(np_vc, pmapsize) : get2dMap_flat(altminpxz)
|
||||
sla[li].n_sp= minetest.get_perlin_map(np_sp, pmapsize) : get2dMap_flat(altminpxz)
|
||||
end
|
||||
-- BEGIN geome resolution
|
||||
local vcva= math.abs(sla[li].n_vc[nixz])
|
||||
local vcv= sla[li].n_vc[nixz]
|
||||
local spv= sla[li].n_sp[nixz]
|
||||
local tp=1 --=particulates, 2=biosediments, 3=chemosediments, 4=vulcanosediments
|
||||
if sla[li].n_tp1[nixz]>0.2 then tp=2
|
||||
if sla[li].n_tp2[nixz]>0.81 then tp=4 end
|
||||
elseif sla[li].n_tp2[nixz]>0.76 then tp=3 end
|
||||
|
||||
if tp==1 then
|
||||
-- particulates
|
||||
if vcva>0.453 then
|
||||
-- clay-(0,stone,slate)
|
||||
if spv>0.23 then bi="slate"
|
||||
elseif spv>-0.2 then bi="claystone"
|
||||
else bi="clay" end
|
||||
elseif vcva>0.4 then
|
||||
bi="mudstone"
|
||||
elseif vcva>0.2 then
|
||||
-- sand-(0,stone)
|
||||
if spv>-0.3 then bi="sandstone" else bi="sand" end
|
||||
else
|
||||
-- gravel/conglomerate
|
||||
if spv>-0.34 then bi="conglomerate" else bi="gravel" end
|
||||
-- breccia?
|
||||
end
|
||||
elseif tp==2 then
|
||||
-- biosediments
|
||||
if vcv>0.05 then
|
||||
bi="limestone"
|
||||
elseif vcv>-0.1 then
|
||||
--uhlia
|
||||
if spv>0.7 then bi="anthracite"
|
||||
elseif spv>0 then bi="blackcoal"
|
||||
else bi="lignite" end
|
||||
else
|
||||
--ine
|
||||
bi="wood"
|
||||
end
|
||||
end
|
||||
|
||||
-- END geome resolution
|
||||
|
||||
if not bi then bi="nyancat" end
|
||||
generated=true
|
||||
end
|
||||
if (data[di]==c_stone) then
|
||||
data[di]=biomes[bi].ctx
|
||||
if stats then stats.total=stats.total+1 stats[bi]=stats[bi]+1 end
|
||||
end
|
||||
end
|
||||
end end
|
||||
if generated then
|
||||
vm:set_data(data)
|
||||
if stats then for k,v in pairs(stats) do print("stat: "..k..": "..((v/stats.total)*100).."%") end end
|
||||
else
|
||||
print("no sed layer y="..minp.y)
|
||||
end
|
||||
minetest.log("action", "rocks/gensed/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
|
||||
end
|
||||
|
||||
minetest.register_node( "rocks:slate", {
|
||||
description = S("Slate"),
|
||||
tiles = { "rocks_Slate.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
|
||||
groups = {cracky=3},
|
||||
})
|
||||
minetest.register_node( "rocks:claystone", {
|
||||
description = S("Claystone"),
|
||||
tiles = { "rocks_claystone.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
|
||||
groups = {crumbly=1, cracky=3},
|
||||
})
|
||||
|
||||
minetest.register_node( "rocks:conglomerate", {
|
||||
description = S("Conglomerate"),
|
||||
tiles = { "rocks_conglomerate.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
|
||||
groups = {crumbly=3},
|
||||
})
|
||||
|
||||
minetest.register_node( "rocks:lignite", {
|
||||
description = S("Lignite coal"),
|
||||
tiles = { "rocks_Mudstone.png^rocks_lignite.png" },
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
})
|
||||
minetest.register_node( "rocks:blackcoal", {
|
||||
description = S("Black coal"),
|
||||
tiles = { "rocks_Mudstone.png^default_mineral_coal.png" },
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
})
|
||||
minetest.register_node( "rocks:anthracite", {
|
||||
description = S("Anthracite coal"),
|
||||
tiles = { "rocks_Mudstone.png^rocks_anthracite.png" },
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
})
|
143
rocks/ign.lua
Normal file
@ -0,0 +1,143 @@
|
||||
--
|
||||
-- Igneous Layer
|
||||
--
|
||||
|
||||
-- Basalt Ex/Mafic hard same as diorite, byt limit=0.5
|
||||
minetest.register_node( "rocks:basalt", {
|
||||
description = S("Basalt"),
|
||||
tiles = { "rocks_Basalt.png" },
|
||||
groups = {cracky=3, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.register_alias("mapgen_stone", "rocks:basalt")
|
||||
|
||||
-- ^ does not work. Seems we can not overwrite an alias.
|
||||
-- If the alias in default/mapgen.lua is deleted, this works.
|
||||
|
||||
-- more rock defs
|
||||
minetest.register_node( "rocks:granite", {
|
||||
description = S("Granite"),
|
||||
tiles = { "rocks_wgr.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=3, stone=1},
|
||||
})
|
||||
minetest.register_node( "rocks:diorite", {
|
||||
description = S("Diorite"),
|
||||
tiles = { "rocks_Diorite.png" },
|
||||
groups = {cracky=3, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.register_node( "rocks:gabbro", {
|
||||
description = S("Gabbro"),
|
||||
tiles = { "rocks_Gabbro.png" },
|
||||
groups = {cracky=3, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
local reg=function(name,param)
|
||||
minetest.register_ore({
|
||||
ore = name,
|
||||
wherein= param.inr,
|
||||
ore_type = "scatter",
|
||||
clust_scarcity = 10^3,
|
||||
clust_num_ores = 20^3,
|
||||
clust_size = 20,
|
||||
height_min = -31000,
|
||||
height_max = 28,
|
||||
noise_threshhold=param.treshold,
|
||||
noise_params={
|
||||
offset = 0, scale = 1, octaves = 1, persist = 0.5,
|
||||
spread = {x=param.spread, y=param.height, z=param.spread},
|
||||
seed=rocksl.GetNextSeed(),
|
||||
},
|
||||
})
|
||||
end
|
||||
rocks.register_igneous_stratus=reg
|
||||
|
||||
-- vein stuff
|
||||
|
||||
local regv=function(name,param)
|
||||
minetest.register_ore({
|
||||
ore = name,
|
||||
wherein= param.wherein,
|
||||
ore_type = "blob",
|
||||
clust_scarcity = param.rarity^3,
|
||||
clust_num_ores = 8,
|
||||
clust_size = param.radius.average*2,
|
||||
height_min = -31000,
|
||||
height_max = 50,
|
||||
noise_threshhold = 0.5, --< determined experimentally
|
||||
noise_params={
|
||||
offset = 1-param.radius.amplitude, scale = param.radius.amplitude, octaves = 3, persist = 0.5,
|
||||
spread = {x=param.radius.frequency, y=param.radius.frequency, z=param.radius.frequency},
|
||||
seed=rocksl.GetNextSeed(),
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
rocks.register_vein=regv
|
||||
|
||||
local np_layer = {
|
||||
offset = 0, octaves = 3, persist = 0.46,
|
||||
scale = 30,
|
||||
spread = {x=500, y=500, z=500},
|
||||
seed = -5500,
|
||||
}
|
||||
local np_intr = {
|
||||
octaves = 3, persist = 0.46,
|
||||
scale = 20,
|
||||
offset = -15,
|
||||
spread = {x=100, y=100, z=100},
|
||||
seed = 3740,
|
||||
}
|
||||
|
||||
--minetest.register_on_generated( function( minp, maxp, seed )
|
||||
rocksl.genign=function(minp,maxp,seed, vm, area)
|
||||
local t1 = os.clock()
|
||||
local data = vm:get_data()
|
||||
|
||||
local chunksize = maxp.x - minp.x + 1
|
||||
local pmapsize = {x = chunksize, y = chunksize, z = 1}
|
||||
local pmapminpxz = {x = minp.x, y = minp.z}
|
||||
local c_stone= minetest.get_content_id("default:stone")
|
||||
local layers= {
|
||||
{ min=-100, node="rocks:granite" },
|
||||
{ min=-240, node="rocks:diorite"},
|
||||
{ node="rocks:gabbro", min=-700},
|
||||
}
|
||||
for k,v in pairs(layers) do
|
||||
v.ctx=minetest.get_content_id(v.node)
|
||||
end
|
||||
local layers_no=#layers
|
||||
local n_layer= minetest.get_perlin_map(np_layer, pmapsize) : get2dMap_flat(pmapminpxz)
|
||||
local n_intr= minetest.get_perlin_map(np_intr, pmapsize) : get2dMap_flat(pmapminpxz)
|
||||
local nixz= 1
|
||||
|
||||
for z=minp.z, maxp.z do for x=minp.x, maxp.x do
|
||||
-- loop
|
||||
for y=minp.y, maxp.y do
|
||||
local di=area:index(x,y,z)
|
||||
local yn=y+n_layer[nixz]
|
||||
local vintr=n_intr[nixz]
|
||||
if vintr<1 then vintr=1 end
|
||||
if data[di]==c_stone then
|
||||
yn=yn*vintr -- vertical intrusion
|
||||
for li=1, layers_no do
|
||||
if yn > layers[li].min then
|
||||
data[di]=layers[li].ctx
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
nixz= nixz+1
|
||||
end end
|
||||
|
||||
vm:set_data(data)
|
||||
--DEBUG: vm:set_lighting({day=15,night=2})
|
||||
minetest.generate_ores(vm)
|
||||
minetest.log("action", "rocks/layer/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
|
||||
end
|
||||
|
||||
|
||||
-- ~ Tomas Brod
|
49
rocks/init.lua
Normal file
@ -0,0 +1,49 @@
|
||||
minetest.log("info","[rocks] mod initializing")
|
||||
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
rocks={}
|
||||
rocksl={}
|
||||
|
||||
rocksl.print=function(text)
|
||||
minetest.log("info","/rocks "..text)
|
||||
end
|
||||
|
||||
rocksl.seedprng=PseudoRandom(763)
|
||||
rocksl.GetNextSeed=function()
|
||||
return rocksl.seedprng:next()
|
||||
end
|
||||
|
||||
minetest.clear_registered_ores()
|
||||
|
||||
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
dofile(modpath.."/sed.lua")
|
||||
dofile(modpath.."/ign.lua")
|
||||
dofile(modpath.."/skarn.lua")
|
||||
dofile(modpath.."/pegmatite.lua")
|
||||
dofile(modpath.."/gensed.lua")
|
||||
dofile(modpath.."/pipes.lua")
|
||||
dofile(modpath.."/veins.lua")
|
||||
|
||||
minetest.register_on_generated(function(minp,maxp,seed)
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local pr=PseudoRandom(seed)
|
||||
rocksl.gensed(minp,maxp,seed,vm,area)
|
||||
--rocksl.genign
|
||||
rocksl.genvein(minp,maxp,pr,vm,area)
|
||||
for _,pipe in pairs(rocks.pipes) do rocksl.genpipe(minp,maxp,pr,vm,area,pipe) end
|
||||
vm:write_to_map(data)
|
||||
end)
|
||||
|
||||
minetest.register_on_mapgen_init(function(mapgen_params)
|
||||
-- todo: disable caves and ores
|
||||
end)
|
24
rocks/pegmatite.lua
Normal file
@ -0,0 +1,24 @@
|
||||
--
|
||||
-- Pegmatite vein
|
||||
--
|
||||
|
||||
local CommonRarity=45
|
||||
|
||||
minetest.register_node( "rocks:pegmatite", {
|
||||
description = S("Pegmatite"),
|
||||
tiles = { "rocks_Pegmatite.png" },
|
||||
groups = {cracky=3, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
-- ores have to be redefined for pegmatite background
|
||||
|
||||
-- pegmatites are only 1 kind
|
||||
rocks.register_vein("rocks:pegmatite",{
|
||||
wherein={ "rocks:granite" },
|
||||
miny=-160, maxy=20,
|
||||
radius={ average=18, amplitude=0.3, frequency=16 },
|
||||
density=80, rarity=CommonRarity,
|
||||
ores={
|
||||
}
|
||||
})
|
96
rocks/pipes.lua
Normal file
@ -0,0 +1,96 @@
|
||||
-- experimental slow pipe generator
|
||||
|
||||
local function brush(data,area,pos,radius,content,ores,pr)
|
||||
local rsq=radius^2
|
||||
local orect
|
||||
local oresc
|
||||
radius=radius+2
|
||||
for _,ore in pairs(ores) do
|
||||
if pr:next(0,ore.scarcity)==0 then
|
||||
orect=ore.c_ore
|
||||
oresc=ore.density
|
||||
end
|
||||
end
|
||||
for x=-radius, radius do
|
||||
for y=-radius, radius do
|
||||
for z=-radius, radius do
|
||||
if (x^2)+(y^2)+(z^2)<=rsq then
|
||||
local di=area:index(x+pos.x,y+pos.y,z+pos.z)
|
||||
if oresc and (pr:next(0,oresc)==0) then
|
||||
data[di]=orect
|
||||
else
|
||||
data[di]=content
|
||||
end
|
||||
end
|
||||
end end end
|
||||
end
|
||||
|
||||
-- the public table of registered pipes
|
||||
rocks.pipes={}
|
||||
local examplepipe={
|
||||
bedrock={ "rocks:limestone" },
|
||||
startrock={ "rocks:limestone" },
|
||||
ymin=-200, ymax=-6,
|
||||
scarcity=80,
|
||||
radius=3,
|
||||
content="default:wood",
|
||||
scatter=
|
||||
{
|
||||
{ scarcity=7, density=4, ore="default:mese", cnt=0},
|
||||
},
|
||||
}
|
||||
table.insert(rocks.pipes,examplepipe)
|
||||
--profiling
|
||||
table.insert(rocks.pipes,{
|
||||
bedrock={ "rocks:limestone" },
|
||||
startrock={ "rocks:limestone" },
|
||||
ymin=-200, ymax=-6,
|
||||
scarcity=80,
|
||||
radius=3,
|
||||
content="default:dirt",
|
||||
scatter=
|
||||
{
|
||||
{ scarcity=5, density=4, ore="default:mese", cnt=0},
|
||||
},
|
||||
})
|
||||
|
||||
rocksl.genpipe=function(minp,maxp,pr,vm,area,descr)
|
||||
local t1 = os.clock()
|
||||
local data = vm:get_data()
|
||||
|
||||
local chunksizer = maxp.x - minp.x + 1
|
||||
local chunksize = chunksizer + 1
|
||||
local pmapsize = {x = chunksize, y = chunksize, z = chunksize}
|
||||
local minpxz = {x = minp.x, y = minp.z}
|
||||
|
||||
local bedrocks={}
|
||||
for _,node in pairs(descr.bedrock) do bedrocks[minetest.get_content_id(node)]=true end
|
||||
local startrocks={}
|
||||
for _,node in pairs(descr.startrock) do startrocks[minetest.get_content_id(node)]=true end
|
||||
local content=minetest.get_content_id(descr.content)
|
||||
for _,des in pairs(descr.scatter) do
|
||||
des.c_ore=minetest.get_content_id(des.ore)
|
||||
end
|
||||
local orepr=PseudoRandom(pr:next())
|
||||
|
||||
local numpipes_raw=(chunksize/descr.scarcity)
|
||||
local numpipes = math.floor(numpipes_raw + (pr:next(0,99)/100))
|
||||
|
||||
for vc=1, numpipes do
|
||||
local pointA=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
if (#startrocks>0)and(startrocks[data[area:indexp(pointA)]]==nil) then break end
|
||||
local pointB=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local pointC=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local step=(1.8*descr.radius)/(vector.distance(pointA,pointB)+vector.distance(pointB,pointC))
|
||||
for t=0, 1, step do
|
||||
local p=vector.multiply(pointA,(1-t)^2)
|
||||
p=vector.add(p, vector.multiply(pointB,2*t*(1-t)) )
|
||||
p=vector.add(p, vector.multiply(pointC,t*t) )
|
||||
p=vector.round(p)
|
||||
brush(data,area,p,descr.radius,content,descr.scatter,orepr)
|
||||
end
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
minetest.log("action", "rocks/genpipe/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
|
||||
end
|
185
rocks/sed.lua
Normal file
@ -0,0 +1,185 @@
|
||||
--
|
||||
-- Sedimentary Layer
|
||||
--
|
||||
|
||||
-- Mudstone Sed soft Ocean, beach, river, glaciers
|
||||
minetest.register_node( "rocks:mudstone", {
|
||||
description = S("Mudstone"),
|
||||
tiles = { "rocks_Mudstone.png" },
|
||||
groups = {cracky=1, crumbly=3},
|
||||
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
-- more rock defs
|
||||
minetest.register_node( "rocks:limestone", {
|
||||
description = S("Limestone"),
|
||||
tiles = { "rocks_Limestone.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=2},
|
||||
})
|
||||
minetest.register_node( "rocks:laterite", {
|
||||
description = S("Laterite clay"),
|
||||
tiles = { "rocks_laterite.png" },
|
||||
is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
|
||||
groups = {crumbly=3},
|
||||
})
|
||||
|
||||
local beach_max=4
|
||||
local lowland_max=27
|
||||
local highland_max=200
|
||||
local beach_min=-7
|
||||
local lowland_min=5
|
||||
local highland_min=28
|
||||
|
||||
do
|
||||
-- Modify default grassland biome
|
||||
local grassland=minetest.registered_biomes["default:grassland"] or
|
||||
{ -- default biome, if no biome mod is installed
|
||||
name = "rocks:grassland",
|
||||
node_top = "air",
|
||||
depth_top = 0,
|
||||
depth_filler=0,
|
||||
y_min = lowland_min,
|
||||
y_max = lowland_max,
|
||||
heat_point = 50,
|
||||
humidity_point = 50,
|
||||
}
|
||||
local mountains={ -- default mountain biome
|
||||
name = "rocks:mountain",
|
||||
node_top = "default:dirt_with_grass",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 2,
|
||||
node_stone = nil,
|
||||
y_min = highland_min,
|
||||
y_max = highland_max,
|
||||
heat_point = 50,
|
||||
humidity_point = 50,
|
||||
}
|
||||
-- The biome layers are: dust, top, filler, stone
|
||||
-- On beach: dust, shore_top, shore_filler, underwater
|
||||
-- coastside: dust, top, filler, shore_filler, underwater, stone
|
||||
if #minetest.registered_biomes > 1 then
|
||||
minetest.log("error","Biomes registered before [rocks] discarded, please depend the mod on 'rocks' to fix this.")
|
||||
-- can't just re-register them here, cause clear_biomes also clears decorations
|
||||
end
|
||||
minetest.clear_registered_biomes()
|
||||
-- hook to inject our sedimentary stone to new biomes
|
||||
local old_register_biome=minetest.register_biome
|
||||
minetest.register_biome=function(def)
|
||||
--print("[rocks] register_biome .name="..def.name)
|
||||
for n,v in pairs(def) do
|
||||
--if type(v)~="table" then print(" "..n.."="..v) end
|
||||
end
|
||||
local cor=false -- was the biomeheight patched?
|
||||
local tl=3 -- tolerance in determining biome type based on y_min/max values
|
||||
local btype -- biome type (:string)
|
||||
if (def.y_max>3000) and (def.y_min<=highland_min) then
|
||||
-- correct upper boundary of registered bimes
|
||||
if (def.y_min<10) and (def.y_min>0) then def.y_max=lowland_max cor=true end
|
||||
if (def.y_min<30) and (def.y_min>10) then def.y_max=highland_max cor=true end
|
||||
minetest.log("action","/rocks correcting upper bound on biome "..def.name.." to "..def.y_max)
|
||||
end
|
||||
-- actual detection code
|
||||
if def.node_stone=="default:desert_stone" then btype="desert"
|
||||
elseif (def.y_min>beach_min-tl) and (def.y_max<beach_max+tl) then btype="beach"
|
||||
elseif (def.y_min>0) and (def.y_max<lowland_max+tl) then btype="lowland"
|
||||
elseif (def.y_min>highland_min-tl) and (def.y_max<highland_max+tl) then btype="highland"
|
||||
elseif (def.y_min<-3000) and (def.y_max<lowland_min+tl) then btype="ocean"
|
||||
else minetest.log("error", "/rocks could not guess elevation type for biome "..def.name) end
|
||||
rocksl.print("register_biome .name="..def.name.." -> btype="..btype)
|
||||
-- patch the new biomes with our rocks
|
||||
if btype=="lowland" then
|
||||
--def.node_filler="rocks:mudstone"
|
||||
--def.depth_filler=11
|
||||
--def.node_stone="rocks:granite"
|
||||
if (def.humidity_point>80) and (def.heat_point>80) then
|
||||
--def.node_filler="rocks:laterite"
|
||||
end
|
||||
elseif btype=="highland" then
|
||||
def.node_filler="rocks:limestone"
|
||||
def.node_stone="rocks:limestone"
|
||||
def.depth_filler=15
|
||||
elseif btype=="beach" then
|
||||
def.node_stone="rocks:granite"
|
||||
def.y_min=beach_min
|
||||
if def.heat_point<50 then
|
||||
def.node_top="default:gravel"
|
||||
def.node_filler="default:gravel"
|
||||
def.depth_filler=2
|
||||
elseif def.node_top=="default:sand" then
|
||||
if def.depth_top<2 then def.depth_top=3 end
|
||||
def.node_filler="default:sandstone"
|
||||
def.depth_filler=5
|
||||
end
|
||||
elseif btype=="ocean" then
|
||||
def.node_stone="rocks:basalt"
|
||||
def.node_top="default:gravel"
|
||||
def.node_filler="rocks:limestone"
|
||||
end
|
||||
do -- deactivate the added and removed shore-thing of MGv7
|
||||
-- to fix weirid sand layers underground
|
||||
def.node_shore_top=def.node_top
|
||||
def.node_shore_filler=def.node_filler
|
||||
def.node_underwater=def.node_top
|
||||
end
|
||||
-- and call the saved method to actually do the registration
|
||||
old_register_biome(def)
|
||||
end
|
||||
--now register the default grassland
|
||||
minetest.register_biome(grassland)
|
||||
-- create a default mountain biome...
|
||||
minetest.register_biome(mountains)
|
||||
-- hook the clear callback (fix biomesdev)
|
||||
local old_clear=minetest.clear_registered_biomes
|
||||
minetest.clear_registered_biomes=function()
|
||||
old_clear()
|
||||
minetest.log("action","/rocks re-registering default mountain biome!")
|
||||
minetest.register_biome(mountains)
|
||||
end
|
||||
end
|
||||
|
||||
-- more biomes
|
||||
-- todo: mountains, alps, volcanos
|
||||
|
||||
|
||||
|
||||
local reg=function(name,param)
|
||||
minetest.register_ore({
|
||||
ore=name,
|
||||
wherein= {
|
||||
"rocks:mudstone",
|
||||
},
|
||||
ore_type = "scatter",
|
||||
clust_scarcity = 8^3,
|
||||
clust_size = 10,
|
||||
clust_num_ores = 10^3,
|
||||
y_min = -20,
|
||||
y_max = 40,
|
||||
noise_threshhold = param.treshold,
|
||||
noise_params = {
|
||||
offset=0, scale=1, octaves=1, persist=0.3,
|
||||
spread={x=param.spread, y=param.height, z=param.spread},
|
||||
seed=rocksl.GetNextSeed(),
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- this does register a new sedimentary vein.
|
||||
rocks.register_sedimentary=reg
|
||||
|
||||
-- follows the only thing remaining from old ver :)
|
||||
|
||||
-- Sedimentary rock hardness and distribution
|
||||
-- Rock Hard Distribution
|
||||
--Breccia Weak Localized continental, folded
|
||||
-->Claystone Weak Localized continental, folded, oceanic
|
||||
--Conglomerate Weak Localized continental, folded
|
||||
-->Limestone Medium Localized continental, folded; primary oceanic, hills
|
||||
-->Coal - Large beds, twice as common in swamps
|
||||
--reg("rocks:limestone", { spread=64, height=32, treshold=0.35 })
|
||||
--reg("rocks:breccia", { spread=64, height=32, treshold=0.6 })
|
||||
--reg("rocks:conglomerate", { spread=64, height=32, treshold=0.6 })
|
||||
--reg("default:stone_with_coal", { spread=64, height=14, treshold=0.58 })
|
||||
--reg("default:clay",{ spread=48, height=14, treshold=0.55 })
|
||||
|
||||
-- ~ Tomas Brod
|
30
rocks/skarn.lua
Normal file
@ -0,0 +1,30 @@
|
||||
--
|
||||
-- Skarn deposit
|
||||
--
|
||||
|
||||
local CommonRarity=40 --too high... should be like 76
|
||||
local CommonRadius=10
|
||||
local CommonWherein={ "rocks:granite", "rocks:limestone" }
|
||||
|
||||
minetest.register_node( "rocks:skarn", {
|
||||
description = S("Skarn"),
|
||||
tiles = { "rocks_Skarn.png" },
|
||||
groups = {cracky=3, stone=1},
|
||||
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
-- skarn deposit
|
||||
rocks.register_vein("rocks:skarn",{
|
||||
wherein=CommonWherein,
|
||||
miny=-320, maxy=300,
|
||||
radius={ average=CommonRadius, amplitude=0.16, frequency=8 },
|
||||
density=80, rarity=CommonRarity,
|
||||
})
|
||||
|
||||
-- Todo:
|
||||
-- There is also a chance of isolated lapis crystals, Gold
|
||||
-- Molybdenite with Cu
|
||||
-- wollastonite with Fe
|
||||
-- enrichments: scheelite and wollastonite
|
||||
|
||||
-- ~ Tomas Brod
|
@ -11,3 +11,9 @@ rocks_Peridotite.png
|
||||
rocks_Rhyolite.png
|
||||
rocks_Schist.png
|
||||
rocks_Slate.png
|
||||
rocks_Skarn.png
|
||||
rocks_laterite.png
|
||||
rocks_claystone.png
|
||||
rocks_conglomerate.png
|
||||
rocks_anthracite.png
|
||||
rocks_lignite.png
|
Before Width: | Height: | Size: 941 B After Width: | Height: | Size: 941 B |
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 612 B |
Before Width: | Height: | Size: 992 B After Width: | Height: | Size: 992 B |
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
Before Width: | Height: | Size: 1022 B After Width: | Height: | Size: 1022 B |
Before Width: | Height: | Size: 910 B After Width: | Height: | Size: 910 B |
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 794 B After Width: | Height: | Size: 794 B |
Before Width: | Height: | Size: 851 B After Width: | Height: | Size: 851 B |
BIN
rocks/textures/rocks_Pegmatite.png
Normal file
After Width: | Height: | Size: 893 B |
Before Width: | Height: | Size: 937 B After Width: | Height: | Size: 937 B |
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 914 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
rocks/textures/rocks_Skarn.png
Normal file
After Width: | Height: | Size: 936 B |
Before Width: | Height: | Size: 677 B After Width: | Height: | Size: 677 B |
BIN
rocks/textures/rocks_anthracite.png
Normal file
After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
BIN
rocks/textures/rocks_claystone.png
Normal file
After Width: | Height: | Size: 799 B |
BIN
rocks/textures/rocks_conglomerate.png
Normal file
After Width: | Height: | Size: 1020 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
rocks/textures/rocks_laterite.png
Normal file
After Width: | Height: | Size: 761 B |
BIN
rocks/textures/rocks_lignite.png
Normal file
After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
47
rocks/veins.lua
Normal file
@ -0,0 +1,47 @@
|
||||
-- experimental fast vein generator
|
||||
|
||||
|
||||
rocksl.genvein=function(minp,maxp,pr,vm,area)
|
||||
local t1 = os.clock()
|
||||
local data = vm:get_data()
|
||||
|
||||
local chunksizer = maxp.x - minp.x + 1
|
||||
local chunksize = chunksizer + 1
|
||||
local pmapsize = {x = chunksize, y = chunksize, z = chunksize}
|
||||
local minpxz = {x = minp.x, y = minp.z}
|
||||
local c_sample=minetest.get_content_id("default:stone")
|
||||
local c_sample_ore=minetest.get_content_id("default:mese")
|
||||
|
||||
|
||||
local A=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local B=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local C=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local D=vector.new(pr:next(0,chunksizer)+minp.x,pr:next(0,chunksizer)+minp.y,pr:next(0,chunksizer)+minp.z)
|
||||
local l1=vector.distance(A,C)+vector.distance(C,B)
|
||||
local l2=vector.distance(A,D)+vector.distance(D,B)
|
||||
local step=1.4/math.max(l1,l2)
|
||||
print("step="..step.." l1="..l1.." l2="..l2)
|
||||
local scarcity=6
|
||||
local ocn=pr:next(0,scarcity)+(scarcity/2)
|
||||
for t=0, 1, step do
|
||||
local P=vector.multiply(A,(1-t)^2)
|
||||
P=vector.add(P, vector.multiply(B,t*t) )
|
||||
local Q=vector.add(P, vector.multiply(D,2*t*(1-t)) )
|
||||
P=vector.add(P, vector.multiply(C,2*t*(1-t)) )
|
||||
local step2=1/vector.distance(P,Q)
|
||||
for u=0, 1, step2 do
|
||||
local R=vector.add(vector.multiply(P,(1-u)), vector.multiply(Q,u) )
|
||||
local di=area:indexp(vector.round(R))
|
||||
if ocn<1 then
|
||||
data[di]=c_sample_ore
|
||||
ocn=pr:next(0,scarcity)+(scarcity/2)
|
||||
else
|
||||
data[di]=c_sample
|
||||
ocn=ocn-1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
minetest.log("action", "rocks/genvein/ "..math.ceil((os.clock() - t1) * 1000).." ms ")
|
||||
end
|
12
testing.lua
@ -1,12 +0,0 @@
|
||||
rocks.register_layer("testl", { gain=20, height=-55, limit=2, seed=1 }, "default:wood")
|
||||
|
||||
rocks.register_vein("clay",{
|
||||
spread = {x=30, y=10, z=30},
|
||||
treshold=0.2, -- clay should be plenty
|
||||
seed = 9,
|
||||
hmin=-8, hmax=nil,
|
||||
layers={ "mudstone" },
|
||||
})
|
||||
|
||||
rocks.register_ore( "clay", "default:clay", {treshold=0, chance=85 } )
|
||||
rocks.register_ore( "clay", "default:torch", {treshold=0, chance=15 } )
|