Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cell_position = "front"
- latch = false
- cell = peripheral.wrap(cell_position)
- while(true) do
- capacity = 100*cell.getEnergyStored(cell_position)/cell.getMaxEnergyStored(cell_position)
- capacity = math.floor(capacity)
- if (latch == false) then
- if (capacity <= 100 and capacity >= 80) then
- redstone.setBundledOutput("back", 0)
- elseif (capacity < 80 and capacity >= 60) then
- redstone.setBundledOutput("back", colors.white)
- elseif (capacity < 60 and capacity >= 40) then
- redstone.setBundledOutput("back", colors.combine(colors.white,colors.orange))
- elseif (capacity < 40 and capacity >= 20) then
- redstone.setBundledOutput("back", colors.combine(colors.white,colors.orange,colors.magenta))
- elseif (capacity < 20 and capacity >= 0) then
- redstone.setBundledOutput("back", colors.combine(colors.white,colors.orange,colors.magenta,colors.lightBlue))
- latch = true
- end
- elseif (latch == true) then
- if (capacity <= 99) then
- redstone.setBundledOutput("back", colors.combine(colors.white,colors.orange,colors.magenta,colors.lightBlue))
- elseif (capacity > 99) then
- latch = false
- end
- end
- stages_active = redstone.getBundledOutput("back")
- print("Capacity: "..capacity.."% / Stages Active: "..stages_active)
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement