Advertisement
Guest User

po3

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