44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
..
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
|
-- for name, metal in pairs(sorcery.data.metals) do
sorcery.register.metals.foreach('sorcery:generate',{},function(name,metal)
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;
}
................................................................................
sorcery.data.metallookup[fragment] = {
id = name; data = metal;
value = 1;
}
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();
groups = {
metal = 1;
sorcery_screw = 1;
sorcery_tech_component = 1;
};
_sorcery = {
material = {
id = name, data = metal;
powder = powder;
grindcost = 2, grindvalue = 1;
value = 0.5;
};
};
})
local reglathe = function(ty, sz)
sorcery.lathe.register {
input = ty;
output = {name = screw, count = sz * 2};
tech = 'cut', cost = 1;
}
end
reglathe(fragment, 1)
reglathe(ingot, 4)
reglathe(block, 4 * 9)
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';
|
>
>
<
<
|
<
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
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
|
-- for name, metal in pairs(sorcery.data.metals) do
sorcery.register.metals.foreach('sorcery:generate',{},function(name,metal)
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
local disc = 'sorcery:disc_' .. name
metal.parts = {
ingot = ingot;
block = block;
screw = screw;
fragment = fragment;
powder = powder;
disc = disc;
}
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;
}
................................................................................
sorcery.data.metallookup[fragment] = {
id = name; data = metal;
value = 1;
}
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();
groups = { metal = 1; sorcery_screw = 1; sorcery_tech_component = 1; };
_sorcery = {
material = {
id = name, data = metal;
powder = powder;
grindcost = 2, grindvalue = 1;
value = 0.5;
};
};
})
minetest.register_craftitem(disc, {
description = sorcery.lib.str.capitalize(name) .. ' Disc';
inventory_image = sorcery.lib.image('sorcery_disc.png'):multiply(sorcery.lib.color(metal.tone)):render();
groups = { metal = 1; sorcery_disc = 1; sorcery_tech_component = 1; };
_sorcery = {
material = {
id = name, data = metal;
powder = powder;
grindvalue = (3*4) / 2;
value = 4 * (2/3);
};
};
})
local reglathe = function(ty, sz)
sorcery.lathe.register {
input = ty;
output = {name = screw, count = sz * 2};
tech = 'cut', cost = 1;
}
end
reglathe(fragment, 1)
reglathe(ingot, 4)
reglathe(block, 4 * 9)
sorcery.lathe.register {
input = ingot, mass = 2;
output = {name = disc, count = 3};
tech = 'cut', cost = 5;
}
sorcery.lathe.register {
input = block;
output = {name = disc, count = 8*3};
leftover = ingot;
tech = 'cut', cost = 5*7;
}
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';
|