feat: removes stocking storage from requirements
This commit is contained in:
parent
0be62dbccc
commit
1be1a52a77
1 changed files with 4 additions and 17 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
-- program to manage a biofuel factory with create and some addons + tweaks
|
-- program to manage a biofuel factory with create and some addons + tweaks
|
||||||
-- NOTE: this design does not handle stocking cinder flour or sugar
|
-- NOTE: this design does not handle stocking the system
|
||||||
|
|
||||||
local STORAGE = ""
|
local STORAGE = ""
|
||||||
local OIL_TANK = ""
|
local OIL_TANK = ""
|
||||||
|
|
@ -7,11 +7,7 @@ local FUEL_TANK = ""
|
||||||
|
|
||||||
local FACTORY_ADDRESS = ""
|
local FACTORY_ADDRESS = ""
|
||||||
|
|
||||||
local MAIN_SEED_REQUEST = "minecraft:melon_seeds"
|
|
||||||
local MAIN_PLANT_REQUEST = "minecraft:bamboo"
|
|
||||||
|
|
||||||
local SPEEDOMETER = ""
|
local SPEEDOMETER = ""
|
||||||
local MAIN_REQUESTER = ""
|
|
||||||
local SUBNET_TICKER = ""
|
local SUBNET_TICKER = ""
|
||||||
|
|
||||||
local SLEEP_T = 10
|
local SLEEP_T = 10
|
||||||
|
|
@ -114,36 +110,27 @@ local stock = {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStockRequirements ()
|
|
||||||
-- TODO
|
|
||||||
end
|
|
||||||
|
|
||||||
function getOrders ()
|
function getOrders ()
|
||||||
-- TODO
|
-- TODO
|
||||||
end
|
end
|
||||||
|
|
||||||
function run (requester, ticker)
|
function run (ticker)
|
||||||
if peripheral.call(SPEEDOMETER, "getSpeed") ~= 0 then
|
if peripheral.call(SPEEDOMETER, "getSpeed") ~= 0 then
|
||||||
local need_to_stock = getStockRequirements()
|
|
||||||
local need_to_create = getOrders()
|
local need_to_create = getOrders()
|
||||||
for type, amt in pairs(need_to_stock) do
|
|
||||||
stock[type](amt, requester)
|
|
||||||
end
|
|
||||||
for type, amt in pairs(need_to_create) do
|
for type, amt in pairs(need_to_create) do
|
||||||
order[type](amt, ticker)
|
order[type](amt, ticker)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
os.sleep(SLEEP_T)
|
os.sleep(SLEEP_T)
|
||||||
return run(requester, ticker)
|
return run(ticker)
|
||||||
end
|
end
|
||||||
|
|
||||||
if arg ~= nil and arg[1] == "run" then
|
if arg ~= nil and arg[1] == "run" then
|
||||||
local requester = peripheral.wrap(MAIN_REQUESTER)
|
|
||||||
requester.setAddress(FACTORY_ADDRESS)
|
|
||||||
local ticker = peripheral.wrap(SUBNET_TICKER)
|
local ticker = peripheral.wrap(SUBNET_TICKER)
|
||||||
local ran = false
|
local ran = false
|
||||||
while not ran do
|
while not ran do
|
||||||
ran, result = run(ticker, requester)
|
ran, result = run(ticker)
|
||||||
if not ran then print(result) end
|
if not ran then print(result) end
|
||||||
os.sleep(SLEEP_T)
|
os.sleep(SLEEP_T)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue