Differences From
Artifact [79f4b638de]:
1 1 --- gemstones
2 2
3 3 sorcery.register_gem = function(name,gem)
4 4 local itemname = gem.foreign or 'sorcery:gem_' .. name
5 5 local shardname = gem.foreign_shard or 'sorcery:gem_' .. name .. '_shard'
6 + local amuletname = gem.foreign_amulet or 'sorcery:gem_' .. name .. '_amulet'
6 7
7 8 local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors
8 9 if gem.tools then for _,t in pairs(tools) do
9 10 sorcery.matreg.lookup[(gem.items and gem.items[t]) or ('sorcery:' .. t .. '_' .. name)] = {
10 11 gem = true;
11 12 id = name; data = gem;
12 13 }
13 14 end end
14 15 if gem.armor then for _,a in pairs(armors) do
15 - sorcery.matreg.lookup[(gem.items and gem.items[t]) or ('sorcery:' .. a .. '_' .. name)] = {
16 + sorcery.matreg.lookup[(gem.items and gem.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
16 17 gem = true;
17 18 id = name; data = gem;
18 19 }
19 20 end end
20 21
21 22 if gem.foreign_shard then
22 23 minetest.clear_craft {output=shardname}
................................................................................
23 24 else
24 25 minetest.register_craftitem(shardname, {
25 26 description = sorcery.lib.str.capitalize(name) .. ' shard';
26 27 inventory_image = 'sorcery_gem_' .. name .. '_shard.png';
27 28 groups = { sorcery_shard = 1; };
28 29 _proto = gem;
29 30 })
31 + end
32 + if not gem.foreign_amulet then
33 + minetest.register_craftitem(amuletname, {
34 + description = sorcery.lib.str.capitalize(name) .. ' amulet';
35 + inventory_image = sorcery.lib.image('sorcery_amulet.png'):multiply(sorcery.lib.color(gem.tone)):render();
36 + _proto = {
37 + id = name;
38 + data = gem;
39 + };
40 + })
30 41 end
31 42 minetest.register_craft {
32 43 type = 'shapeless';
33 44 recipe = (minetest.get_modpath('xdecor') and {
34 45 'xdecor:hammer', itemname;
35 46 }) or { itemname };
36 47 output = shardname .. ' 9';
................................................................................
43 54 recipe = {
44 55 shardname, shardname, shardname;
45 56 shardname, shardname, shardname;
46 57 shardname, shardname, shardname;
47 58 };
48 59 output = itemname;
49 60 };
61 + minetest.register_craft {
62 + recipe = {
63 + {shardname,itemname,shardname};
64 + {itemname,itemname,itemname};
65 + {shardname,itemname,shardname};
66 + };
67 + output = amuletname;
68 + };
50 69
51 70 -- generate lenses and crafting recipes
52 71 for _, kind in pairs { 'amplifier','rectifier','concave','convex' } do
53 72 local id = 'sorcery:lens_' .. kind .. '_' .. name
54 73 minetest.register_tool(id, {
55 74 inventory_image = sorcery.lib.image('sorcery_lens_overlay_gold.png'):
56 75 blit(sorcery.lib.image('sorcery_lens_' .. kind .. '.png'):
57 76 multiply(sorcery.lib.color(gem.tone):brighten(1.1))):
58 - render();
77 + render();
59 78 description = sorcery.lib.str.capitalize(name) .. ' ' .. kind .. ' lens';
60 - group = { sorcery_enchanting_lens = 1 };
79 + groups = { sorcery_enchanting_lens = 1 };
80 + _proto = {
81 + gem = name;
82 + kind = kind;
83 + };
61 84 })
62 85 end
63 86 do local casing = 'sorcery:fragment_gold'
64 87 minetest.register_craft {
65 88 output = 'sorcery:lens_convex_' .. name;
66 89 recipe = {
67 90 {'', casing, ''};