Advertisement
maxtorcd55

Engine_control

Apr 13th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.86 KB | None | 0 0
  1. moni = peripheral.wrap("left")
  2. moni2 = peripheral.wrap("right")
  3. local maxRFT
  4. local RFT
  5. local count
  6. local RFTStore
  7. local maxRFTStore
  8. local cool
  9. local maxCool
  10. local fuel
  11. local maxFuel
  12. local FName1
  13. local FName2
  14. while true do
  15.     if rs.getInput("front") then
  16.     p = peripheral.wrap("top")
  17.     t = p.getNamesRemote()
  18.     maxRFT = 0
  19.     RFT = 0
  20.     RFTStore = 0
  21.     maxRFTStore = 0
  22.     count = 0
  23.     fuel = 0
  24.     maxFuel = 0
  25.     cool = 0
  26.     maxCool = 0
  27.     for i = 1, #t do
  28.         local info = p.getMethodsRemote(t[i])
  29.         maxRFT = maxRFT + p.callRemote(t[i], "getMaxEnergyPerTick")
  30.         RFT = RFT + p.callRemote(t[i], "getEnergyPerTick")
  31.         RFTStore = RFTStore + p.callRemote(t[i], "getEnergy")
  32.         maxRFTStore = maxRFTStore + p.callRemote(t[i], "getMaxEnergy")
  33.         local table = p.callRemote(t[i], "getTankInfo","")
  34.         FName1 = "Inv1"
  35.         FName2 = "Inv2"
  36.         if table[2]["amount"] ~= nil then
  37.             cool = cool + table[2]["amount"]
  38.             FName2 = table[2]["name"]
  39.         end
  40.         maxCool = maxCool + table[2]["capacity"]
  41.         if table[1]["amount"] ~= nil then
  42.             fuel = fuel + table[1]["amount"]
  43.             FName1 = table[1]["name"]
  44.         end
  45.         maxFuel = maxFuel + table[1]["capacity"]       
  46.         count = count + 1
  47.         moni.clear()
  48.         moni.setCursorPos(1,1)
  49.         local loading = string.format("%01d%%",(i/((#t)/100)))
  50.         moni.write(loading)
  51.     end
  52.     moni.clear()
  53.     moni.setCursorPos(1,1)
  54.     local procent = string.format("Running: %01d%%", (RFT/maxRFT)*100)
  55.     moni.write(procent)
  56.     moni.setCursorPos(1,2)
  57.     moni.write("Power: " ..RFT.."/"..maxRFT .." RF/t")
  58.     moni.setCursorPos(1,3)
  59.     local EneStor = string.format("Store: %01d/%01d KRF", (RFTStore/1000), (maxRFTStore/1000))
  60.     moni.write(EneStor)
  61.     moni.setCursorPos(1,4)
  62.     local cooling = string.format(FName2 ..": %01d%%", (cool/maxCool)*100)
  63.     moni.write(cooling)
  64.     moni.setCursorPos(1,5)
  65.     local fueling = string.format(FName1 ..": %01d%%", (fuel/maxFuel)*100)
  66.     moni.write(fueling)
  67.     end
  68.     sleep(1)
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement