Note, how to rewrite mapgen.
[rocks.git] / sed.lua
blobc2335707cbcb73f0463138d7c85577cd219ef2b3
1 --
2 -- Sedimentary Layer
3 --
5 local sed={
6 top={
7 offset = 20, scale = 0,
8 spread = {x=80, y=80, z=80},
9 octaves = 0, persist = 0 },
10 bot={
11 offset = -16, scale = 10, seed=rocksl.GetNextSeed(),
12 spread = {x=80, y=80, z=80},
13 octaves = 2, persist = 0.7 },
14 primary={ name="rocks:mudstone" },
15 localized={},
16 stats={ count=0, total=0, node={}, totalnodes=0 },
17 debugging=nil
20 -- Mudstone Sed soft Ocean, beach, river, glaciers
21 minetest.register_node( "rocks:mudstone", {
22 description = S("Mudstone"),
23 tiles = { "rocks_Mudstone.png" },
24 groups = {cracky=1, crumbly=3},
25 is_ground_content = true, sounds = default.node_sound_dirt_defaults(),
28 -- more rock defs
29 minetest.register_node( "rocks:limestone", {
30 description = S("Limestone"),
31 tiles = { "rocks_Limestone.png" },
32 is_ground_content = true, sounds = default.node_sound_stone_defaults(),
33 groups = {cracky=2},
37 local reg=function(name,param)
38 rocksl.register_stratus(sed,name,param)
39 end
41 rocks.register_sedimentary=reg
43 -- Sedimentary rock hardness and distribution
44 -- Rock Hard Distribution
45 --Breccia Weak Localized continental, folded
46 -->Claystone Weak Localized continental, folded, oceanic
47 --Conglomerate Weak Localized continental, folded
48 -->Limestone Medium Localized continental, folded; primary oceanic, hills
49 -->Coal - Large beds, twice as common in swamps
50 reg("rocks:limestone", { spread=64, height=32, treshold=0.36 })
51 --reg("rocks:breccia", { spread=64, height=32, treshold=0.6 })
52 --reg("rocks:conglomerate", { spread=64, height=32, treshold=0.6 })
53 reg("default:stone_with_coal", { spread=48, height=14, treshold=0.40 })
54 reg("default:clay",{ spread=48, height=14, treshold=0.50 })
56 minetest.register_on_generated(function(minp, maxp, seed)
57 rocksl.layergen(sed,minp,maxp,seed)
58 end)
60 minetest.register_on_shutdown(function()
61 if (sed.stats.count==0) then rocksl.print("[rocks](sed) stats not available, no chunks generated") return end
62 rocksl.print("[rocks](sed) generated total "..sed.stats.count.." chunks in "..sed.stats.total.." seconds ("..(sed.stats.total/sed.stats.count).." seconds per "..sed.stats.side.."^3 chunk)")
63 for name,total in pairs(sed.stats.node) do
64 rocksl.print("[rocks](sed) "..name..": "..total.." nodes placed ("..(total*100)/(sed.stats.totalnodes).." %)")
65 end
66 end)
68 -- ~ Tomas Brod