Compare commits
No commits in common. "23c8afe8ee8fe9f73cf10c4eecd2778b72d5fc05" and "038b1b739cbc8107b5eba74c9a96484db2685ac0" have entirely different histories.
23c8afe8ee
...
038b1b739c
1 changed files with 4 additions and 1 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,7 +29,10 @@ 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