-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.lua
398 lines (335 loc) · 10.9 KB
/
init.lua
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
local function table_contains(v, t)
for _,i in ipairs(t) do
if i == v then
return true
end
end
return false
end
local diamond_capabs = minetest.registered_tools["default:pick_diamond"].tool_capabilities
--silk touch pick
minetest.register_tool("special_picks:silk_touch_pick", {
description = "Silk Touch Pickaxe",
inventory_image = "special_picks_silk_touch_pick.png",
tool_capabilities = diamond_capabs,
})
local special_tools = {}
local function add_tool(name, func)
special_tools[name] = func
end
minetest.register_on_dignode(function(_, oldnode, digger)
if digger == nil then
return
end
local func = special_tools[digger:get_wielded_item():get_name()]
if func
and oldnode.name ~= "air" then
func(digger, oldnode)
end
end)
add_tool("special_picks:silk_touch_pick", function(digger, oldnode)
local inv = digger:get_inventory()
if inv then
local free_slots = 0
for _,i in pairs(inv:get_list("main")) do
if i:get_count() == 0 then
free_slots = free_slots+1
break
end
end
if free_slots == 0 then
return
end
local nd = oldnode.name
local items = minetest.get_node_drops(nd)
local first_item = items[1]
if not first_item then
return
end
if first_item == nd then
return
end
for _,item in ipairs(items) do
inv:remove_item("main", item)
end
inv:add_item("main", nd)
end
end)
minetest.register_craftitem("special_picks:soft_diamond", {
description = "Soft Diamond",
inventory_image = "special_picks_soft_diamond.png",
})
minetest.register_craft({
output = "special_picks:soft_diamond",
recipe = {
{"group:wool", "default:coalblock","group:wool"},
{"default:obsidian", "default:diamond","default:obsidian"},
{"group:wool", "default:obsidian","group:wool"},
}
})
minetest.register_craft({
output = "special_picks:silk_touch_pick",
recipe = {
{"special_picks:soft_diamond", "special_picks:soft_diamond", "special_picks:soft_diamond"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
--fortune pick
minetest.register_tool("special_picks:fortune_pick", {
description = "Fortune Pickaxe",
inventory_image = "special_picks_fortune_pick.png",
tool_capabilities = diamond_capabs,
})
local allowed_nodes = {"technic:mineral_sulfur","technic:mineral_lead","technic:mineral_zinc","technic:mineral_chromium","technic:mineral_uranium","default:mineral_silver","default:mineral_tin","default:mineral_copper", "moreores:mineral_silver","moreores:mineral_mithril","moreores:mineral_tin","default:stone_with_coal","default:stone_with_iron","default:stone_with_copper","default:stone_with_mese", "default:stone_with_gold","default:stone_with_diamond"}
add_tool("special_picks:fortune_pick", function(digger, oldnode)
local nam = oldnode.name
if not table_contains(nam, allowed_nodes) then
return
end
if math.random(2) == 1 then
return
end
local inv = digger:get_inventory()
if inv then
local items = minetest.get_node_drops(nam)
for _,item in ipairs(items) do
inv:add_item("main", item)
end
end
end)
minetest.register_craftitem("special_picks:fortune_diamond", {
description = "Fortune Diamond",
inventory_image = "special_picks_fortune_diamond.png",
})
minetest.register_craft({
output = "special_picks:fortune_diamond",
recipe = {
{"default:goldblock", "default:mese", "default:goldblock"},
{"default:copperblock", "default:diamond", "default:copperblock"},
{"default:steelblock", "default:mese", "default:steelblock"},
}
})
minetest.register_craft({
output = "special_picks:fortune_diamond",
recipe = {
{"moreores:silver_block", "moreores:mithril_block", "moreores:silver_block"},
{"moreores:tin_block", "default:diamond", "moreores:tin_block"},
{"default:steelblock", "moreores:mithril_block", "default:steelblock"},
}
})
minetest.register_craft({
output = "special_picks:fortune_diamond",
recipe = {
{"default:silverblock", "default:mese", "default:silverblock"},
{"default:tinblock", "default:diamond", "default:tinblock"},
{"default:copperblock", "default:mese", "default:copperblock"},
}
})
minetest.register_craft({
output = "special_picks:fortune_pick",
recipe = {
{"special_picks:fortune_diamond", "special_picks:fortune_diamond", "special_picks:fortune_diamond"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
--big diamond pick
local capabs = table.copy(diamond_capabs)
capabs.groupcaps.cracky.uses = capabs.groupcaps.cracky.uses*9
minetest.register_tool("special_picks:big_diamondpick", {
description = "Big Diamond Pickaxe",
inventory_image = "special_picks_big_diamondpick.png",
tool_capabilities = capabs,
})
minetest.register_craft({
output = "special_picks:big_diamondpick",
recipe = {
{"default:diamondblock", "default:diamondblock", "default:diamondblock"},
{"", "group:tree", ""},
{"", "group:tree", ""},
}
})
--battle pick
local capabs = table.copy(diamond_capabs)
capabs.damage_groups.fleshy = capabs.damage_groups.fleshy*2
minetest.register_tool("special_picks:battle_pick", {
description = "Battle Pickaxe",
inventory_image = "special_picks_battle_pick.png",
tool_capabilities = capabs,
})
minetest.register_craftitem("special_picks:abrasive_paper", {
description = "Abrasive Paper",
inventory_image = "special_picks_abrasive_paper.png",
})
minetest.register_craftitem("special_picks:pointed_diamond", {
description = "Pointed Diamond",
inventory_image = "special_picks_pointed_diamond.png",
})
minetest.register_craft({
output = "special_picks:abrasive_paper 3",
recipe = {
{"default:sandstone", "default:sandstone", "default:sandstone"},
{"default:paper", "default:paper", "default:paper"},
}
})
minetest.register_craft({
output = "special_picks:pointed_diamond",
recipe = {
{"", "special_picks:abrasive_paper", ""},
{"special_picks:abrasive_paper", "default:diamond", "special_picks:abrasive_paper"},
{"", "special_picks:abrasive_paper", ""},
}
})
minetest.register_craft({
output = "special_picks:battle_pick",
recipe = {
{"special_picks:pointed_diamond", "special_picks:pointed_diamond", "special_picks:pointed_diamond"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
--fire pick
local capabs = table.copy(diamond_capabs)
capabs.damage_groups.fleshy = capabs.damage_groups.fleshy+1
minetest.register_tool("special_picks:fire_pick", {
description = "Fire Pickaxe",
inventory_image = "special_picks_fire_pick.png",
tool_capabilities = capabs,
})
add_tool("special_picks:fire_pick", function(digger, node)
local inv = digger:get_inventory()
if inv then
local nam = node.name
local drops = minetest.get_node_drops(nam)
local result = minetest.get_craft_result({method = "cooking", width = 1, items = drops})["item"]
if result:is_empty() then
return
end
for _,item in ipairs(drops) do
inv:remove_item("main", item)
end
inv:add_item("main", result)
end
end)
minetest.register_craftitem("special_picks:hot_diamond", {
description = "Hot Diamond",
inventory_image = "special_picks_hot_diamond.png",
})
minetest.register_craft({
output = "special_picks:hot_diamond",
recipe = {
{"default:coalblock", "bucket:bucket_lava", "default:coalblock"},
{"bucket:bucket_lava", "default:diamond", "bucket:bucket_lava"},
{"default:coal_lump", "bucket:bucket_lava", "default:coal_lump"},
},
replacements = {
{"default:coalblock", "default:coal_lump 2"},
{"default:coalblock", "default:coal_lump 2"},
{"bucket:bucket_lava", "bucket:bucket_empty"},
{"bucket:bucket_lava", "bucket:bucket_empty"},
{"bucket:bucket_lava", "bucket:bucket_empty"},
{"bucket:bucket_lava", "bucket:bucket_empty"},
}
})
minetest.register_craft({
output = "special_picks:fire_pick",
recipe = {
{"special_picks:hot_diamond", "special_picks:hot_diamond", "special_picks:hot_diamond"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
--liquid transportation pick
--[[minetest.register_tool("special_picks:liquid_transportation_pick", {
description = "Liquid Transportation Pickaxe",
inventory_image = "special_picks_fire_pick.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=3,
groupcaps={
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3}
},
damage_groups = {fleshy=5},
},
})]]
--glass steel pick
local glass_pick_capabs = table.copy(diamond_capabs)
local cracky = glass_pick_capabs.groupcaps.cracky
for n,i in pairs(cracky.times) do
cracky.times[n] = i/2
end
cracky.uses = 8
cracky.maxlevel = 2
glass_pick_capabs.damage_groups.fleshy = glass_pick_capabs.damage_groups.fleshy-1
minetest.register_tool("special_picks:glass_steel_pick", {
description = "Glass Steel Pickaxe",
inventory_image = "special_picks_glass_steel_pick.png",
tool_capabilities = glass_pick_capabs,
})
minetest.register_craftitem("special_picks:glass_steel_ingot", {
description = "Glass Steel Ingot",
inventory_image = "special_picks_glass_steel_ingot.png",
})
minetest.register_craft({
output = "special_picks:glass_steel_ingot",
recipe = {
{"default:glass", "default:glass", "default:glass"},
{"default:glass", "default:steel_ingot", "default:glass"},
{"default:glass", "default:glass", "default:glass"},
}
})
minetest.register_craft({
output = "special_picks:glass_steel_pick",
recipe = {
{"special_picks:glass_steel_ingot", "special_picks:glass_steel_ingot", "special_picks:glass_steel_ingot"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
minetest.register_node("special_picks:glass_steel_block", {
description = "Glass Steel Block",
drawtype = "glasslike",
tiles = {"special_picks_glass_steel_block.png"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
groups = {cracky=1,level=2},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_craft({
output = "special_picks:glass_steel_block",
recipe = {
{"special_picks:glass_steel_ingot", "special_picks:glass_steel_ingot", "special_picks:glass_steel_ingot"},
{"special_picks:glass_steel_ingot", "special_picks:glass_steel_ingot", "special_picks:glass_steel_ingot"},
{"special_picks:glass_steel_ingot", "special_picks:glass_steel_ingot", "special_picks:glass_steel_ingot"},
}
})
glass_pick_capabs.groupcaps.cracky.uses = glass_pick_capabs.groupcaps.cracky.uses*9
minetest.register_tool("special_picks:big_glass_steel_pick", {
description = "Big Glass Steel Pickaxe",
inventory_image = "special_picks_big_glass_steel_pick.png",
tool_capabilities = glass_pick_capabs,
})
minetest.register_craft({
output = "special_picks:big_glass_steel_pick",
recipe = {
{"special_picks:glass_steel_block", "special_picks:glass_steel_block", "special_picks:glass_steel_block"},
{"", "group:tree", ""},
{"", "group:tree", ""},
}
})
--explosion pick
--[[minetest.register_tool("special_picks:explosion_pick", {
description = "Explosion Pickaxe",
inventory_image = "special_picks_explosion_pick.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=3,
groupcaps={
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3}
},
damage_groups = {fleshy=5},
},
})]]
--i need help with this pick