Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local computer = require("computer")
- local component = require("component")
- local sides = require("sides")
- local side = sides.back
- function getPrecent()
- local max = component.blood_altar.getCapacity()
- local curr = component.blood_altar.getCurrentBlood()
- return curr / max
- end
- function setOut(state)
- local rs = component.redstone
- if state then
- print(rs.setOutput(side,255))
- else
- print(rs.setOutput(side,0))
- end
- end
- function loop()
- while true do
- print(getPrecent())
- if getPrecent() > 0.8 then
- setOut(false)
- else
- setOut(true)
- end
- os.sleep(1)
- end
- end
- loop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement