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
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
value = fragments_per_ingot * 9;
};
}
local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors
for name, metal in pairs(sorcery.data.metals) do
local ingot = metal.ingot or 'sorcery:' .. name .. '_ingot'
local block = metal.block or 'sorcery:' .. name .. '_block'
local screw = 'sorcery:screw_' .. name
local fragment = 'sorcery:fragment_' .. name
if not metal.no_tools then for _,t in pairs(tools) do
sorcery.matreg.lookup[(metal.items and metal.items[t]) or ('sorcery:' .. t .. '_' .. name)] = {
metal = true;
id = name; data = metal;
}
end end
if not metal.no_armor then for _,a in pairs(armors) do
sorcery.matreg.lookup[(metal.items and metal.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
metal = true;
id = name; data = metal;
}
end end
sorcery.data.metallookup[ingot] = {
id = name; data = metal;
value = fragments_per_ingot;
}
sorcery.data.metallookup[block] = {
................................................................................
value = 1;
}
sorcery.data.metallookup[screw] = {
id = name; data = metal;
value = 0; -- prevent use in smelting
}
minetest.register_craftitem(screw, {
description = sorcery.lib.str.capitalize(name) .. ' screw';
inventory_image = sorcery.lib.image('sorcery_screw.png'):multiply(sorcery.lib.color(metal.tone)):render();
})
-- TODO: replace crafting recipe with kiln recipe
minetest.register_craft {
output = screw.. ' 4';
recipe = {
{fragment,fragment,fragment};
{'', fragment,''};
{'', fragment,''};
................................................................................
lump_image = (metal.image and metal.image.lump) or nil;
armor_weight = metal.armor_weight;
armor_protection = metal.armor_protection;
}
end
minetest.register_craftitem(fragment, {
inventory_image = 'sorcery_' .. name .. '_fragment.png';
description = sorcery.lib.str.capitalize(name) .. ' fragment';
})
minetest.register_craft {
type = 'cooking';
recipe = ingot;
cooktime = (metal.cooktime or 4) / 2;
output = fragment .. ' ' .. tostring(fragments_per_ingot);
}
do local rec = {}
................................................................................
rec[#rec+1]=fragment
end
minetest.register_craft {
type = 'shapeless';
recipe = rec;
output = ingot;
}
end
if metal.mix then
sorcery.data.register.alloy(sorcery.lib.tbl.merge(metal.mix, {
output = name;
cooktime = metal.cooktime or 10;
}))
end
end
|
|
>
>
>
>
>
>
>
>
|
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
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
..
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
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
...
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
|
value = fragments_per_ingot * 9;
};
}
local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors
for name, metal in pairs(sorcery.data.metals) do
local ingot = metal.ingot or 'sorcery:' .. name .. '_ingot'
local block = metal.block or 'sorcery:' .. name .. 'block'
local screw = 'sorcery:screw_' .. name
local fragment = 'sorcery:fragment_' .. name
local powder = 'sorcery:powder_' .. name
metal.parts = {
ingot = ingot;
block = block;
screw = screw;
fragment = fragment;
powder = powder;
}
if not metal.no_tools then for t,c in pairs(tools) do
sorcery.matreg.lookup[(metal.items and metal.items[t]) or ('sorcery:' .. t .. '_' .. name)] = {
metal = true;
id = name; data = metal;
value = c.cost * fragments_per_ingot;
}
end end
if not metal.no_armor then for a,c in pairs(armors) do
sorcery.matreg.lookup[(metal.items and metal.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
metal = true;
id = name; data = metal;
value = c.cost * fragments_per_ingot;
}
end end
sorcery.data.metallookup[ingot] = {
id = name; data = metal;
value = fragments_per_ingot;
}
sorcery.data.metallookup[block] = {
................................................................................
value = 1;
}
sorcery.data.metallookup[screw] = {
id = name; data = metal;
value = 0; -- prevent use in smelting
}
minetest.register_craftitem(screw, {
description = sorcery.lib.str.capitalize(name) .. ' Screw';
inventory_image = sorcery.lib.image('sorcery_screw.png'):multiply(sorcery.lib.color(metal.tone)):render();
})
minetest.register_craftitem(powder, {
description = sorcery.lib.str.capitalize(name) .. ' Powder';
inventory_image = 'sorcery_' .. name .. '_powder.png';
})
if metal.dye then
minetest.register_craft {
output = 'dye:' .. metal.dye .. ' 4';
recipe = {
{'', powder, ''};
{powder,'basic_materials:paraffin',powder};
{'','bucket:bucket_water',''};
};
replacements = {
{'bucket:bucket_water', 'bucket:bucket_empty'};
};
};
end
-- TODO: replace crafting recipe with kiln recipe
minetest.register_craft {
output = screw.. ' 4';
recipe = {
{fragment,fragment,fragment};
{'', fragment,''};
{'', fragment,''};
................................................................................
lump_image = (metal.image and metal.image.lump) or nil;
armor_weight = metal.armor_weight;
armor_protection = metal.armor_protection;
}
end
minetest.register_craftitem(fragment, {
inventory_image = 'sorcery_' .. name .. '_fragment.png';
description = sorcery.lib.str.capitalize(name) .. ' Fragment';
})
minetest.register_craft {
type = 'cooking';
recipe = powder;
cooktime = (metal.cooktime or 4) * 1.5;
output = fragment;
}
minetest.register_craft {
type = 'cooking';
recipe = ingot;
cooktime = (metal.cooktime or 4) / 2;
output = fragment .. ' ' .. tostring(fragments_per_ingot);
}
do local rec = {}
................................................................................
rec[#rec+1]=fragment
end
minetest.register_craft {
type = 'shapeless';
recipe = rec;
output = ingot;
}
end
if metal.fuel then
minetest.register_craft {
type = 'fuel';
recipe = powder;
burntime = metal.fuel;
}
end
if metal.mix then
sorcery.data.register.alloy(sorcery.lib.tbl.merge(metal.mix, {
output = name;
cooktime = metal.cooktime or 10;
}))
end
if metal.sinter then
local powders = {}
for _,m in pairs(metal.sinter) do
powders[#powders+1] = 'sorcery:powder_' .. m
end
minetest.register_craft {
type = 'shapeless';
output = powder .. ' ' .. tostring(#powders);
recipe = powders;
};
end
end
|