Rewrite igneous layer.
[rocks.git] / ign.lua
blob152be4ad4eb53c8532c5096e1d49d067db9d1a61
1 --
2 -- Igneous Layer
3 --
5 local ign={
6 top={
7 offset = -10, scale = 0,
8 spread = {x=80, y=80, z=80},
9 octaves = 0, persist = 0 },
10 bot={
11 offset = -180, scale = 10, seed=rocksl.GetNextSeed(),
12 spread = {x=80, y=80, z=80},
13 octaves = 2, persist = 0.7 },
14 primary={ name="rocks:basalt" },
15 localized={},
16 stats={ count=0, total=0, node={}, totalnodes=0 },
17 debugging=0
20 -- Basalt Ex/Mafic hard same as diorite, byt limit=0.5
21 minetest.register_node( "rocks:basalt", {
22 description = S("Basalt"),
23 tiles = { "rocks_Basalt.png" },
24 groups = {cracky=3, stone=1},
25 is_ground_content = true, sounds = default.node_sound_stone_defaults(),
28 -- more rock defs
29 minetest.register_node( "rocks:granite", {
30 description = S("Granite"),
31 tiles = { "rocks_Granite.png" },
32 is_ground_content = true, sounds = default.node_sound_stone_defaults(),
33 groups = {cracky=3, stone=1},
35 minetest.register_node( "rocks:diorite", {
36 description = S("Diorite"),
37 tiles = { "rocks_Diorite.png" },
38 groups = {cracky=3, stone=1},
39 is_ground_content = true, sounds = default.node_sound_stone_defaults(),
41 minetest.register_node( "rocks:gabbro", {
42 description = S("Gabbro"),
43 tiles = { "rocks_Gabbro.png" },
44 groups = {cracky=3, stone=1},
45 is_ground_content = true, sounds = default.node_sound_stone_defaults(),
48 local reg=function(name,param)
49 rocksl.register_blob(ign,name,param)
50 end
51 rocks.register_igneous=reg
53 -- rock registration
54 reg("rocks:granite", { spread=40, height=32, treshold=0.04})
55 reg("rocks:diorite", { spread=40, height=32, treshold=0.24})
56 reg("rocks:gabbro", { spread=40, height=32, treshold=0.33})
58 minetest.register_on_generated(function(minp, maxp, seed)
59 rocksl.layergen(ign,minp,maxp,seed)
60 end)
62 minetest.register_on_shutdown(function()
63 if (ign.stats.count==0) then print("[rocks](ign) stats not available, no chunks generated") return end
64 print("[rocks](ign) generated total "..ign.stats.count.." chunks in "..ign.stats.total.." seconds ("..(ign.stats.total/ign.stats.count).." seconds per "..ign.stats.side.."^3 chunk)")
65 for name,total in pairs(ign.stats.node) do
66 print("[rocks](ign) "..name..": "..total.." nodes placed ("..(total*100)/(ign.stats.totalnodes).." %)")
67 end
68 end)
70 -- ~ Tomas Brod