Compare commits
2 commits
038b1b739c
...
23c8afe8ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23c8afe8ee | ||
|
|
ed4f44fc9d |
1 changed files with 1 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ local SLEEP_T = 10
|
|||
function remove_waste(source, discard_rest)
|
||||
local amounts_to_keep = KEEP_ONLY
|
||||
local discard = function (item, amt, dest)
|
||||
peripheral.call(source, "requestFiltered", dest
|
||||
peripheral.call(source, "requestFiltered", dest,
|
||||
{
|
||||
name = item.name,
|
||||
_requestCount = amt,
|
||||
|
|
@ -29,10 +29,7 @@ function remove_waste(source, discard_rest)
|
|||
if amounts_to_keep[item.name] ~= nil then
|
||||
local excess = item.count - amounts_to_keep[item.name][1]
|
||||
if excess > 0 then
|
||||
amounts_to_keep[item.name][1] = 0
|
||||
discard(item, excess, amounts_to_keep[item.name][2])
|
||||
else
|
||||
amounts_to_keep[item.name][1] = -excess
|
||||
end
|
||||
elseif DISCARD_REST then
|
||||
discard(item, amt, DISCARD_ADDR)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue