fix: reworks make_order
Trying to make it recursive broke it
This commit is contained in:
parent
c3e20db2c5
commit
9fe8b3f78c
1 changed files with 8 additions and 10 deletions
|
|
@ -57,7 +57,6 @@ local order = {
|
|||
end,
|
||||
biofuel = function (amt, ticker)
|
||||
-- TODO
|
||||
amt = math.floor(amt / 125)
|
||||
local request = function ()
|
||||
local biomass = {
|
||||
name = "createaddition:biomass",
|
||||
|
|
@ -90,16 +89,15 @@ local order = {
|
|||
end
|
||||
return enough_materials
|
||||
end
|
||||
local make_order = function (amt_to_make, amt_made)
|
||||
if amt_to_make <= 0 then return amt_made end
|
||||
if not enoughMaterials() then return amt_made end
|
||||
local count = ticker.requestFiltered(BIOFUEL_PKG, request())
|
||||
if count == 0 then return amt_made end
|
||||
amt_to_make = amt_to_make - count
|
||||
amt_made = amt_made + count
|
||||
return make_order (amt_to_make, amt_made)
|
||||
|
||||
local amt_made = 0
|
||||
while amt_made < amt do
|
||||
if not enoughMaterials() then break end
|
||||
ticker.requestFiltered(BIOFUEL_PKG, request())
|
||||
amt_made = amt_made + 2000
|
||||
os.sleep(1)
|
||||
end
|
||||
return make_order (amt, 0)
|
||||
return amt_made
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue