sorcery  Diff

Differences From Artifact [4b9992727f]:

To Artifact [1bf06d7139]:


707
708
709
710
711
712
713

714
715
716
717


718
719
720
721
722
723
724
	local stack = uinv:get_stack('main', idx)
	local book = bookprops(stack)
	local meta = stack:get_meta()

	local curpage = meta:contains("pagenr") and meta:get_int("pagenr") or 1
	local pagect = math.ceil(#book.pages / constants.recipes_per_cookbook_page)


	if curpage > 1 and fields.pageback then
		meta:set_int('pagenr', curpage - 1)
	elseif curpage < pagect and fields.pagenext then
		meta:set_int('pagenr', curpage + 1)


	end

	uinv:set_stack('main',idx,stack)
	bookform(stack,user)
end)

minetest.register_on_craft(function(stack,player,grid,inv)







>
|
|
|
|
>
>







707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
	local stack = uinv:get_stack('main', idx)
	local book = bookprops(stack)
	local meta = stack:get_meta()

	local curpage = meta:contains("pagenr") and meta:get_int("pagenr") or 1
	local pagect = math.ceil(#book.pages / constants.recipes_per_cookbook_page)

	if fields.pageback or fields.pagenext then
		if curpage > 1 and fields.pageback then
			meta:set_int('pagenr', curpage - 1)
		elseif curpage < pagect and fields.pagenext then
			meta:set_int('pagenr', curpage + 1)
		end
		minetest.sound_play('sorcery_pgturn', { pos = pos, gain = 0.6 })
	end

	uinv:set_stack('main',idx,stack)
	bookform(stack,user)
end)

minetest.register_on_craft(function(stack,player,grid,inv)