Differences From
Artifact [fe2bed6abe]:
82 82 end
83 83 return names[math.random(#names)]
84 84 end end
85 85 local find_builtin = function(method,kind)
86 86 return function(out)
87 87 local rec = {}
88 88 local crec = sorcery.lib.tbl.walk(minetest.registered_items[out],{'_sorcery','recipe','canonical',kind})
89 - local w=0, lst
89 + local w, lst = 0
90 90 if crec then
91 91 lst = {}
92 92 for i,v in pairs(crec) do
93 93 if #v > w then w = #v end
94 94 for j,n in pairs(v) do
95 95 lst[#lst+1] = n
96 96 end
................................................................................
108 108 w = (i.width == 0) and 3 or i.width
109 109 lst = i.items
110 110 end
111 111 -- for j=1,#i.items do
112 112 for j,item in pairs(lst) do
113 113 local row = math.floor((j-1) / w)
114 114 local col = (j-1) % w
115 - if item then
116 - rec[1 + (row * 3) + col] = item
117 - end
115 + if item then rec[1 + (row * 3) + col] = item end
118 116 end
119 117 return rec
120 118 end
121 119 end
122 120 local function group_eval(i)
123 121 if string.sub(i,1,6) == 'group:' then
124 122 local g = string.sub(i,7)
................................................................................
218 216 chance = 4;
219 217 slots = {
220 218 {0,0};
221 219 {0,1};
222 220 };
223 221 pick = function(restrict)
224 222 -- TODO make sure affinity restrictions match
225 - return sorcery.data.infusions[math.random(#sorcery.data.infusions)].output
223 + return sorcery.register.infusions.db[math.random(#sorcery.register.infusions.db)].output
226 224 end;
227 225 title = function(output)
228 - for _,i in pairs(sorcery.data.infusions) do
226 + for _,i in pairs(sorcery.register.infusions.db) do
229 227 if i.output == output then
230 228 if i._proto and i._proto.name
231 229 then return i._proto.name
232 230 else break end
233 231 end
234 232 end
235 233 return 'Mysterious Potion'
236 234 end;
237 235 find = function(out)
238 - for _,i in pairs(sorcery.data.infusions) do
236 + for _,i in pairs(sorcery.register.infusions.db) do
239 237 if i.output == out then
240 238 return { i.infuse, i.into }
241 239 end
242 240 end
243 241 end;
244 242 props = function(out)
245 - for _,i in pairs(sorcery.data.infusions) do
243 + for _,i in pairs(sorcery.register.infusions.db) do
246 244 if i.output == out then
247 245 if i.recipe then return i.recipe else return {} end
248 246 end
249 247 end
250 248 end;
251 249 };
252 250 grind = {