Advertisement
fat3

runnow

Apr 9th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. os.loadAPI("getSteam")
  2. os.loadAPI("jimmi/button")
  3. refreshTimer = os.startTimer(1)
  4.  
  5. local big = peripheral.find("BigReactors-Reactor")
  6. local mon = peripheral.find("monitor")
  7. local manual = false
  8.  
  9. mon.clear()
  10.  
  11. function automaticOnOff()
  12.     button.toggleButton("Automatic")
  13.     manual = not manual
  14. end
  15.  
  16. function run()
  17.     steam = getSteam.getAmount()
  18.     steamP = steam / 20736 /10
  19.     steamP = steamP
  20.      
  21.     --max rod out
  22.     MaxRodOut = 50
  23.      
  24.     Rod = big.getControlRodLevel(0)
  25.     RodDiff = (100 - MaxRodOut) /100
  26.      
  27.     if steamP > 0 and manual == false then
  28.             big.setAllControlRodLevels((RodDiff*steamP)+MaxRodOut)
  29.     end
  30.    
  31.     --Till Monitorn
  32.     mon.setCursorPos(1,1)
  33.     mon.clearLine()
  34.     mon.setTextColor(2)
  35.     mon.setBackgroundColor(128)
  36.     if manual == false then
  37.         mon.write("  Automatic rod activeated   ")
  38.     else
  39.         mon.write("  Automatic rod deactivated  ")
  40.     end
  41.      
  42.     mon.setCursorPos(1,3)
  43.     mon.setBackgroundColor(32768)
  44.     mon.clearLine()
  45.     mon.setTextColor(1)
  46.     mon.write("     Steam: "..steamP.. "%")
  47.      
  48.     mon.setCursorPos(1,4)
  49.     mon.clearLine()
  50.     mon.write("       Rod: ".. (RodDiff*steamP)+MaxRodOut)
  51.      
  52.     mon.setCursorPos(1,6)
  53.     mon.clearLine()
  54.     mon.write("     Steam: "..big.getHotFluidProducedLastTick().." mb/t")
  55.      
  56.     mon.setCursorPos(1,7)
  57.     mon.clearLine()
  58.     mon.write("  CoreTemp: "..math.floor (big.getFuelTemperature()).." c")
  59.      
  60.     mon.setCursorPos(1,8)
  61.     mon.clearLine()
  62.     mon.write(" FuelUsage: " ..big.getFuelConsumedLastTick().. " mb/t")
  63.      
  64.     mon.setCursorPos(1,9)
  65.     mon.clearLine()
  66.     mon.write(" MaxRodOut: ".. MaxRodOut .."%")
  67.      
  68.     if steamP < 0 and manual == false then
  69.         --kickstart
  70.         big.setAllControlRodLevels(MaxRodOut)
  71.     end
  72.      
  73.     --print("steam: "..steamP.."%  Rod: ".. (RodDiff*steamP)+MaxRodOut)
  74.     print("....Automating....")
  75.     refreshTimer = os.startTimer(1)
  76. end
  77.  
  78. button.setTable("Automatic",automaticOnOff,"",2,28,11,17)
  79. button.drawScreen()
  80.  
  81. function pullEvents()
  82.     local event, side, x, y = os.pullEvent()
  83.  
  84.     if event=="monitor_touch" then
  85.         button.checkxy(x,y)
  86.     end
  87.    
  88.     if event=="timer" then
  89.         run()
  90.     end
  91.  
  92. end
  93.  
  94. while true do pullEvents() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement