resaloli

BaseOS v2.3

Mar 29th, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.23 KB | None | 0 0
  1. bridge = peripheral.wrap("bottom")
  2. biomass = peripheral.wrap("drum_2")
  3. mobessence = peripheral.wrap("drum_1")
  4. lava = peripheral.wrap("drum_0")
  5. --honey = peripheral.wrap("drum_0")
  6. energyPrimary = peripheral.wrap("tile_thermalexpancion_cell_resonant_name_0")
  7. secundaryPrimary = peripheral.wrap("tile_thermalexpancion_cell_hardened_name_0")
  8.  
  9. bridge.clear()
  10. term.clear()
  11.  
  12. print("Equipamento Carregado!")
  13. sleep(0.5)
  14. print("Pre-carregamento do Programa!")
  15.  
  16. function getTankInfo()
  17.     lavaInfo = lava.getTankInfo()
  18.     lavaName = lavaInfo[1]["contents"]["name"]
  19.     lavaCapacity = lavaInfo[1]["capacity"]
  20.     lavaAmount = lavaInfo[1]["contents"]["amount"]
  21.    
  22.     mobessenceInfo = mobessence.getTankInfo()
  23.     mobessenceName = mobessenceInfo[1]["contents"]["name"]
  24.     mobessenceCapacity = mobessenceInfo[1]["capacity"]
  25.     mobessenceAmount = mobessenceInfo[1]["contents"]["amount"]
  26.    
  27.     biomassInfo = biomass.getTankInfo()
  28.     biomassName = biomassInfo[1]["contents"]["name"]
  29.     biomassCapacity = biomassInfo[1]["capacity"]
  30.     biomassAmount = biomassInfo[1]["contents"]["amount"]
  31.    
  32.     --honeyInfo = honey.getTankInfo()
  33.     --honeyName = honeyInfo[1]["contents"]["name"]
  34.     --honeyCapacity = honeyInfo[1]["capacity"]
  35.     --honeyAmount = honeyInfo[1]["contents"]["amount"]
  36.  
  37.    
  38. end
  39. getTankInfo()
  40.  
  41. local cores = {}
  42. cores.red = 0xff3333
  43. cores.blue = 0x7dd2e4
  44. cores.yellow = 0xffff4d
  45. cores.green = 0x4dff4d
  46. cores.gray = 0xe0e0e0
  47. cores.preto = 0x000000
  48.  
  49. function desenho()
  50.     bridge.clear()
  51.     local mainBox = caixa(20, 20, 145, 50, cores.gray, 0.5)
  52.     local outlineT = caixa(18,18,150,2,cores.blue,0.5)
  53.     local outlineB = caixa(18,70,150,2,cores.blue,0.5)
  54.     bridge.sync()
  55. end
  56.  
  57. function desenho1()
  58.     bridge.clear()
  59.     local mainBox = caixa(20, 20, 95, 50, cores.gray, 0.5)
  60.     local outlineT = caixa(18,18,100,2,cores.blue,0.5)
  61.     local outlineB = caixa(18,70,100,2,cores.blue,0.5)
  62.     bridge.sync()
  63. end
  64.  
  65. function menu()
  66.     bridge.clear()
  67.     desenho()
  68.     sleep(1)
  69.     texto(22, 22, "$$base = Info. Base", cores.red)
  70.     texto(22, 32, "$$abelhas = Info. Abelhas", cores.red)
  71.     bridge.sync()    
  72. end
  73.  
  74. function caixa(x, y, w, h, col, opa)
  75.   bridge.addBox(x,y,w,h,col,opa)
  76. end
  77.  
  78. function texto(x, y, text, col)
  79.   bridge.addText(x,y,text,col)
  80. end
  81.  
  82. function base()
  83. while true do
  84.   event, command = os.pullEvent("chat_command")
  85.     if command == "base" then
  86.       repeat
  87.             bridge.clear()
  88.             desenho1()
  89.             print(command)
  90.             texto(22, 22, "MobEssence", cores.red)
  91.             texto(22, 32, mobessenceAmount.."/"..mobessenceCapacity, cores.green)
  92.             bridge.sync()
  93.             sleep(2)
  94.         until command ~= "base"
  95.     end
  96.   end
  97. end
  98.  
  99. function music()
  100.     while true do
  101.         event, command = os.pullEvent("chat_command")
  102.         if command == "music" then
  103.             print(command)
  104.             local jukebox = peripheral.wrap("auto_jukebox_0")
  105.             jukebox.play()
  106.         end
  107.     end
  108. end
  109.  
  110. function start()
  111.     while true do
  112.         event, command = os.pullEvent("chat_command")
  113.         if command == "start" then
  114.             print(command)
  115.             bridge.clear()
  116.             menu()
  117.         end
  118.     end
  119. end
  120.  
  121. print("Dados Carregados")
  122. sleep(1)
  123. print("Programa Pronto")
  124. menu()
  125. parallel.waitForAny(music, start , base)
Add Comment
Please, Sign In to add comment