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