Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tess = peripheral.wrap("bottom")
- mon = peripheral.wrap("top")
- pwr = peripheral.wrap("right")
- tessDump = peripheral.wrap("tile_thermalexpansion_ender_tesseract_name_1")
- monTable = peripheral.wrap("monitor_6")
- freq = tess.getFrequency()
- local startPwr = pwr.getEnergyStored()
- function getNow(pwr_)
- local current = pwr_.getEnergyStored()
- pwrTaken = current - startPwr
- end
- mon.clear()
- mon.setCursorPos(2,2)
- mon.setTextColor(2)
- mon.write("Freq: ")
- mon.setCursorPos(13,2)
- mon.write("Status: ")
- mon.setCursorPos(1,4)
- mon.write("------------------------------")
- mon.setCursorPos(2,6)
- mon.write("Type: ")
- mon.setCursorPos(7,9)
- mon.write("Drained: ")
- monTable.clear()
- monTable.setCursorPos(2,2)
- monTable.setTextColor(2)
- monTable.write("Frequency: Drained:")
- monTable.setCursorPos(1,3)
- monTable.write("--------------------------------")
- print("Initial: ", startPwr)
- while(true) do
- for i = 1, 999 do
- tess.setFrequency(i)
- print("Testing frequency: ", i)
- mon.setCursorPos(7,2)
- mon.setTextColor(1)
- mon.write(i)
- mon.setCursorPos(20,2)
- mon.write("Searching")
- getNow(pwr)
- local runPwr = pwr.getEnergyStored()
- j = 1
- sleep(1)
- if runPwr ~= pwr.getEnergyStored() then
- print("Change detected: ", runPwr)
- getNow(pwr)
- runPwr = pwr.getEnergyStored()
- local startVal = pwr.getEnergyStored()
- local pwrDrained = 0
- while(true) do
- pwrDrained = runPwr - startVal
- print("Found Power!! Now draining. ", j)
- sleep(0.5)
- j = j+1
- if runPwr == pwr.getEnergyStored() then
- print("Power Drained.")
- mon.setCursorPos(20,2)
- mon.setTextColor(16384)
- mon.write("Drained. ")
- getNow(pwr)
- sleep(2)
- break
- else
- runPwr = pwr.getEnergyStored()
- print("Draining.", j)
- sleep(0.5)
- mon.setCursorPos(20,2)
- mon.setTextColor(32)
- mon.write("Draining ")
- mon.setCursorPos(16,9)
- mon.setTextColor(521)
- mon.write(pwrDrained)
- end
- end
- end
- if pwr.getEnergyStored() == pwr.getMaxEnergyStored() then
- tess.setRedstoneControl(1)
- mon.setCursorPos(20,2)
- mon.setTextColor(2048)
- mon.write("Pwr Dump ")
- sleep(50)
- tess.setRedstoneControl(2)
- else
- tess.setRedstoneControl(2)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement