commit | author | age
|
b8d776
|
1 |
minetest.register_node( "technic:marble", { |
R |
2 |
description = "Marble", |
|
3 |
tiles = { "technic_marble.png" }, |
|
4 |
is_ground_content = true, |
|
5 |
groups = {cracky=3}, |
|
6 |
sounds = default.node_sound_stone_defaults(), |
|
7 |
}) |
|
8 |
|
|
9 |
minetest.register_node( "technic:marble_bricks", { |
|
10 |
description = "Marble Bricks", |
|
11 |
tiles = { "technic_marble_bricks.png" }, |
|
12 |
is_ground_content = true, |
|
13 |
groups = {cracky=3}, |
|
14 |
sounds = default.node_sound_stone_defaults(), |
|
15 |
}) |
|
16 |
|
|
17 |
minetest.register_craft({ |
|
18 |
output = 'technic:marble_bricks 4', |
|
19 |
recipe = { |
|
20 |
{'technic:marble','technic:marble'}, |
|
21 |
{'technic:marble','technic:marble'} |
|
22 |
} |
|
23 |
}) |
|
24 |
|
|
25 |
minetest.register_node( "technic:granite", { |
|
26 |
description = "Granite", |
|
27 |
tiles = { "technic_granite.png" }, |
|
28 |
is_ground_content = true, |
|
29 |
groups = {cracky=3}, |
|
30 |
sounds = default.node_sound_stone_defaults(), |
|
31 |
}) |
|
32 |
|
|
33 |
minetest.register_node( "technic:obsidian", { |
|
34 |
description = "Obsidian", |
|
35 |
tiles = { "technic_obsidian.png" }, |
|
36 |
is_ground_content = true, |
|
37 |
groups = {cracky=3}, |
|
38 |
sounds = default.node_sound_stone_defaults(), |
|
39 |
}) |
|
40 |
|
876218
|
41 |
stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "marble", "technic:marble", |
b8d776
|
42 |
{cracky=3}, |
R |
43 |
{"technic_marble.png"}, |
|
44 |
"Marble Stairs", |
|
45 |
"Marble Slab", |
|
46 |
"Marble Panel", |
|
47 |
"Marble Microblock", |
|
48 |
"marble") |
876218
|
49 |
stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "marble_bricks", "technic:marble_bricks", |
b8d776
|
50 |
{cracky=3}, |
R |
51 |
{"technic_marble_bricks.png"}, |
|
52 |
"Marble Bricks Stairs", |
|
53 |
"Marble Bricks Slab", |
|
54 |
"Marble Bricks Panel", |
|
55 |
"Marble Bricks Microblock", |
|
56 |
"marble_bricks") |
876218
|
57 |
stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "granite", "technic:granite", |
b8d776
|
58 |
{cracky=3}, |
R |
59 |
{"technic_granite.png"}, |
|
60 |
"Granite Stairs", |
|
61 |
"Granite Slab", |
|
62 |
"Granite Panel", |
|
63 |
"Granite Microblock", |
|
64 |
"granite") |
876218
|
65 |
stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "obsidian", "technic:obsidian", |
b8d776
|
66 |
{cracky=3}, |
R |
67 |
{"technic_obsidian.png"}, |
|
68 |
"Obsidian Stairs", |
|
69 |
"Obsidian Slab", |
|
70 |
"Obsidian Panel", |
|
71 |
"Obsidian Microblock", |
|
72 |
"obsidian") |
|
73 |
|
|
74 |
minetest.register_node( "technic:mineral_diamond", { |
|
75 |
description = "Diamond Ore", |
|
76 |
tiles = { "default_stone.png^technic_mineral_diamond.png" }, |
|
77 |
is_ground_content = true, |
|
78 |
groups = {cracky=3}, |
|
79 |
sounds = default.node_sound_stone_defaults(), |
|
80 |
drop = 'craft "technic:diamond" 1', |
|
81 |
}) |
|
82 |
|
|
83 |
minetest.register_craftitem( "technic:diamond", { |
|
84 |
description = "Diamond", |
|
85 |
inventory_image = "technic_diamond.png", |
|
86 |
on_place_on_ground = minetest.craftitem_place_item, |
|
87 |
}) |
|
88 |
|
|
89 |
minetest.register_node( "technic:mineral_uranium", { |
|
90 |
description = "Uranium Ore", |
|
91 |
tiles = { "default_stone.png^technic_mineral_uranium.png" }, |
|
92 |
is_ground_content = true, |
|
93 |
groups = {cracky=3}, |
|
94 |
sounds = default.node_sound_stone_defaults(), |
|
95 |
drop = 'craft "technic:uranium" 1', |
|
96 |
}) |
|
97 |
|
|
98 |
minetest.register_craftitem( "technic:uranium", { |
|
99 |
description = "Uranium", |
|
100 |
inventory_image = "technic_uranium.png", |
|
101 |
on_place_on_ground = minetest.craftitem_place_item, |
|
102 |
}) |
|
103 |
|
|
104 |
minetest.register_node( "technic:mineral_chromium", { |
|
105 |
description = "Chromium Ore", |
|
106 |
tiles = { "default_stone.png^technic_mineral_chromium.png" }, |
|
107 |
is_ground_content = true, |
|
108 |
groups = {cracky=3}, |
|
109 |
sounds = default.node_sound_stone_defaults(), |
|
110 |
drop = 'craft "technic:chromium_lump" 1', |
|
111 |
}) |
|
112 |
|
|
113 |
minetest.register_craftitem( "technic:chromium_lump", { |
|
114 |
description = "Chromium Lump", |
|
115 |
inventory_image = "technic_chromium_lump.png", |
|
116 |
on_place_on_ground = minetest.craftitem_place_item, |
|
117 |
}) |
|
118 |
|
|
119 |
minetest.register_craftitem( "technic:chromium_ingot", { |
|
120 |
description = "Chromium Ingot", |
|
121 |
inventory_image = "technic_chromium_ingot.png", |
|
122 |
on_place_on_ground = minetest.craftitem_place_item, |
|
123 |
}) |
|
124 |
|
|
125 |
minetest.register_craft({ |
|
126 |
type = 'cooking', |
|
127 |
output = "technic:chromium_ingot", |
|
128 |
recipe = "technic:chromium_lump" |
|
129 |
}) |
|
130 |
|
|
131 |
|
|
132 |
minetest.register_node( "technic:mineral_zinc", { |
|
133 |
description = "Zinc Ore", |
|
134 |
tile_images = { "default_stone.png^technic_mineral_zinc.png" }, |
|
135 |
is_ground_content = true, |
|
136 |
groups = {cracky=3}, |
|
137 |
sounds = default.node_sound_stone_defaults(), |
|
138 |
drop = 'craft "technic:zinc_lump" 1', |
|
139 |
}) |
|
140 |
|
|
141 |
minetest.register_craftitem( "technic:zinc_lump", { |
|
142 |
description = "Zinc Lump", |
|
143 |
inventory_image = "technic_zinc_lump.png", |
|
144 |
}) |
|
145 |
|
|
146 |
minetest.register_craftitem( "technic:zinc_ingot", { |
|
147 |
description = "Zinc Ingot", |
|
148 |
inventory_image = "technic_zinc_ingot.png", |
|
149 |
}) |
|
150 |
|
|
151 |
minetest.register_craftitem( "technic:stainless_steel_ingot", { |
|
152 |
description = "Stainless Steel Ingot", |
|
153 |
inventory_image = "technic_stainless_steel_ingot.png", |
|
154 |
}) |
|
155 |
|
|
156 |
minetest.register_craftitem( "technic:brass_ingot", { |
|
157 |
description = "Brass Ingot", |
|
158 |
inventory_image = "technic_brass_ingot.png", |
|
159 |
}) |
|
160 |
|
|
161 |
minetest.register_craft({ |
|
162 |
type = 'cooking', |
|
163 |
output = "technic:zinc_ingot", |
|
164 |
recipe = "technic:zinc_lump" |
|
165 |
}) |
|
166 |
|
|
167 |
|
|
168 |
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max) |
|
169 |
if maxp.y < height_min or minp.y > height_max then |
|
170 |
return |
|
171 |
end |
|
172 |
local y_min = math.max(minp.y, height_min) |
|
173 |
local y_max = math.min(maxp.y, height_max) |
|
174 |
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) |
|
175 |
local pr = PseudoRandom(seed) |
|
176 |
local num_chunks = math.floor(chunks_per_volume * volume) |
|
177 |
local chunk_size = 3 |
|
178 |
if ore_per_chunk <= 4 then |
|
179 |
chunk_size = 2 |
|
180 |
end |
|
181 |
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) |
|
182 |
--print("generate_ore num_chunks: "..dump(num_chunks)) |
|
183 |
for i=1,num_chunks do |
|
184 |
if (y_max-chunk_size+1 <= y_min) then return end |
|
185 |
local y0 = pr:next(y_min, y_max-chunk_size+1) |
|
186 |
if y0 >= height_min and y0 <= height_max then |
|
187 |
local x0 = pr:next(minp.x, maxp.x-chunk_size+1) |
|
188 |
local z0 = pr:next(minp.z, maxp.z-chunk_size+1) |
|
189 |
local p0 = {x=x0, y=y0, z=z0} |
|
190 |
for x1=0,chunk_size-1 do |
|
191 |
for y1=0,chunk_size-1 do |
|
192 |
for z1=0,chunk_size-1 do |
|
193 |
if pr:next(1,inverse_chance) == 1 then |
|
194 |
local x2 = x0+x1 |
|
195 |
local y2 = y0+y1 |
|
196 |
local z2 = z0+z1 |
|
197 |
local p2 = {x=x2, y=y2, z=z2} |
|
198 |
if minetest.env:get_node(p2).name == wherein then |
|
199 |
minetest.env:set_node(p2, {name=name}) |
|
200 |
end |
|
201 |
end |
|
202 |
end |
|
203 |
end |
|
204 |
end |
|
205 |
end |
|
206 |
end |
|
207 |
--print("generate_ore done") |
|
208 |
end |
|
209 |
|
|
210 |
minetest.register_on_generated(function(minp, maxp, seed) |
|
211 |
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 4, -31000, -450) |
|
212 |
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/10/10/10, 3, -300, -80) |
|
213 |
generate_ore("technic:mineral_chromium", "default:stone", minp, maxp, seed+23, 1/10/10/10, 2, -31000, -100) |
|
214 |
generate_ore("technic:mineral_zinc", "default:stone", minp, maxp, seed+24, 1/9/9/9, 4, -31000, 2) |
|
215 |
generate_ore("technic:marble", "default:stone", minp, maxp, seed+25, 1/128, 20, -100, -32) |
|
216 |
generate_ore("technic:granite", "default:stone", minp, maxp, seed+25, 1/128, 15, -190, -90) |
|
217 |
generate_stratus("technic:obsidian", |
|
218 |
{"default:stone"}, |
|
219 |
{"default:lava_source"},{"default:air"}, |
|
220 |
minp, maxp, seed+4, 10, 25, 7, -450, -31000, -450) |
|
221 |
end) |
|
222 |
|
|
223 |
function generate_stratus(name, wherein, ceilin, ceil, minp, maxp, seed, stratus_chance, radius, radius_y, deep, height_min, height_max) |
|
224 |
if maxp.y < height_min or minp.y > height_max then |
|
225 |
return |
|
226 |
end |
|
227 |
-- it will be only generate a stratus for every 100 m of area |
|
228 |
local stratus_per_volume=1 |
|
229 |
local area=45 |
|
230 |
local y_min = math.max(minp.y, height_min) |
|
231 |
local y_max = math.min(maxp.y, height_max) |
|
232 |
local volume = ((maxp.x-minp.x+1)/area)*((y_max-y_min+1)/area)*((maxp.z-minp.z+1)/area) |
|
233 |
local pr = PseudoRandom(seed) |
|
234 |
local blocks = math.floor(stratus_per_volume*volume) |
|
235 |
print(" <<"..dump(name)..">>"); |
|
236 |
if blocks == 0 then |
|
237 |
blocks = 1 |
|
238 |
end |
|
239 |
print(" blocks: "..dump(blocks).." in vol: "..dump(volume).." ("..dump(maxp.x-minp.x+1)..","..dump(y_max-y_min+1)..","..dump(maxp.z-minp.z+1)..")") |
|
240 |
for i=1,blocks do |
|
241 |
local x = pr:next(1,stratus_chance) |
|
242 |
if x == 1 then |
|
243 |
-- TODO deep |
|
244 |
local y0=y_max-radius_y+1 |
|
245 |
if y0 < y_min then |
|
246 |
y0=y_min |
|
247 |
else |
|
248 |
y0=pr:next(y_min, y0) |
|
249 |
end |
|
250 |
local x0 = maxp.x-radius+1 |
|
251 |
if x0 < minp.x then |
|
252 |
x0 = minp.x |
|
253 |
else |
|
254 |
x0 = pr:next(minp.x, x0) |
|
255 |
end |
|
256 |
local z0 = maxp.z-radius+1 |
|
257 |
if z0 < minp.z then |
|
258 |
x0 = minp.z |
|
259 |
else |
|
260 |
z0 = pr:next(minp.z, z0) |
|
261 |
end |
|
262 |
local p0 = {x=x0, y=y0, z=z0} |
|
263 |
local n = minetest.env:get_node(p0).name |
|
264 |
local i = 0 |
|
265 |
--print(" upper node "..n) |
|
266 |
x = 0 |
|
267 |
for k, v in ipairs(ceilin) do |
|
268 |
if n == v then |
|
269 |
x = 1 |
|
270 |
break |
|
271 |
end |
|
272 |
end |
|
273 |
if x == 1 then |
|
274 |
-- search for the node to replace |
|
275 |
--print(" Searching nodes to replace from "..dump(y0-1).." to "..dump(y_min)) |
|
276 |
for y1=y0-1,y_min,-1 do |
|
277 |
p0.y=y1 |
|
278 |
n = minetest.env:get_node(p0).name |
|
279 |
x = 0 |
|
280 |
for k, v in ipairs(wherein) do |
|
281 |
if n == v then |
|
282 |
x = 1 |
|
283 |
break |
|
284 |
end |
|
285 |
end |
|
286 |
if x == 1 then |
|
287 |
y0=y1-deep |
|
288 |
if y0 < y_min then |
|
289 |
y0 = y_min |
|
290 |
end |
|
291 |
break |
|
292 |
end |
|
293 |
end |
|
294 |
local rx=pr:next(radius/2,radius)+1 |
|
295 |
local rz=pr:next(radius/2,radius)+1 |
|
296 |
local ry=pr:next(radius_y/2,radius_y)+1 |
|
297 |
--print(" area of generation ("..dump(rx)..","..dump(rz)..","..dump(ry)..")") |
|
298 |
for x1=0,rx do |
|
299 |
rz = rz + 3 - pr:next(1,6) |
|
300 |
if rz < 1 then |
|
301 |
rz = 1 |
|
302 |
end |
|
303 |
for z1=pr:next(1,3),rz do |
|
304 |
local ry0=ry+ pr:next(1,3) |
|
305 |
for y1=pr:next(1,3),ry0 do |
|
306 |
local x2 = x0+x1 |
|
307 |
local y2 = y0+y1 |
|
308 |
local z2 = z0+z1 |
|
309 |
local p2 = {x=x2, y=y2, z=z2} |
|
310 |
n = minetest.env:get_node(p2).name |
|
311 |
x = 0 |
|
312 |
for k, v in ipairs(wherein) do |
|
313 |
if n == v then |
|
314 |
x = 1 |
|
315 |
break |
|
316 |
end |
|
317 |
end |
|
318 |
if x == 1 then |
|
319 |
if ceil == nil then |
|
320 |
minetest.env:set_node(p2, {name=name}) |
|
321 |
i = i +1 |
|
322 |
else |
|
323 |
local p3 = {p2.x,p2.y+1,p2} |
|
324 |
if minetest.env:get_node(p3).name == ceil then |
|
325 |
minetest.env:set_node(p2, {name=name}) |
|
326 |
i = i +1 |
|
327 |
end |
|
328 |
end |
|
329 |
end |
|
330 |
end |
|
331 |
end |
|
332 |
end |
|
333 |
print(" generated "..dump(i).." blocks in ("..dump(x0)..","..dump(y0)..","..dump(z0)..")") |
|
334 |
end |
|
335 |
|
|
336 |
end |
|
337 |
end |
|
338 |
--print("generate_ore done") |
876218
|
339 |
end |