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,
|
end,
|
||||||
biofuel = function (amt, ticker)
|
biofuel = function (amt, ticker)
|
||||||
-- TODO
|
-- TODO
|
||||||
amt = math.floor(amt / 125)
|
|
||||||
local request = function ()
|
local request = function ()
|
||||||
local biomass = {
|
local biomass = {
|
||||||
name = "createaddition:biomass",
|
name = "createaddition:biomass",
|
||||||
|
|
@ -90,16 +89,15 @@ local order = {
|
||||||
end
|
end
|
||||||
return enough_materials
|
return enough_materials
|
||||||
end
|
end
|
||||||
local make_order = function (amt_to_make, amt_made)
|
|
||||||
if amt_to_make <= 0 then return amt_made end
|
local amt_made = 0
|
||||||
if not enoughMaterials() then return amt_made end
|
while amt_made < amt do
|
||||||
local count = ticker.requestFiltered(BIOFUEL_PKG, request())
|
if not enoughMaterials() then break end
|
||||||
if count == 0 then return amt_made end
|
ticker.requestFiltered(BIOFUEL_PKG, request())
|
||||||
amt_to_make = amt_to_make - count
|
amt_made = amt_made + 2000
|
||||||
amt_made = amt_made + count
|
os.sleep(1)
|
||||||
return make_order (amt_to_make, amt_made)
|
|
||||||
end
|
end
|
||||||
return make_order (amt, 0)
|
return amt_made
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue