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
|
--- gemstones
sorcery.register_gem = function(name,gem)
local itemname = gem.foreign or 'sorcery:gem_' .. name
local shardname = gem.foreign_shard or 'sorcery:gem_' .. name .. '_shard'
local amuletname = gem.foreign_amulet or 'sorcery:gem_' .. name .. '_amulet'
local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors
if gem.tools then for _,t in pairs(tools) do
sorcery.matreg.lookup[(gem.items and gem.items[t]) or ('sorcery:' .. t .. '_' .. name)] = {
gem = true;
id = name; data = gem;
}
end end
if gem.armor then for _,a in pairs(armors) do
sorcery.matreg.lookup[(gem.items and gem.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
gem = true;
id = name; data = gem;
}
end end
if gem.foreign_shard then
minetest.clear_craft {output=shardname}
else
minetest.register_craftitem(shardname, {
|
|
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
|
--- gemstones
local shards_per_gem = 9
sorcery.register_gem = function(name,gem)
local itemname = gem.foreign or 'sorcery:gem_' .. name
local shardname = gem.foreign_shard or 'sorcery:gem_' .. name .. '_shard'
local amuletname = gem.foreign_amulet or 'sorcery:gem_' .. name .. '_amulet'
local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors
if gem.tools then for t,c in pairs(tools) do
sorcery.matreg.lookup[(gem.items and gem.items[t]) or ('sorcery:' .. t .. '_' .. name)] = {
gem = true;
id = name; data = gem;
value = c.cost*shards_per_gem;
}
end end
if gem.armor then for a,c in pairs(armors) do
sorcery.matreg.lookup[(gem.items and gem.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
gem = true;
id = name; data = gem;
value = c.cost*shards_per_gem;
}
end end
if gem.foreign_shard then
minetest.clear_craft {output=shardname}
else
minetest.register_craftitem(shardname, {
|