5 -- Basalt Ex/Mafic hard same as diorite, byt limit=0.5
6 minetest
.register_node( "rocks:basalt", {
7 description
= S("Basalt"),
8 tiles
= { "rocks_Basalt.png" },
9 groups
= {cracky
=3, stone
=1},
10 is_ground_content
= true, sounds
= default
.node_sound_stone_defaults(),
12 minetest
.register_alias("mapgen_stone", "rocks:basalt")
14 -- ^ does not work. Seems we can not overwrite an alias.
15 -- If the alias in default/mapgen.lua is deleted, this works.
18 minetest
.register_node( "rocks:granite", {
19 description
= S("Granite"),
20 tiles
= { "rocks_wgr.png" },
21 is_ground_content
= true, sounds
= default
.node_sound_stone_defaults(),
22 groups
= {cracky
=3, stone
=1},
24 minetest
.register_node( "rocks:diorite", {
25 description
= S("Diorite"),
26 tiles
= { "rocks_Diorite.png" },
27 groups
= {cracky
=3, stone
=1},
28 is_ground_content
= true, sounds
= default
.node_sound_stone_defaults(),
30 minetest
.register_node( "rocks:gabbro", {
31 description
= S("Gabbro"),
32 tiles
= { "rocks_Gabbro.png" },
33 groups
= {cracky
=3, stone
=1},
34 is_ground_content
= true, sounds
= default
.node_sound_stone_defaults(),
37 local reg
=function(name
,param
)
38 minetest
.register_ore({
42 clust_scarcity
= 10^
3,
43 clust_num_ores
= 20^
3,
47 noise_threshhold
=param
.treshold
,
49 offset
= 0, scale
= 1, octaves
= 1, persist
= 0.5,
50 spread
= {x
=param
.spread
, y
=param
.height
, z
=param
.spread
},
51 seed
=rocksl
.GetNextSeed(),
55 rocks
.register_igneous_stratus
=reg
59 local regv
=function(name
,param
)
60 minetest
.register_ore({
62 wherein
= param
.wherein
,
64 clust_scarcity
= param
.rarity^
3,
66 clust_size
= param
.radius
.average
*2,
69 noise_threshhold
= 0.5, --< determined experimentally
71 offset
= 1-param
.radius
.amplitude
, scale
= param
.radius
.amplitude
, octaves
= 3, persist
= 0.5,
72 spread
= {x
=param
.radius
.frequency
, y
=param
.radius
.frequency
, z
=param
.radius
.frequency
},
73 seed
=rocksl
.GetNextSeed(),
78 rocks
.register_vein
=regv
81 offset
= 0, octaves
= 3, persist
= 0.46,
83 spread
= {x
=500, y
=500, z
=500},
87 octaves
= 3, persist
= 0.46,
90 spread
= {x
=100, y
=100, z
=100},
94 --minetest.register_on_generated( function( minp, maxp, seed )
95 rocksl
.genign
=function(minp
,maxp
,seed
, vm
, area
)
97 local data
= vm
:get_data()
99 local chunksize
= maxp
.x
- minp
.x
+ 1
100 local pmapsize
= {x
= chunksize
, y
= chunksize
, z
= 1}
101 local pmapminpxz
= {x
= minp
.x
, y
= minp
.z
}
102 local c_stone
= minetest
.get_content_id("default:stone")
104 { min=-100, node
="rocks:granite" },
105 { min=-240, node
="rocks:diorite"},
106 { node
="rocks:gabbro", min=-700},
108 for k
,v
in pairs(layers
) do
109 v
.ctx
=minetest
.get_content_id(v
.node
)
111 local layers_no
=#layers
112 local n_layer
= minetest
.get_perlin_map(np_layer
, pmapsize
) : get2dMap_flat(pmapminpxz
)
113 local n_intr
= minetest
.get_perlin_map(np_intr
, pmapsize
) : get2dMap_flat(pmapminpxz
)
116 for z
=minp
.z
, maxp
.z
do for x
=minp
.x
, maxp
.x
do
118 for y
=minp
.y
, maxp
.y
do
119 local di
=area
:index(x
,y
,z
)
120 local yn
=y
+n_layer
[nixz
]
121 local vintr
=n_intr
[nixz
]
122 if vintr
<1 then vintr
=1 end
123 if data
[di
]==c_stone
then
124 yn
=yn
*vintr
-- vertical intrusion
125 for li
=1, layers_no
do
126 if yn
> layers
[li
].min then
127 data
[di
]=layers
[li
].ctx
137 --DEBUG: vm:set_lighting({day=15,night=2})
138 minetest
.generate_ores(vm
)
139 minetest
.log("action", "rocks/layer/ "..math
.ceil((os
.clock() - t1
) * 1000).." ms ")