Advertisement
Guest User

po3

a guest
Nov 23rd, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.75 KB | None | 0 0
  1.     BigReactor = "BigReactors-Reactor_1" --Reactor Slot
  2.     Monitor_Slot = "monitor_1"           --Monitor Slot
  3.  
  4.     monitor = peripheral.wrap(Monitor_Slot)
  5.     monitor.clear()
  6.     monitor.setTextScale(1)
  7.     term.setBackgroundColor(2048)
  8.    
  9.  
  10.     local stored= "1000000" --Anzeige Max Interner Speicher
  11.    
  12.    
  13.     local reactor = peripheral.wrap(BigReactor)
  14.     local reactorTemp=reactor.getFuelTemperature()
  15.     local reactorCasingTemp=reactor.getCasingTemperature()
  16.     local reactorFuel=reactor.getFuelAmount()
  17.     local reactorRFTick = reactor.getEnergyProducedLastTick()
  18.     local reactorEnergy = reactor.getEnergyStored()
  19.     local backgoundColor = 32
  20.     local onoff = 1
  21.      
  22.     local PosX = 0
  23.     local PosY = 0
  24.     local AnAus = true
  25.      
  26.     local zeileX = 24
  27.     local zeileY = 3
  28.      
  29.     function Clear()
  30.     term.clear()
  31.     term.setCursorPos(1,1)
  32.     end
  33.      
  34.  
  35.     function Update()
  36.     local reactor = peripheral.wrap(BigReactor)
  37.     local reactorTemp=reactor.getFuelTemperature()
  38.     local reactorCasingTemp=reactor.getCasingTemperature()
  39.     local reactorFuel=reactor.getFuelAmount()
  40.     local reactorRFTick = reactor.getEnergyProducedLastTick()
  41.     local reactorEnergy = reactor.getEnergyStored()
  42.      
  43.     reactorTempNew=math.ceil(reactorTemp)
  44.     reactorCasingTempNew=math.ceil(reactorCasingTemp)
  45.     reactorFuelNew=math.ceil(reactorFuel)
  46.     reactorRFTickNew=math.ceil(reactorRFTick)
  47.     reactorEnergyNew=math.ceil(reactorEnergy)
  48.    
  49.     local zeileX = 24
  50.     local zeileY = 3
  51.    
  52.     OnOff()
  53.     end
  54.      
  55. function OnOff()
  56.  
  57. if reactorOnline == true then
  58.     AnAus = false
  59.     Status = "An"
  60. elseif reactorOnline == false then
  61.     AnAus = true
  62.     Status = "Aus"
  63.      
  64. end  
  65. end
  66.  
  67. function Zeile()
  68. term.setCursorPos(24,zeileY)
  69. zeileY = zeileY + 1
  70. end
  71.  
  72.  
  73.  
  74.     function Active()
  75.     write("Online: ")
  76.     reactorOnline = reactor.getActive()
  77.     term.setCursorPos(24,3)
  78.    
  79.     if reactorOnline == true then
  80.     backgoundColor = 32
  81.     term.setTextColor(32)
  82.     print(Status)
  83.     term.setTextColor(32768)
  84.     else
  85.     backgoundColor = 16384
  86.     term.setTextColor(16384)
  87.      
  88.     print(Status)
  89.      
  90.     term.setTextColor(32768)
  91.      
  92.     end
  93.     end
  94.  
  95.    
  96.    function Time()
  97. write(textutils.formatTime(os.time(), true))
  98.  
  99. end
  100.  
  101.  
  102. function Header()
  103. term.setBackgroundColor(colors.lightBlue)
  104. monitor.setTextScale(1)
  105. write("Reactor Monitor        ")
  106. monitor.setTextScale(1)
  107. term.setBackgroundColor(colors.red)
  108. term.setTextColor(colors.white)
  109. write(" ")
  110. Time()
  111. print("    ")
  112. term.setBackgroundColor(colors.white)
  113. term.setTextColor(colors.black)
  114.  
  115. end
  116.  
  117. function Screen()
  118. term.setBackgroundColor(colors.black)
  119. print("                                                           ")
  120. term.setBackgroundColor(colors.white)
  121. Active()
  122. term.setBackgroundColor(colors.lightGray)
  123. write("Temp:                              ")
  124. term.setCursorPos(24,4)
  125. print(reactorTempNew)
  126. term.setBackgroundColor(colors.white)
  127. write("Casing:                       ")
  128. term.setCursorPos(24,5)
  129. print(reactorCasingTempNew)
  130. term.setBackgroundColor(colors.lightGray)
  131. write("Fuel:                             ")
  132. term.setCursorPos(24,6)
  133. print(reactorFuelNew)
  134. term.setBackgroundColor(colors.white)
  135. write("RF/Tick:                             ")
  136. term.setCursorPos(24,7)
  137. print(reactorRFTickNew)
  138. term.setBackgroundColor(colors.lightGray)
  139. print("Energie:                              ")
  140. write(reactorEnergyNew)
  141. print("/"..stored.."RF                             ")
  142.  
  143.  
  144.  
  145.  
  146. term.setBackgroundColor(colors.white)
  147. end
  148.  
  149. function Run()
  150. Clear()
  151. Update()
  152. Header()
  153. Screen()
  154.  
  155.  
  156. sleep(0.5)
  157. end
  158.  
  159.  
  160.  
  161. function Touch()
  162.  
  163.     event,side,PosX,PosY = os.pullEvent("monitor_touch")
  164.         if PosY == 3 then
  165.             reactor.setActive(AnAus)
  166.  
  167.  
  168.  
  169.             end
  170.         end
  171.  
  172.  
  173.  
  174.  
  175.        
  176. while true do
  177. parallel.waitForAny(Run,Touch)
  178. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement