1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
...
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
|
--- gemstones
local shards_per_gem = 9
local 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'
sorcery.data.gems[name].parts = {
item = itemname;
shard = shardname;
amulet = amuletname;
}
................................................................................
};
};
})
end
gem.durability = gem.durability or (gem.hardness or 1) * 100
if not gem.foreign_amulet then
local img = sorcery.lib.image
local img_stone = img('sorcery_amulet.png'):multiply(sorcery.lib.color(gem.tone))
local img_sparkle = img('sorcery_amulet_sparkle.png')
local useamulet = function(stack,user,target)
local sp = sorcery.amulet.getspell(stack)
if not sp or not sp.cast then return nil end
local usedamulet if stack:get_count() == 1 then
usedamulet = stack
else
................................................................................
if leftover and leftover:get_count() > 0 then
minetest.add_item(user:get_pos(), leftover)
end
end
return stack
end
end;
minetest.register_craftitem(amuletname, {
description = sorcery.lib.str.capitalize(name) .. ' amulet';
inventory_image = img_sparkle:blit(img_stone):render();
wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
groups = { sorcery_amulet = 1 };
on_use = useamulet;
_sorcery = {
material = {
gem = true, id = name, data = gem;
value = (5 * shards_per_gem) + 4;
};
amulet = { base = name };
};
})
sorcery.lathe.register {
input = itemname;
output = amuletname;
tech = 'intaglio';
cost = 1;
}
sorcery.register.metals.foreach('sorcery:mk-amulet-frames-'..name,{'sorcery:generate'}, function(metalid,metal)
if not metal.amulet then return end
local framedid = string.format("%s_frame_%s", amuletname, metalid)
local img_frame = img(string.format('sorcery_amulet_frame_%s.png',metalid))
minetest.register_craftitem(framedid, {
description = string.format("%s-framed %s amulet",sorcery.lib.str.capitalize(metalid), name);
inventory_image = img_sparkle:blit(img_frame):blit(img_stone):render();
wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
groups = { sorcery_amulet = 1 };
on_use = useamulet;
_sorcery = {
amulet = { base = name, frame = metalid };
};
})
|
>
>
|
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
|
<
<
|
<
>
>
<
>
|
|
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
...
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
|
--- gemstones
local shards_per_gem = 9
local 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 polishedname = gem.foreign_polished or 'sorcery:gem_' .. name .. '_polished'
sorcery.data.gems[name].parts = {
item = itemname;
shard = shardname;
amulet = amuletname;
}
................................................................................
};
};
})
end
gem.durability = gem.durability or (gem.hardness or 1) * 100
if not gem.foreign_amulet then
local img = sorcery.lib.image
local colorized_stone = function(file)
return img(file):multiply(sorcery.lib.color(gem.tone:brighten(1.1)))
end
local img_stone = colorized_stone('sorcery_amulet.png')
local img_stone_tiny = colorized_stone('sorcery_amulet_embedded.png')
local img_sparkle = img('sorcery_amulet_sparkle.png')
local img_necklace = img('sorcery_amulet_necklace.png')
local useamulet = function(stack,user,target)
local sp = sorcery.amulet.getspell(stack)
if not sp or not sp.cast then return nil end
local usedamulet if stack:get_count() == 1 then
usedamulet = stack
else
................................................................................
if leftover and leftover:get_count() > 0 then
minetest.add_item(user:get_pos(), leftover)
end
end
return stack
end
end;
local stonematprops = {
gem = true, id = name, data = gem;
value = (5 * shards_per_gem) + 4;
};
minetest.register_craftitem(amuletname, {
description = sorcery.lib.str.capitalize(name) .. ' amulet';
inventory_image = img_sparkle:blit(img_stone):blit(img_necklace):render();
wield_image = img_sparkle:blit(img_stone):render();
wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
groups = { sorcery_amulet = 1 };
on_use = useamulet;
_sorcery = { material = stonematprops, amulet = { base=name }};
})
minetest.register_craftitem(polishedname, {
description = 'Polished ' .. name;
inventory_image = img_sparkle:blit(img_stone):render();
wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
_sorcery = { material = stonematprops };
})
minetest.register_craft {
output = amuletname;
type = 'shapeless';
recipe = {
polishedname;
'basic_materials:silver_wire';
};
replacements = {
{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
};
}
sorcery.lathe.register {
input = itemname;
output = polishedname;
tech = 'intaglio';
cost = 1;
}
sorcery.register.metals.foreach('sorcery:mk-amulet-frames-'..name,{'sorcery:generate'}, function(metalid,metal)
if not metal.amulet then return end
local framedid = string.format("%s_frame_%s", amuletname, metalid)
local img_frame = img(string.format('sorcery_amulet_frame_%s.png',metalid))
minetest.register_craftitem(framedid, {
description = string.format("%s-framed %s amulet",sorcery.lib.str.capitalize(metalid), name);
inventory_image = img_stone_tiny:blit(img_frame):blit(img_necklace):render();
wield_image = img_stone_tiny:blit(img_frame):render();
wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
groups = { sorcery_amulet = 1 };
on_use = useamulet;
_sorcery = {
amulet = { base = name, frame = metalid };
};
})
|