Advertisement
Guest User

po3

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