diff --git a/compacting-storage.lua b/compacting-storage.lua index 8d89f3b..2d60707 100644 --- a/compacting-storage.lua +++ b/compacting-storage.lua @@ -10,7 +10,7 @@ local INVENTORY = "left" local SLEEP_TIME = 30 local AMOUNT_USED = 63 -- the amount of item used per request local AMOUNT_RETURNED = 7 -- the amount of item returned per request -local REDUCTION_FACTOR = 0.5 -- when draining, what percent to do at a time +local REDUCTION_FACTOR = 0.75 -- when draining, what percent to do at a time local ITEM_TYPES = { "iron", "copper", "zinc", "gold", "electrum" } local PRIORITY = { "ingot", "block", "nugget" } @@ -32,7 +32,7 @@ for _, type in ipairs(ITEM_TYPES) do limits[type] = { nugget = { stacks(4), stacks(8) }, ingot = { stacks(4), stacks(8) }, - block = { stacks(4), stacks(1000) } + block = { stacks(1), stacks(1000) } } end @@ -64,7 +64,7 @@ end -- basic actions function request (item_type, conversion_type) target[item_type].setOutput(convert[conversion_type], true) - os.sleep(0.05) + os.sleep(0.1) target[item_type].setOutput(convert[conversion_type], false) end @@ -147,7 +147,7 @@ function should_fill (type, counts) else amount_to_use = amount_spare end - return fill_dest, fill_src, amount_to_use + return fill_dest, fill_src, amount_to_use * REDUCTION_FACTOR end function decide_action (type, counts) @@ -155,7 +155,7 @@ function decide_action (type, counts) local drain_form, drain_amt = should_drain(type, counts) local fill_dest, fill_src, fill_amt = should_fill(type, counts) if drain_form ~= nil then - drain(type, form, drain_amt) + drain(type, drain_form, drain_amt) elseif fill_dest ~= nil and fill_src ~= nil then fill(type, fill_src, fill_dest, fill_amt) end