Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local side = "back"
- local generator = peripheral.wrap(side)
- function getStored()
- return(generator.getEnergyStored("top"))
- end
- function getMax()
- return(generator.getMaxEnergyStored("top"))
- end
- function showPct()
- local cur = getStored()
- local maxStored = getMax()
- local pct = math.floor(100 * cur / maxStored)
- return(pct.."%")
- end
- redstone.setOutput(side, false)
- while(getStored() < getMax())
- do
- print(os.time())
- print("Charging "..showPct())
- sleep(1)
- end
- redstone.setOutput(side, true)
- while(getStored() > 0)
- do
- showPct()
- print("Emitting "..showPct())
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement