Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if fs.exists("events")==false then
- shell.run("pastebin get bmKBU4Rv events")
- end
- os.loadAPI("events")
- if fs.exists("button")==false then
- shell.run("pastebin get hbeLn1ni button")
- end
- os.loadAPI("button")
- --button.setDebugMode(true)
- local timer=os.startTimer(1)
- button.setMonitorSide("monitor_0")
- button.setBackgroundColor(32768)
- local monitor=peripheral.wrap("monitor_0")
- local spawner=peripheral.wrap("top")
- local essenceTank=peripheral.wrap("rcirontankvalvetile_0")
- redstone.setOutput("top",true)
- function toggleSpawner(bool)
- redstone.setOutput("top",not bool)
- drawDisplay()
- end
- function setupDisplay()
- local screenx,screeny=monitor.getSize()
- button.removeAllButtons()
- button.addButton(1,screeny-2,screenx,3,"Toggle spawner",toggleSpawner,true,false,128,256)
- end
- setupDisplay()
- function clearLines(start,stop)
- local screenx,screeny=monitor.getSize()
- monitor.setBackgroundColor(128)
- local clearString=""
- for i=1,screenx do
- clearString=clearString.." "
- end
- for i=start,stop do
- monitor.setCursorPos(1,i)
- monitor.write(clearString)
- end
- end
- function drawDisplay(timer)
- local energy=spawner.getEnergyStored()
- local internalTank=spawner.getTankInfo()
- local exact=spawner.getSpawnExact()
- local fluidAmmount=0
- if internalTank[1]~=nil then
- fluidAmmount=fluidAmmount+internalTank[1].contents.amount
- end
- local essence=essenceTank.getTankInfo()
- if essence[1]~=nil then
- fluidAmmount=fluidAmmount+essence[1].contents.amount
- end
- clearLines(1,7)
- monitor.setCursorPos(5,2)
- monitor.write("Energy : "..energy.." RF")
- monitor.setCursorPos(5,3)
- monitor.write("Essence : "..math.floor(fluidAmmount/100+0.5)*0.1 .." Buckets")
- monitor.setCursorPos(5,5)
- monitor.write("Exact copy : "..tostring(exact))
- monitor.setCursorPos(5,6)
- monitor.write("Active : "..tostring(not redstone.getOutput("top")))
- timer=os.startTimer(1)
- end
- events.addEventHandler("timer",drawDisplay)
- drawDisplay()
- while true do
- events.handleCCEvents()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement