sorcery  Diff

Differences From Artifact [9b1dfc7187]:

To Artifact [0d89fbd301]:


448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
...
522
523
524
525
526
527
528




529





530
531
532
533
534
535
536
			end
			if not ctx.target or ctx.target.type ~= 'node' then return false end
			local tgt = minetest.get_node(ctx.target.under)
			if tgt.name == 'sorcery:enchanter' then
				local meta = minetest.get_meta(ctx.target.under)
				local inv = meta:get_inventory()
				if inv:get_stack('item',1):get_name() == 'default:paper'
					and inv:get_stack('item',1):get_count() == 1
					and not inv:is_empty('foci') then
				   local ink1 = getcolor(inv:get_stack('foci',2))
				   local ink2 = getcolor(inv:get_stack('foci',3))
				   local restrict, kind, mod = {} do
					   local ms = inv:get_stack('foci',1)
					   if not ms:is_empty() then mod = ms:get_name() end
				   end
................................................................................
					   local rec = ItemStack('sorcery:recipe')
					   local m = rec:get_meta()
					   if ctx.base.gem == 'diamond' then
						   -- make recipe for thing in slot 1
					   else
						   sorcery.cookbook.setrecipe(rec,kind,nil,restrict)
					   end




					   inv:set_stack('item',1,rec)





					   for i=1,inv:get_size('foci') do
						   local f = inv:get_stack('foci',i)
						   f:take_item(1)
						   inv:set_stack('foci',i,f)
					   end
					   enchantment_sparkle(ctx,sorcery.lib.color(97,97,255))
					   return







|







 







>
>
>
>
|
>
>
>
>
>







448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
...
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
			end
			if not ctx.target or ctx.target.type ~= 'node' then return false end
			local tgt = minetest.get_node(ctx.target.under)
			if tgt.name == 'sorcery:enchanter' then
				local meta = minetest.get_meta(ctx.target.under)
				local inv = meta:get_inventory()
				if inv:get_stack('item',1):get_name() == 'default:paper'
					-- and inv:get_stack('item',1):get_count() == 1
					and not inv:is_empty('foci') then
				   local ink1 = getcolor(inv:get_stack('foci',2))
				   local ink2 = getcolor(inv:get_stack('foci',3))
				   local restrict, kind, mod = {} do
					   local ms = inv:get_stack('foci',1)
					   if not ms:is_empty() then mod = ms:get_name() end
				   end
................................................................................
					   local rec = ItemStack('sorcery:recipe')
					   local m = rec:get_meta()
					   if ctx.base.gem == 'diamond' then
						   -- make recipe for thing in slot 1
					   else
						   sorcery.cookbook.setrecipe(rec,kind,nil,restrict)
					   end
					   local old = inv:get_stack('item',1)
					   -- TODO: detect hopper underneath and place
					   -- recipe into it instead of item slot
					   if old:get_count() == 1 then
						   inv:set_stack('item',1,rec)
					   else
						   old:take_item(1)
						   inv:set_stack('item',1,old)
						   minetest.add_item(ctx.target.above,rec)
					   end
					   for i=1,inv:get_size('foci') do
						   local f = inv:get_stack('foci',i)
						   f:take_item(1)
						   inv:set_stack('foci',i,f)
					   end
					   enchantment_sparkle(ctx,sorcery.lib.color(97,97,255))
					   return