Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local param = ...
- dofile("bs/apis/wrapper")
- --initialization
- local args = bs.params.load("bs/files/furnace_sender_params")
- local hook = bs.rdnt.hook:new()
- hook.port = args.port
- hook.socketID = args.socketID
- hook:connect(1)
- if param == "connect" then
- args.socketID = nil
- end
- --methods and classes
- local function setParams()
- args.socketID = hook.socketID
- local stable = {}
- ui.clear()
- stable.port = ui.getInput("Which name should this connection have?")
- args.port = stable.port
- hook.port = stable.port
- ui.clear()
- stable.count = ui.getInput("How many furnaces are setup?", true)
- args.count = stable.count
- ui.clear()
- stable.inputc = ui.getInput("Name of the Input chest?")
- args.inputc = stable.inputc
- ui.clear()
- stable.outputc = ui.getInput("Name of the chest in front of the turtle?")
- args.outputc = stable.outputc
- ui.clear()
- hook:request("setParams", stable)
- bs.params.save("bs/files/furnace_sender_params", args)
- end
- local function getTask()
- local ichest = peripheral.wrap(args.inputc)
- local function getCount()
- local count = 0
- local list = ichest.list()
- for I = 1, ichest.size do
- if list[I] ~= nil then
- count = count + list[I].count
- end
- end
- return count
- end
- local function refreshText()
- while true do
- ui.clear()
- print(getCount().." items are in the chest, do you want to smelt them?\n\n -Press enter to confirm-")
- os.sleep(1)
- end
- end
- local function waitinput()
- repeat
- local _, key = os.pullEvent("key")
- until key == keys.enter
- end
- parallel.waitForAny(refreshText, waitinput)
- local fcount = getCount()
- ui.clear()
- print("I will need "..fcount / 8.." coal to smelt this\n")
- print("or ".. fcount/ 1.5.." wooden planks\n")
- end
- --program start
- if args.socketID == nil or args.port == nil then
- hook.port = "autofurnace"
- hook:connect()
- setParams()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement