Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local cell = component.tile_thermalexpansion_cell_resonant_name
- local rs = component.redstone
- local sides = require("sides")
- local term = requrie("term")
- local stored = cellgetEnergyStored()/80000000
- local turnOn = 0.1
- local turnOff = 0.9
- local _,y = term.getCursor()
- local function PowerSupply()
- if stored <= turnOn and rs.getOutput(sides.left) == 0 then
- rs.setOutput(sides.left,15)
- elseif stored >= turn off and rs.getOutput(sides.left) == 15 then
- rs.setOutput(sides.left,0)
- end
- local state
- if rs.getOutput(sides.left) == 15 then
- state = "On"
- else
- state = "Off"
- end
- term.setCursor(1,y)
- term.clearLine()
- term.write("Generator state: "..state.."\n")
- term.clearLine()
- term.write("Stored Energy: "..stored*80000000.."\n")
- term.clearLine()
- term.write("Energy Percentage: "..stored.."\n")
- end
- while true do
- PowerSupply()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement