Advertisement
Plazter

Base

Sep 12th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.27 KB | None | 0 0
  1. component = require("component")
  2. term = require("term")
  3. gpu = component.gpu
  4. event = require("event")
  5. sides = require("sides")
  6. ---------- Redstone Signals -----
  7. VoidMiner = component.proxy(component.get("7b164978-e55f-466b-9e10-296577b3494d"))
  8. AE = component.proxy(component.get("4a7fcdbc-42d4-46d4-bc47-9e6681317d4f"))
  9. OreProcess = component.proxy(component.get("475688b1-7a63-4b5c-a0c6-596590043f3c"))
  10. Woot = component.proxy(component.get("5293fa86-e3a4-4061-b8f0-00f876ec5ed0"))
  11. ---------- TABLES -----------
  12. colors = { black = 0x000000, white = 0xf8f8ff, blue = 0x0000ff, lightGray = 0xd9d9d9, red = 0xff0000,
  13. purple = 0x9b30ff, carrot = 0xffa500, magenta = 0xcd00cd, lightBlue = 0x87cefa, yellow = 0xffff00,
  14. lime = 0x32cd32, pink = 0xffc0cb, gray = 0x696969, brown = 0x8b4500, green = 0x006400, cyan = 0x008b8b,
  15. olive = 0x6b8e23, gold = 0x8b6914, orangered = 0xdb4e02, diamond = 0x0fa7c7,crimson = 0xaf002a,fuchsia = 0xfd3f92,
  16. folly = 0xff004f, frenchBlue = 0x0072bb, lilac = 0x86608e, flax = 0xeedc82, darkGray = 0x563c5c,
  17. englishGreen = 0x1b4d3e, eggplant = 0x614051, deepPink  = 0xff1493, ruby = 0x843f5b, orange = 0xf5c71a,
  18. lemon = 0xffd300, darkBlue = 0x002e63, bitterLime = 0xbfff00 }
  19.  
  20. ------- VARIABLES -------------
  21.  
  22. Border_bg = colors.diamond
  23. Default_bg = colors.gray
  24. text_col = colors.blue
  25. status_col = colors.black
  26. barBack = colors.black
  27. barFill = colors.white
  28. header = colors.orange
  29. Applied = true
  30. VoidMine = true
  31. Ore = true
  32. woot = false
  33. --Side = sides.east
  34.  
  35. -------- FUNCTIONS --------------
  36.  
  37. function guiBorders(x,y,len,height,str) -- BORDER FUNC FOR GUI
  38.   gpu.setBackground(Border_bg)
  39.   gpu.fill(x,y,len,height,str)
  40.   gpu.setBackground(Default_bg)
  41. end
  42.  
  43. function GUI() -- SETS THE GUI LAYOUT (GRAPHICAL USER INTERFACE)
  44.   gpu.setBackground(Default_bg)
  45.   term.clear()
  46.   w,  h = gpu.getResolution()
  47.   guiBorders(1,1,w,1," ")
  48.   guiBorders(1,5,w,1," ")
  49.     for i = 1,h do
  50.       guiBorders(1,i,1,1," ")
  51.       guiBorders(w,i,1,1," ")
  52.     end
  53.     for i = 5,h do
  54.       --guiBorders(7,i,1,5," ")
  55.     end
  56.   for i = 5,h do
  57.     --guiBorders(w-6, i,1,5," ")
  58.   end
  59.   guiBorders(1,h,w,1," ")
  60.   gpu.setForeground(header)
  61.   Center(3,"--[[ Base Control ]]--")
  62. end
  63.  
  64. function Center(y, text)
  65.   w, h = gpu.getResolution()
  66.   term.setCursor((w-string.len(text))/2+1, y)
  67.   term.write(text)
  68. end
  69.  
  70. function addButton(x, y, col,text)
  71.   leng = string.len(text)
  72.   gpu.setBackground(col)
  73.   gpu.fill(x, y, (leng + 2), 3," ")
  74.   gpu.setForeground(status_col)
  75.   gpu.set(x+1, y+1, text)
  76.   gpu.setBackground(Default_bg)
  77. end
  78.  
  79. function detect()
  80.   if Applied == true then
  81.     addButton(10,10, colors.lime, "Applied Energistics")
  82.     AE.setOutput(sides.top, 15)
  83.   else
  84.     addButton(10,10, colors.red  , "Applied Energistics")
  85.     AE.setOutput(sides.top, 0)
  86.   end
  87.  
  88.   if VoidMine == true then
  89.     addButton(10, 15, colors.lime, "Void Miner")
  90.     VoidMiner.setOutput(sides.east, 0)
  91.   else  
  92.     addButton(10,15, colors.red, "Void Miner")
  93.     VoidMiner.setOutput(sides.east, 15)
  94.   end
  95.  
  96.   if Ore == true then
  97.     addButton(10,20, colors.lime, "Ore Processing")
  98.     OreProcess.setOutput(sides.top, 15)
  99.   else
  100.     addButton(10,20, colors.red, "Ore Processing")
  101.     OreProcess.setOutput(sides.top, 0)
  102.   end
  103.  
  104.   if woot == true then
  105.     addButton(10,25, colors.lime, "Woot Spawner")
  106.     Woot.setOutput(sides.top, 0)
  107.   else
  108.     addButton(10,25, colors.red,"Woot Spawner")
  109.     Woot.setOutput(sides.top, 15)
  110.   end
  111. end
  112.  
  113. gpu.setResolution(50,30)
  114. GUI()
  115. while true do
  116.    _,_,x,y = event.pull(1, "touch")
  117.   if x~=nil and y~= nil then
  118.     if x >= 10 and x <= 40 and y >= 10 and y <= 13 then
  119.       if Applied == true then
  120.         Applied = false
  121.         elseif Applied == false then
  122.         Applied = true
  123.        
  124.       end
  125.     end
  126.  
  127.     if x >= 10 and x <= 30 and y >= 15 and y <= 17 then
  128.       if VoidMine == true then
  129.         VoidMine = false
  130.       elseif VoidMine == false then
  131.         VoidMine = true
  132.       end
  133.     end -- Void
  134.    
  135.     if x >= 10 and x <= 30 and y>= 20 and y <= 23 then
  136.       if Ore == true then
  137.         Ore = false
  138.         elseif Ore == false then
  139.         Ore = true
  140.       end
  141.     end   -- Ore
  142.     if x >= 10 and x <= 30 and y >= 25 and y <= 27 then
  143.       if woot == true then
  144.         woot = false
  145.       else
  146.         woot = true
  147.       end
  148.     end
  149.   end
  150.   detect()
  151. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement