Novatux
2015-02-22 3eefa2f18134ab59139f73f4bbf918024c494d7f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
local uranium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 420, octaves = 3, persist = 0.7}
local uranium_threshhold = 0.55
 
local chromium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 421, octaves = 3, persist = 0.7}
local chromium_threshhold = 0.55
 
local zinc_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 422, octaves = 3, persist = 0.7}
local zinc_threshhold = 0.5
 
local lead_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 423, octaves = 3, persist = 0.7}
local lead_threshhold = 0.3
 
minetest.register_ore({
    ore_type         = "scatter",
    ore              = "technic:mineral_uranium",
    wherein          = "default:stone",
    clust_scarcity   = 8*8*8,
    clust_num_ores   = 4,
    clust_size       = 3,
    height_min       = -300,
    height_max       = -80,
    noise_params     = uranium_params,
    noise_threshhold = uranium_threshhold,
})
 
minetest.register_ore({
    ore_type         = "scatter",
    ore              = "technic:mineral_chromium",
    wherein          = "default:stone",
    clust_scarcity   = 8*8*8,
    clust_num_ores   = 2,
    clust_size       = 3,
    height_min       = -200,
    height_max       = -100,
    noise_params     = chromium_params,
    noise_threshhold = chromium_threshhold,
})
 
minetest.register_ore({
    ore_type         = "scatter",
    ore              = "technic:mineral_chromium",
    wherein          = "default:stone",
    clust_scarcity   = 6*6*6,
    clust_num_ores   = 2,
    clust_size       = 3,
    height_min       = -31000,
    height_max       = -200,
    flags            = "absheight",
    noise_params     = chromium_params,
    noise_threshhold = chromium_threshhold,
})
 
minetest.register_ore({
    ore_type         = "scatter",
    ore              = "technic:mineral_zinc",
    wherein          = "default:stone",
    clust_scarcity   = 8*8*8,
    clust_num_ores   = 4,
    clust_size       = 3,
    height_min       = -32,
    height_max       = 2,
    noise_params     = zinc_params,
    noise_threshhold = zinc_threshhold,
})
 
minetest.register_ore({
    ore_type         = "scatter",
    ore              = "technic:mineral_zinc",
    wherein          = "default:stone",
    clust_scarcity   = 6*6*6,
    clust_num_ores   = 4,
    clust_size       = 3,
    height_min       = -31000,
    height_max       = -32,
    flags            = "absheight",
    noise_params     = zinc_params,
    noise_threshhold = zinc_threshhold,
})
 
minetest.register_ore({
    ore_type         = "scatter",
    ore              = "technic:mineral_lead",
    wherein          = "default:stone",
    clust_scarcity   = 9*9*9,
    clust_num_ores   = 5,
    clust_size       = 3,
    height_min       = -16,
    height_max       = 16,
    noise_params     = lead_params,
    noise_threshhold = lead_threshhold,
})
 
minetest.register_ore({
    ore_type         = "scatter",
    ore              = "technic:mineral_lead",
    wherein          = "default:stone",
    clust_scarcity   = 8*8*8,
    clust_num_ores   = 5,
    clust_size       = 3,
    height_min       = -128,
    height_max       = -16,
    noise_params     = lead_params,
    noise_threshhold = lead_threshhold,
})
 
minetest.register_ore({
    ore_type         = "scatter",
    ore              = "technic:mineral_lead",
    wherein          = "default:stone",
    clust_scarcity   = 6*6*6,
    clust_num_ores   = 5,
    clust_size       = 3,
    height_min       = -31000,
    height_max       = -128,
    flags            = "absheight",
    noise_params     = lead_params,
    noise_threshhold = lead_threshhold,
})
 
-- Sulfur
minetest.register_on_generated(function(minp, maxp, seed)
    local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
    local a = VoxelArea:new{
        MinEdge = {x = emin.x, y = emin.y, z = emin.z},
        MaxEdge = {x = emax.x, y = emax.y, z = emax.z},
    }
    local data = vm:get_data()
    local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z)
    local noise = minetest.get_perlin(9876, 3, 0.5, 100)
    
    local c_lava = minetest.get_content_id("default:lava_source")
    local c_lava_flowing = minetest.get_content_id("default:lava_flowing")
    local c_stone = minetest.get_content_id("default:stone")
    local c_sulfur = minetest.get_content_id("technic:mineral_sulfur")
    
    local grid_size = 5
    for x = minp.x + math.floor(grid_size / 2), maxp.x, grid_size do
    for y = minp.y + math.floor(grid_size / 2), maxp.y, grid_size do
    for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do
        local c = data[a:index(x, y, z)]
        if (c == c_lava or c == c_lava_flowing) and noise:get3d({x = x, y = z, z = z}) >= 0.4 then
            for xx = math.max(minp.x, x - grid_size), math.min(maxp.x, x + grid_size) do
            for yy = math.max(minp.y, y - grid_size), math.min(maxp.y, y + grid_size) do
            for zz = math.max(minp.z, z - grid_size), math.min(maxp.z, z + grid_size) do
                local i = a:index(xx, yy, zz)
                if data[i] == c_stone and pr:next(1, 10) <= 7 then
                    data[i] = c_sulfur
                end
            end
            end
            end
        end
    end
    end
    end
    
    vm:set_data(data)
    vm:write_to_map(data)
end)
 
 
if technic.config:get_bool("enable_marble_generation") then
minetest.register_ore({
    ore_type       = "sheet",
    ore            = "technic:marble",
    wherein        = "default:stone",
    clust_scarcity = 1,
    clust_num_ores = 1,
    clust_size     = 3,
    height_min     = -31000,
    height_max     = -50,
    noise_threshhold = 0.4,
    noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70}
})
end
 
if technic.config:get_bool("enable_granite_generation") then
minetest.register_ore({
    ore_type       = "sheet",
    ore            = "technic:granite",
    wherein        = "default:stone",
    clust_scarcity = 1,
    clust_num_ores = 1,
    clust_size     = 4,
    height_min     = -31000,
    height_max     = -150,
    noise_threshhold = 0.4,
    noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70}
})
end