|
|
|
@ -69,11 +69,12 @@ end
|
|
|
|
|
---@return boolean
|
|
|
|
|
local function confirm()
|
|
|
|
|
while true do
|
|
|
|
|
print("Proceed? [y/n]")
|
|
|
|
|
-- local _, _, ascii, _, _ = term.pull("key_down")
|
|
|
|
|
-- local ch = string.char(ascii)
|
|
|
|
|
print("Proceed? [Y/n]")
|
|
|
|
|
local ch = io.read()
|
|
|
|
|
if ch == 'y' then
|
|
|
|
|
if not ch then
|
|
|
|
|
return false -- interrupted
|
|
|
|
|
end
|
|
|
|
|
if ch == 'y' or ch == 'Y' or ch == '' then
|
|
|
|
|
return true
|
|
|
|
|
elseif ch == 'n' then
|
|
|
|
|
return false
|
|
|
|
@ -369,6 +370,7 @@ local function craft_item(search)
|
|
|
|
|
selected = matches[index]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
clear_crafting_space()
|
|
|
|
|
|
|
|
|
|
local recipe = recipes[selected]
|
|
|
|
|
|
|
|
|
@ -405,17 +407,15 @@ local function craft_item(search)
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
print('\nCrafting in order:')
|
|
|
|
|
for i, rec in ipairs(crafting_order) do
|
|
|
|
|
print(i, rec.result)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if not confirm() then
|
|
|
|
|
print('Operation cancelled')
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
-- print('\nCrafting in order:')
|
|
|
|
|
-- for i, rec in ipairs(crafting_order) do
|
|
|
|
|
-- print(i, rec.result)
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
clear_crafting_space()
|
|
|
|
|
-- if not confirm() then
|
|
|
|
|
-- print('Operation cancelled')
|
|
|
|
|
-- return false
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
-- proceed to crafting the things
|
|
|
|
|
for i, rec in ipairs(crafting_order) do
|
|
|
|
|