From 96ff36fc198c964196e3aea1c3c5ee16fc3bafd1 Mon Sep 17 00:00:00 2001 From: dopik <33575686+dopik@users.noreply.github.com> Date: Thu, 17 Jan 2019 21:53:44 +0100 Subject: [PATCH 1/2] Fix 2 Bug in Craft 1) Missing sanity checks for amount 2) Increase amount of output when using amount --- commands.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands.lua b/commands.lua index 36c777a..c9cb421 100644 --- a/commands.lua +++ b/commands.lua @@ -757,7 +757,7 @@ basic_robot.commands.keyboard = { basic_robot.commands.craftcache = {}; basic_robot.commands.craft = function(item, mode, idx,amount, name) - amount = amount and tonumber(amount) or 1; + amount = amount and math.floor(tonumber(amount)) or 1; if amount<0 then amount = 1 end if not item then return false end @@ -832,7 +832,9 @@ basic_robot.commands.craft = function(item, mode, idx,amount, name) inv:remove_item("main",stack); end - inv:add_item("main",ItemStack(output)) + output = ItemStack(output) + output:set_count(output:get_count() * amount) + inv:add_item("main",output) return true end From 571abd4bf0ca40a82fa37138406afd3cd519d765 Mon Sep 17 00:00:00 2001 From: dopik <33575686+dopik@users.noreply.github.com> Date: Fri, 18 Jan 2019 19:04:55 +0100 Subject: [PATCH 2/2] Update robogui.lua --- robogui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robogui.lua b/robogui.lua index 6d802c7..208783c 100644 --- a/robogui.lua +++ b/robogui.lua @@ -171,7 +171,7 @@ local help_pages = { " activate.direction(mode) activates target block", " pickup(r) picks up all items around robot in radius r<8 and returns list", " or nil", - " craft(item,idx,mode) crafts item if required materials are present in", + " craft(item,idx,mode,amount) crafts item if required materials are present in", " inventory, mode = 1 returns recipe, optional recipe idx", " take.direction(item, inventory) takes item from target inventory into", " robot inventory",