494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
...
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
|
end
end
-- handle editing request
local rpp = sorcery.cookbook.constants.recipes_per_cookbook_page
if p.mode then for idx=1,rpp do
if fields['recipe_' .. tostring(idx)] then
local recnr = (bm:get_int('pagenr')-1)*rpp + idx
local rec = book.pages[recnr]
local bookchanged = false
if p.mode == 'delete' then
p.operstack:take_item(1)
table.remove(book.pages,recnr)
bookchanged = true
elseif p.mode == 'copy' and
................................................................................
name = rm:get_string('recipe_name');
})
-- insertion can operate in one of two modes: copying
-- the recipe into the book, or inserting the paper
-- directly. if there is no ink available, we use the
-- latter mode. in effect, this means deleting the
-- recipe item is insufficient ink is available.
if charge_ink(constants.op_cost_insert_rec) == false then
p.operstack = ItemStack(nil)
end
bookchanged = true
elseif p.mode == 'cut' then
local spr = p.operstack:get_definition()._sorcery
local sch = (spr and spr.material and spr.material.data.hardness) or 2
local suses = sch * constants.cuts_per_scissor_hardness
|
|
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
...
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
|
end
end
-- handle editing request
local rpp = sorcery.cookbook.constants.recipes_per_cookbook_page
if p.mode then for idx=1,rpp do
if fields['recipe_' .. tostring(idx)] then
local pg = math.max(1, bm:get_int 'pagenr') -- handle unset page
local recnr = (pg-1)*rpp + idx
local rec = book.pages[recnr]
local bookchanged = false
if p.mode == 'delete' then
p.operstack:take_item(1)
table.remove(book.pages,recnr)
bookchanged = true
elseif p.mode == 'copy' and
................................................................................
name = rm:get_string('recipe_name');
})
-- insertion can operate in one of two modes: copying
-- the recipe into the book, or inserting the paper
-- directly. if there is no ink available, we use the
-- latter mode. in effect, this means deleting the
-- recipe item is insufficient ink is available.
if (not p.has_pen) or charge_ink(constants.op_cost_insert_rec) == false then
p.operstack = ItemStack(nil)
end
bookchanged = true
elseif p.mode == 'cut' then
local spr = p.operstack:get_definition()._sorcery
local sch = (spr and spr.material and spr.material.data.hardness) or 2
local suses = sch * constants.cuts_per_scissor_hardness
|