Advertisement
Guest User

zorosarvar glasses

a guest
Feb 13th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.02 KB | None | 0 0
  1. glass = peripheral.wrap("back")
  2. battery = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_0")
  3. reactor = peripheral.wrap("BigReactors-Reactor_0")
  4. modem = peripheral.wrap("top")
  5.  
  6. lbTime = 0
  7.  
  8. function round(what, precision)
  9.   return math.floor(what*math.pow(10,precision)+0.5) / math.pow(10,precision)
  10.   end
  11.  
  12. function listener()
  13.   modem.open(1)
  14.   while true do
  15.   la,lb,lc,ld,qty,le = os.pullEvent("modem_message")
  16.     end
  17.   end
  18.  
  19. function addBox()
  20.   glass.addBox(1,1,80,10,0xCCCCCC,0.2)
  21.  
  22. end
  23.  
  24. function batDis()
  25.   batLvl = battery.getEnergyStored()
  26.   batMax = battery.getMaxEnergyStored()
  27.   batRatio = batLvl / batMax
  28.   endX = math.floor(78 * batRatio)
  29.  
  30.   glass.addText(3,15,"Resonant Cell")
  31.   glass.addBox(3,25,75,5,0x00FF00)
  32.  
  33.   glass.addText(3,32,round(batLvl/1000000,1) .. "MRF/" .. batMax/1000000 .. "MRF")
  34.  
  35.  
  36.   glass.addBox(endX,25,(78-endX),5,0xFF0000)
  37.   end
  38.  
  39. function reactorDis()
  40.   isOn = reactor.getActive()
  41.   rfStored = reactor.getEnergyStored()
  42.   rfPerTick = reactor.getEnergyProducedLastTick()
  43.  
  44.   glass.addText(3,42,"Reactor")
  45.   if isOn == true then
  46.     glass.addText(3,51,"Active",0x00FF00)
  47.     end
  48.   if isOn == false then
  49.     glass.addText(3,51,"Inactive",0xFF0000)
  50.     end
  51.   glass.addText(3,60,"Internal Buffer")
  52.   glass.addBox(3,70,75,5,0x00FF00)
  53.   endX = math.floor(78 * (rfStored / 10000000))
  54.   glass.addBox(endX,70,(78-endX),5,0xFF0000)
  55.  
  56.   glass.addText(3,77,round(rfStored/1000000, 1) .. "MRF/10MRF")
  57.   glass.addText(3,86,math.floor(rfPerTick) .. "RF/t")
  58.   end
  59.  
  60.  
  61. function timeDis()
  62.   time = textutils.formatTime(os.time(), false)
  63.   glass.addText(5,2,"Time: " .. time, 0xEEEEEE)
  64.  
  65. end
  66.  
  67. function cobbleDis()
  68.   glass.addText(3,92,"Cobble Barrel",0xCCCCCC)
  69.   glass.addText(3,96,"qty: " .. qty .. "/4096")
  70.   if uccobble == true then
  71.     if lbTime<10 then
  72.       glass.addText(3,180,"UC: " .. qty*6561)
  73.       lbTime = lbTime + 1
  74.     else
  75.       uccobble = false
  76.       end
  77.     end
  78.   end
  79.  
  80. function start()
  81.   glass.clear()
  82.   while true do
  83.     glass.clear()
  84.     addBox()
  85.     timeDis()
  86.     batDis()
  87.     reactorDis()
  88.     cobbleDis()
  89.     glass.sync()
  90.     sleep(0.1)
  91.     end
  92.   end
  93.  
  94. function commands()
  95.   while true do
  96.     event,side,player,id,command=os.pullEvent("glasses_chat_command")
  97.     if command == "hello" then
  98.       redstone.setOutput("top", true)
  99.       end
  100.     if command == "bye" then
  101.       redstone.setOutput("top", false)
  102.       end
  103.     if command == "reset" then
  104.       print("Restarting...")
  105.       shell.run("restart")
  106.       print("Restarted.")
  107.       end
  108.     if command == "reactor enable" then
  109.       reactor.setActive(true)
  110.       end
  111.     if command == "reactor disable" then
  112.       reactor.setActive(false)
  113.       end
  114.     if command == "spooky" then
  115.      -- glass.addTriangle((3,150),(33,150),(18,120),0x00FF00)
  116.       eye = glass.addIcon(270,140,"minecraft:ender_eye")
  117.       end
  118.     if command == "uccobble" then
  119.       uccobble = true
  120.       end
  121.      
  122.     end
  123.   end  
  124.    
  125. parallel.waitForAll(start, commands, listener)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement