Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local sides = require("sides")
- tanksmelter = require("tanksmelter")
- button = require("buttonAPI")
- local event = require("event")
- local computer = require("computer")
- local term = require("term")
- local gpu = component.gpu
- local rs = component.redstone
- local colors = require("colors")
- local side = require("sides")
- local currentTankFluid = "Empty"
- local currentSmelterFluid = "Empty"
- function button.fillTable()
- button.setTable("Transfer 1 Block >>", SmelterToTank1, 10,40,6,11)
- button.setTable("Transfer All >>", SmelterToTank2, 10,40,13,18)
- button.setTable("<< Transfer 1 Block", TankToSmelter1, 45,75,6,11)
- button.setTable("<< Transfer All", TankToSmelter2, 45,75,13,18)
- button.setTable("Crash", test2, 40,48,15,20)
- button.screen()
- end
- function getClick()
- local _, _, x, y = event.pull(1,touch)
- if x == nil or y == nil then
- local h, w = gpu.getResolution()
- gpu.set(h, w, ".")
- gpu.set(h, w, " ")
- else
- button.checkxy(x,y)
- end
- end
- function SmelterToTank1()
- button.flash("Transfer 1 Block >>", 0.5)
- tanksmelter.transferToTank()
- end
- function SmelterToTank2()
- button.flash("Transfer All >>", 0.5)
- tanksmelter.transferToTank(9999999999999)
- end
- function TankToSmelter1()
- button.flash("<< Transfer 1 Block", 0.5)
- tanksmelter.transferToSmelter()
- end
- function TankToSmelter2()
- button.flash("<< Transfer All", 0.5)
- tanksmelter.transferToSmelter(9999999999999999)
- end
- function test2()
- crash()
- end
- button.fillTable()
- term.setCursorBlink(false)
- gpu.setResolution(80, 25)
- function draw()
- button.clear()
- button.heading("Tinker Smeltery - Tank Controller")
- button.label(22,4,"Smelter")
- button.label(56,4, "Tank")
- button.label(22, 20, currentSmelterFluid)
- button.label(56, 20, currentTankFluid)
- button.screen()
- end
- draw()
- function updateTankInfo()
- local _fluidInTank = tanksmelter.getCurrentFluidInTank()
- if _fluidInTank == nil then
- _fluidInTank = "Empty"
- else
- _fluidInTank = _fluidInTank[1].label
- end
- local _fluidInSmelter = tanksmelter.getCurrentFluidInSmelter()
- if _fluidInSmelter == nil then
- _fluidInSmelter = "Empty"
- else
- _fluidInSmelter = _fluidInSmelter[1].label
- end
- if _fluidInSmelter == nil then
- _fluidInSmelter = "Empty"
- end
- if _fluidInTank == nil then
- _fluidInTank = "Empty"
- end
- if _fluidInTank ~= currentTankFluid or _fluidInSmelter ~= currrentSmelterFluid then
- currentTankFluid = _fluidInTank
- currentSmelterFluid = _fluidInSmelter
- draw()
- end
- end
- while true do
- getClick()
- updateTankInfo()
- end
Advertisement
Add Comment
Please, Sign In to add comment