commit | author | age
|
167434
|
1 |
minetest.register_node( "technic:mineral_diamond", { |
MK |
2 |
description = "Diamond Ore", |
77007b
|
3 |
tiles = { "default_stone.png^technic_mineral_diamond.png" }, |
167434
|
4 |
is_ground_content = true, |
MK |
5 |
groups = {cracky=3}, |
|
6 |
sounds = default.node_sound_stone_defaults(), |
|
7 |
drop = 'craft "technic:diamond" 1', |
|
8 |
}) |
|
9 |
|
|
10 |
minetest.register_craftitem( "technic:diamond", { |
|
11 |
description = "Diamond", |
|
12 |
inventory_image = "technic_diamond.png", |
|
13 |
on_place_on_ground = minetest.craftitem_place_item, |
|
14 |
}) |
77007b
|
15 |
|
MK |
16 |
minetest.register_node( "technic:mineral_uranium", { |
|
17 |
description = "Uranium Ore", |
|
18 |
tiles = { "default_stone.png^technic_mineral_uranium.png" }, |
|
19 |
is_ground_content = true, |
|
20 |
groups = {cracky=3}, |
|
21 |
sounds = default.node_sound_stone_defaults(), |
|
22 |
drop = 'craft "technic:uranium" 1', |
|
23 |
}) |
|
24 |
|
|
25 |
minetest.register_craftitem( "technic:uranium", { |
|
26 |
description = "Uranium", |
|
27 |
inventory_image = "technic_uranium.png", |
|
28 |
on_place_on_ground = minetest.craftitem_place_item, |
|
29 |
}) |
|
30 |
|
|
31 |
minetest.register_node( "technic:mineral_chromium", { |
|
32 |
description = "Chromium Ore", |
|
33 |
tiles = { "default_stone.png^technic_mineral_chromium.png" }, |
|
34 |
is_ground_content = true, |
|
35 |
groups = {cracky=3}, |
|
36 |
sounds = default.node_sound_stone_defaults(), |
|
37 |
drop = 'craft "technic:chromium_lump" 1', |
|
38 |
}) |
|
39 |
|
|
40 |
minetest.register_node( "technic:diamond_block", { |
|
41 |
description = "Diamond Block", |
|
42 |
tiles = { "technic_diamond_block.png" }, |
|
43 |
is_ground_content = true, |
|
44 |
groups = {cracky=3}, |
|
45 |
sounds = default.node_sound_stone_defaults(), |
|
46 |
drop = 'craft "technic:diamond_block" 1', |
|
47 |
}) |
|
48 |
|
|
49 |
minetest.register_node( "technic:diamond_block_red", { |
|
50 |
description = "Red Diamond Block", |
|
51 |
tiles = { "technic_diamond_block_red.png" }, |
|
52 |
is_ground_content = true, |
|
53 |
groups = {cracky=3}, |
|
54 |
sounds = default.node_sound_stone_defaults(), |
|
55 |
drop = 'craft "technic:diamond_block_red" 1', |
|
56 |
}) |
|
57 |
minetest.register_node( "technic:diamond_block_green", { |
|
58 |
description = "Green Diamond Block", |
|
59 |
tiles = { "technic_diamond_block_green.png" }, |
|
60 |
is_ground_content = true, |
|
61 |
groups = {cracky=3}, |
|
62 |
sounds = default.node_sound_stone_defaults(), |
|
63 |
drop = 'craft "technic:diamond_block_green" 1', |
|
64 |
}) |
|
65 |
minetest.register_node( "technic:diamond_block_blue", { |
|
66 |
description = "Red Diamond Block", |
|
67 |
tiles = { "technic_diamond_block_blue.png" }, |
|
68 |
is_ground_content = true, |
|
69 |
groups = {cracky=3}, |
|
70 |
sounds = default.node_sound_stone_defaults(), |
|
71 |
drop = 'craft "technic:diamond_block_blue" 1', |
|
72 |
}) |
|
73 |
|
|
74 |
|
|
75 |
minetest.register_craftitem( "technic:chromium_lump", { |
|
76 |
description = "Chromium Lump", |
|
77 |
inventory_image = "technic_chromium_lump.png", |
|
78 |
on_place_on_ground = minetest.craftitem_place_item, |
|
79 |
}) |
|
80 |
|
|
81 |
minetest.register_craftitem( "technic:chromium_ingot", { |
|
82 |
description = "Chromium Ingot", |
|
83 |
inventory_image = "technic_chromium_ingot.png", |
|
84 |
on_place_on_ground = minetest.craftitem_place_item, |
|
85 |
}) |
|
86 |
|
1f1562
|
87 |
minetest.register_craftitem( "technic:stainless_steel_ingot", { |
MK |
88 |
description = "Stainless Steel Ingot", |
|
89 |
inventory_image = "technic_stainless_steel_ingot.png", |
|
90 |
on_place_on_ground = minetest.craftitem_place_item, |
|
91 |
}) |
|
92 |
|
77007b
|
93 |
minetest.register_craft({ |
MK |
94 |
type = 'cooking', |
|
95 |
output = "technic:chromium_ingot", |
|
96 |
recipe = "technic:chromium_lump" |
|
97 |
}) |
167434
|
98 |
|
MK |
99 |
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max) |
|
100 |
if maxp.y < height_min or minp.y > height_max then |
|
101 |
return |
|
102 |
end |
|
103 |
local y_min = math.max(minp.y, height_min) |
|
104 |
local y_max = math.min(maxp.y, height_max) |
|
105 |
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) |
|
106 |
local pr = PseudoRandom(seed) |
|
107 |
local num_chunks = math.floor(chunks_per_volume * volume) |
|
108 |
local chunk_size = 3 |
|
109 |
if ore_per_chunk <= 4 then |
|
110 |
chunk_size = 2 |
|
111 |
end |
|
112 |
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) |
|
113 |
--print("generate_ore num_chunks: "..dump(num_chunks)) |
|
114 |
for i=1,num_chunks do |
|
115 |
if (y_max-chunk_size+1 <= y_min) then return end |
|
116 |
local y0 = pr:next(y_min, y_max-chunk_size+1) |
|
117 |
if y0 >= height_min and y0 <= height_max then |
|
118 |
local x0 = pr:next(minp.x, maxp.x-chunk_size+1) |
|
119 |
local z0 = pr:next(minp.z, maxp.z-chunk_size+1) |
|
120 |
local p0 = {x=x0, y=y0, z=z0} |
|
121 |
for x1=0,chunk_size-1 do |
|
122 |
for y1=0,chunk_size-1 do |
|
123 |
for z1=0,chunk_size-1 do |
|
124 |
if pr:next(1,inverse_chance) == 1 then |
|
125 |
local x2 = x0+x1 |
|
126 |
local y2 = y0+y1 |
|
127 |
local z2 = z0+z1 |
|
128 |
local p2 = {x=x2, y=y2, z=z2} |
|
129 |
if minetest.env:get_node(p2).name == wherein then |
|
130 |
minetest.env:set_node(p2, {name=name}) |
|
131 |
end |
|
132 |
end |
|
133 |
end |
|
134 |
end |
|
135 |
end |
|
136 |
end |
|
137 |
end |
|
138 |
--print("generate_ore done") |
|
139 |
end |
|
140 |
|
|
141 |
minetest.register_on_generated(function(minp, maxp, seed) |
|
142 |
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+20, 1/11/11/11, 1, -31000, -450) |
77007b
|
143 |
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+20, 1/11/11/11, 1, -300, -150) |
MK |
144 |
generate_ore("technic:mineral_chromium", "default:stone", minp, maxp, seed+20, 1/13/13/13, 1, -600, -100) |
167434
|
145 |
end) |