49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
...
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
...
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
|
local props = minetest.registered_items[item]._sorcery
if props and props.recipe then
return props.recipe
end
return {}
end
local modofname = function(id)
local sep = string.find(id,':')
if sep == nil then return nil end -- uh oh
return string.sub(id, 1, sep - 1)
end
local item_restrict_eval = function(name, restrict)
for _,n in pairs(constants.exclude_names) do
if string.find(name,n) ~= nil then
return false
end
end
................................................................................
end
end;
};
grind = {
name = 'Milling Guide';
node = 'sorcery:mill';
booksuf = 'Manual';
chance = 1;
w = 1, h = 2;
pick = function(restrict)
cache:populate_grindables()
if restrict then
local t = {}
for _, i in pairs(cache.grindables) do
local pd = sorcery.itemclass.get(i, 'grindable')
................................................................................
end
end
return {v,''} -- !!
end
end
end;
};
-- wand = {
-- booksuf = 'Grimoire';
-- }
enchant = {
name = 'Enchantment Matrix';
node = 'sorcery:enchanter';
booksuf = 'Grimoire';
drawslots = false;
chance = 6;
w = 2, h = 2;
pick = function(restrict)
-- TODO make sure affinity restrictions match
local names = {}
for k,v in pairs(sorcery.data.enchants) do
if v.recipe then names[#names+1] = k end
end
................................................................................
local props = k.props(result)
for i=1,#k.slots do
local ing = ingredients[i]
local x, y = k.slots[i][1], k.slots[i][2]
if ing and ing ~= '' then
local tt
if k.indesc then tt = k.indesc(ing) else tt = desc_builtin(ing) end
t = t .. string.format([[
item_image[%f,%f;1,1;%s]
tooltip[%f,%f;1,1;%s]
]], x,y, minetest.formspec_escape(group_eval(ing)),
x,y, minetest.formspec_escape(tt))
else
if k.drawslots == nil or k.drawslots then
t = string.format('box[%f,%f;0.1,0.1;#00000060]',x+0.45,y+0.45) .. t
end
end
end
|
>
>
|
|
|
>
>
|
<
<
<
|
>
>
>
>
>
|
|
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
...
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
...
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
...
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
local props = minetest.registered_items[item]._sorcery
if props and props.recipe then
return props.recipe
end
return {}
end
local modofname = function(id)
local item = minetest.registered_nodes[id]
if item == nil or item.mod_origin == '??' or not item.mod_origin then
local sep = string.find(id,':')
if sep == nil then return nil end -- uh oh
return string.sub(id, 1, sep - 1)
end
return item.mod_origin
end
local item_restrict_eval = function(name, restrict)
for _,n in pairs(constants.exclude_names) do
if string.find(name,n) ~= nil then
return false
end
end
................................................................................
end
end;
};
grind = {
name = 'Milling Guide';
node = 'sorcery:mill';
booksuf = 'Manual';
chance = 4;
w = 1, h = 2;
pick = function(restrict)
cache:populate_grindables()
if restrict then
local t = {}
for _, i in pairs(cache.grindables) do
local pd = sorcery.itemclass.get(i, 'grindable')
................................................................................
end
end
return {v,''} -- !!
end
end
end;
};
enchant = {
name = 'Enchantment Matrix';
node = 'sorcery:enchanter';
booksuf = 'Grimoire';
drawslots = false;
chance = 4;
w = 2, h = 2;
pick = function(restrict)
-- TODO make sure affinity restrictions match
local names = {}
for k,v in pairs(sorcery.data.enchants) do
if v.recipe then names[#names+1] = k end
end
................................................................................
local props = k.props(result)
for i=1,#k.slots do
local ing = ingredients[i]
local x, y = k.slots[i][1], k.slots[i][2]
if ing and ing ~= '' then
local tt
if k.indesc then tt = k.indesc(ing) else tt = desc_builtin(ing) end
local overlay = ''
if minetest.get_item_group(ing, 'sorcery_extract') ~= 0 then
overlay = string.format('item_image[%f,%f;0.6,0.6;%s]', x+0.5, y+0.5, ing)
ing = minetest.registered_nodes[ing]._sorcery.extract.of
end
t = t .. string.format([[
item_image[%f,%f;1,1;%s]%s
tooltip[%f,%f;1,1;%s]
]], x,y, minetest.formspec_escape(group_eval(ing)), overlay,
x,y, minetest.formspec_escape(tt))
else
if k.drawslots == nil or k.drawslots then
t = string.format('box[%f,%f;0.1,0.1;#00000060]',x+0.45,y+0.45) .. t
end
end
end
|