sorcery  Diff

Differences From Artifact [fe2bed6abe]:

To Artifact [604c53eb6c]:


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







|







 







<
|
<







 







|


|









|






|







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
108
109
110
111
112
113
114

115

116
117
118
119
120
121
122
...
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	end
	return names[math.random(#names)]
end end
local find_builtin = function(method,kind)
	return function(out)
		local rec = {}
		local crec = sorcery.lib.tbl.walk(minetest.registered_items[out],{'_sorcery','recipe','canonical',kind})
		local w, lst = 0
		if crec then
			lst = {}
			for i,v in pairs(crec) do
				if #v > w then w = #v end
				for j,n in pairs(v) do
					lst[#lst+1] = n
				end
................................................................................
			w = (i.width == 0) and 3 or i.width
			lst = i.items
		end
		-- for j=1,#i.items do
		for j,item in pairs(lst) do
			local row = math.floor((j-1) / w)
			local col = (j-1) % w

			if item then rec[1 + (row * 3) + col] = item end

		end
		return rec
	end
end
local function group_eval(i)
	if string.sub(i,1,6) == 'group:' then
		local g = string.sub(i,7)
................................................................................
		chance = 4;
		slots = {
			{0,0};
			{0,1};
		};
		pick = function(restrict)
			-- TODO make sure affinity restrictions match
			return sorcery.register.infusions.db[math.random(#sorcery.register.infusions.db)].output
		end;
		title = function(output)
			for _,i in pairs(sorcery.register.infusions.db) do
				if i.output == output then
					if i._proto and i._proto.name
						then return i._proto.name
						else break end
				end
			end
			return 'Mysterious Potion'
		end;
		find = function(out)
			for _,i in pairs(sorcery.register.infusions.db) do
				if i.output == out then
					return { i.infuse, i.into }
				end
			end
		end;
		props = function(out)
			for _,i in pairs(sorcery.register.infusions.db) do
				if i.output == out then
					if i.recipe then return i.recipe else return {} end
				end
			end
		end;
	};
	grind = {