Glitchies

redstone

Mar 30th, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. redstone.setOutput("back", true)
  2. if true do
  3.    local cell1 = peripheral.wrap("cofh_thermalexpansion_energycell_0")
  4.    local cell1Stored = cell1.getEnergyStored("cofh_thermalexpansion_energycell_0")
  5.    local cell1Full = cell1.getMaxEnergyStored("cofh_thermalexpansion_energycell_0")
  6.    local cell2 = peripheral.wrap("cofh_thermalexpansion_energycell_1")
  7.    local cell2Stored = cell2.getEnergyStored("cofh_thermalexpansion_energycell_1")
  8.    local cell2Full = cell2.getMaxEnergyStored("cofh_thermalexpansion_energycell_1")
  9.    local cell1Percent = math.floor(100*cell1Stored/cell1Full)
  10.    local cell2Percent = math.floor(100*cell2Stored/cell2Full)
  11.    if math.floor(100*(cell1Percent+cell2Percent)) <= 200 then
  12.       print(tonumber(cell1Stored).."/"..cell1Full.." "..cell1Percent.."%")
  13.       print(tonumber(cell2Stored).."/"..cell2Full.." "..cell2Percent.."%")
  14.       redstone.setOutput("back", false)
  15.       sleep(20)
  16.    else
  17.       redstone.setOutput("back", true)
  18.       print(tonumber(cell1Percent).."%")
  19.       print(tonumber(cell2Percent).."%")
  20.       sleep(20)
  21.    end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment