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
80 rocks
.register_vein("default:nyancat",{
81 wherein
={"rocks:granite", "air"},
83 radius
={ average
=10, amplitude
=0.1, frequency
=8 },
85 rarity
=70, -- this^3*mapblock_volume veins per mapblock
87 { ore
="default:sand", percent
=30 },
88 { ore
="default:dirt", percent
=30 },
93 offset
= 0, octaves
= 3, persist
= 0.46,
95 spread
= {x
=500, y
=500, z
=500},
99 octaves
= 3, persist
= 0.46,
102 spread
= {x
=100, y
=100, z
=100},
106 minetest
.register_on_generated( function( minp
, maxp
, seed
)
107 local t1
= os
.clock()
108 local vm
, emin
, emax
= minetest
.get_mapgen_object("voxelmanip")
109 local area
= VoxelArea
:new
{MinEdge
=emin
, MaxEdge
=emax
}
110 local data
= vm
:get_data()
112 local chunksize
= maxp
.x
- minp
.x
+ 1
113 local pmapsize
= {x
= chunksize
, y
= chunksize
, z
= 1}
114 local pmapminpxz
= {x
= minp
.x
, y
= minp
.z
}
115 local c_stone
= minetest
.get_content_id("default:stone")
117 { min=-100, node
="rocks:granite" },
118 { min=-240, node
="rocks:diorite"},
119 { node
="rocks:gabbro", min=-700},
121 for k
,v
in pairs(layers
) do
122 v
.ctx
=minetest
.get_content_id(v
.node
)
124 local layers_no
=#layers
125 local n_layer
= minetest
.get_perlin_map(np_layer
, pmapsize
) : get2dMap_flat(pmapminpxz
)
126 local n_intr
= minetest
.get_perlin_map(np_intr
, pmapsize
) : get2dMap_flat(pmapminpxz
)
129 for z
=minp
.z
, maxp
.z
do for x
=minp
.x
, maxp
.x
do
131 for y
=minp
.y
, maxp
.y
do
132 local di
=area
:index(x
,y
,z
)
133 local yn
=y
+n_layer
[nixz
]
134 local vintr
=n_intr
[nixz
]
135 if vintr
<1 then vintr
=1 end
136 if data
[di
]==c_stone
then
137 yn
=yn
*vintr
-- vertical intrusion
138 for li
=1, layers_no
do
139 if yn
> layers
[li
].min then
140 data
[di
]=layers
[li
].ctx
150 vm
:set_lighting({day
=15,night
=2})
151 minetest
.generate_ores(vm
)
152 vm
:write_to_map(data
)
153 minetest
.log("action", "rocks/layer/ "..math
.ceil((os
.clock() - t1
) * 1000).." ms ")