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