sorcery  Diff

Differences From Artifact [8701b2357d]:

To Artifact [b1bce87867]:


35
36
37
38
39
40
41
42



43
44
45
46
47






48
49
50
51
52
53
54
	local ink = i:get_stack('ink',1)
	local pen = i:get_stack('pen',1)

	local ink_count = ink:get_count()
	
	local maxrecs = math.min(ink_count, paper:get_count(), item:get_count())
	if pen:is_empty() then maxrecs = 0 end




	if maxrecs > 0 and sorcery.cookbook.classes.craft.find(item:get_name()) then
		local rec = ItemStack{name = 'sorcery:recipe', count = maxrecs}
		sorcery.cookbook.setrecipe(rec, 'craft', item:get_name())
		i:set_stack('output',1,rec)
	else






		i:set_stack('output',1,ItemStack())
	end
	disassembler_formspec(pos)
end
local dsbox = {
	type = 'fixed';
	fixed = {







<
>
>
>
|
|
|
|
<
>
>
>
>
>
>







35
36
37
38
39
40
41

42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59
60
61
	local ink = i:get_stack('ink',1)
	local pen = i:get_stack('pen',1)

	local ink_count = ink:get_count()
	
	local maxrecs = math.min(ink_count, paper:get_count(), item:get_count())
	if pen:is_empty() then maxrecs = 0 end

	local found = false
	if maxrecs > 0 then
		for _, meth in pairs {'craft','lathe','grind'} do
			if sorcery.cookbook.classes[meth].find(item:get_name()) then
				local rec = ItemStack{name = 'sorcery:recipe', count = maxrecs}
				sorcery.cookbook.setrecipe(rec, meth, item:get_name())
				i:set_stack('output',1,rec)

				found = true
				break
			end
		end
	end
	if not found then
		i:set_stack('output',1,ItemStack())
	end
	disassembler_formspec(pos)
end
local dsbox = {
	type = 'fixed';
	fixed = {