Advertisement
NolanSyKinsley

Untitled

Apr 2nd, 2014
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.66 KB | None | 0 0
  1. ae = peripheral.wrap("appeng_me_tilecontroller_0")
  2. p = peripheral.wrap("right")
  3. e = peripheral.wrap("cofh_thermalexpansion_energycell_5")
  4. p.clear()
  5.  
  6. variables = {
  7. ["width"] = 95,
  8. ["height"] = 100,
  9. ["lineTransparency"] = 1,
  10. ["innerTransparency"] = 0.5,
  11. ["lineColour"] = 0x000000,
  12. ["middleColour"] = 0x00000
  13. }
  14. groups = {
  15. ["left_transparency"] = {
  16. [1] = {x=2, y=11, width=1, height="height+00",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  17. [2] = {x=3, y=08, width=1, height="height+06",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  18. [3] = {x=4, y=06, width=1, height="height+10",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  19. [4] = {x=5, y=05, width=1, height="height+12",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  20. [5] = {x=6, y=04, width=2, height="height+14",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  21. [6] = {x=8, y=03, width=3, height="height+16",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  22. },
  23. ["middle_transparency"] = {
  24. [1] = {x=11,y=2,width="width+0",height="height+18",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  25. },
  26. ["right_transparency"] = {
  27. [1] = {x="width+11", y=03, width=3, height="height+16",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  28. [2] = {x="width+14", y=04, width=2, height="height+14",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  29. [3] = {x="width+16", y=05, width=1, height="height+12",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  30. [4] = {x="width+17", y=06, width=1, height="height+10",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  31. [5] = {x="width+18", y=08, width=1, height="height+06",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  32. [6] = {x="width+19", y=11, width=1, height="height+00",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  33. },
  34. ["top_left"] = {
  35. [1] = {x=8,y=2,width=3,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  36. [2] = {x=6,y=3,width=2,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  37. [3] = {x=4,y=5,width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  38. [4] = {x=5,y=4,width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  39. [5] = {x=3,y=6,width=1,height=2,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  40. [6] = {x=2,y=8,width=1,height=3,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  41. },
  42. ["top"] = {
  43. [1] = {x=11,y=1,width="width+0",height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  44. },
  45. ["top_right"] = {
  46. [1] = {x="width+11",y=2,width=3,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  47. [2] = {x="width+14",y=3,width=2,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  48. [3] = {x="width+16",y=4,width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  49. [4] = {x="width+17",y=5,width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  50. [5] = {x="width+18",y=6,width=1,height=2,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  51. [6] = {x="width+19",y=8,width=1,height=3,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  52. },
  53. ["left"] = {
  54. [1] = {x=1,y=11,width=1,height="height+0",colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  55. },
  56. ["right"] = {
  57. [1] = {x="width+20",y=11,width=1,height="height+0",colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  58. },
  59. ["bottom_left"] = {
  60. [1] = {x=2,y="height+11",width=1,height=3,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  61. [2] = {x=3,y="height+14",width=1,height=2,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  62. [3] = {x=4,y="height+16",width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  63. [4] = {x=5,y="height+17",width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  64. [5] = {x=6,y="height+18",width=2,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  65. [6] = {x=8,y="height+19",width=3,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  66. },
  67. ["bottom"] = {
  68. [1] = {x=11,y="height+20",width="width+0",height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  69. },
  70. ["bottom_right"] = {
  71. [1] = {x="width+19",y="height+11",width=1,height=3,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  72. [2] = {x="width+18",y="height+14",width=1,height=2,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  73. [3] = {x="width+17",y="height+16",width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  74. [4] = {x="width+16",y="height+17",width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  75. [5] = {x="width+14",y="height+18",width=2,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  76. [6] = {x="width+11",y="height+19",width=3,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  77. }
  78. }
  79. function renderGroup(groupName)
  80. group = groups[groupName]
  81. for key, object in pairs(group) do
  82. if type(object["x"]) == "number" then
  83. object["obj"].setX(object["x"])
  84. elseif type(object["x"]) == "string" then
  85. t = {}
  86. for k, v in string.gmatch(object["x"], "(%w+)+(%w+)") do
  87. t[1] = k
  88. t[2] = v
  89. end
  90. object["obj"].setX(tonumber(variables[t[1]])+tonumber(t[2]))
  91. end
  92. if type(object["y"]) == "number" then
  93. object["obj"].setY(object["y"])
  94. elseif type(object["y"]) == "string" then
  95. t = {}
  96. for k, v in string.gmatch(object["y"], "(%w+)+(%w+)") do
  97. t[1] = k
  98. t[2] = v
  99. end
  100. object["obj"].setY(tonumber(variables[t[1]])+tonumber(t[2]))
  101. end
  102. if type(object["width"]) == "number" then
  103. object["obj"].setWidth(object["width"])
  104. elseif type(object["width"]) == "string" then
  105. t = {}
  106. for k, v in string.gmatch(object["width"], "(%w+)+(%w+)") do
  107. t[1] = k
  108. t[2] = v
  109. end
  110. object["obj"].setWidth(tonumber(variables[t[1]])+tonumber(t[2]))
  111. end
  112. if type(object["height"]) == "number" then
  113. object["obj"].setHeight(object["height"])
  114. elseif type(object["height"]) == "string" then
  115. t = {}
  116. for k, v in string.gmatch(object["height"], "(%w+)+(%w+)") do
  117. t[1] = k
  118. t[2] = v
  119. end
  120. object["obj"].setHeight(tonumber(variables[t[1]])+tonumber(t[2]))
  121. end
  122. if type(object["colour"]) == "number" then
  123. object["obj"].setColor(object["colour"])
  124. elseif type(object["colour"]) == "string" then
  125. t = {}
  126. for k, v in string.gmatch(object["colour"], "(%w+)+(%w+)") do
  127. t[1] = k
  128. t[2] = v
  129. end
  130. object["obj"].setColor(tonumber(variables[t[1]])+tonumber(t[2]))
  131. end
  132. if type(object["transparency"]) == "number" then
  133. object["obj"].setOpacity(object["transparency"])
  134. elseif type(object["transparency"]) == "string" then
  135. t = {}
  136. for k, v in string.gmatch(object["transparency"], "(%w+)+(%w+)") do
  137. t[1] = k
  138. t[2] = v
  139. end
  140. object["obj"].setOpacity(tonumber(variables[t[1]])+tonumber(t[2]))
  141. end
  142. end
  143. end
  144. function redraw()
  145. for key,value in pairs(groups) do
  146. renderGroup(key)
  147. end
  148. end
  149. redraw()
  150.  
  151. function DrawHUD()
  152. aeTotalSpace = ae.getTotalBytes()
  153. ab = ae.getFreeBytes()
  154. ab = ab / totalSpace*100
  155. ab = 100 - ab
  156. aeback = p.addBox(8,10,100.00345,5,0x33CC00,0.5)
  157. aefore = p.addBox(8,10,ae,5,0xCC0000,1)
  158.  
  159. pwTotalEnergy = e.getEnergyStored("north")
  160. pw = e.getMaxEnergyStored("north")
  161. pw = pw / pwTotalEnergy*100
  162. pw = 100 / pw
  163. eback = p.addBox(8,18,100.00345,5,0x33CC00,0.5)
  164. efore = p.addBox(8,18,p,5,0xCC0000,1)
  165. end
  166. DrawHUD()
  167.  
  168. function ReDrawHUD()
  169. sleep(0)
  170. aeTotalSpace = ae.getTotalBytes()
  171. ab = ae.getFreeBytes()
  172. ab = ab / aeTotalSpace*100
  173. ab = 100 - ab
  174. aefore.setWidth(f)
  175.  
  176. pwTotalEnergy = e.getEnergyStored("north")
  177. pw = e.getMaxEnergyStored("north")
  178. pw = pw / pwTotalEnergy*100
  179. pw = 100 / pw
  180. efore.setWidth(pw)
  181. sleep(5)
  182. end
  183.  
  184. function reboot()
  185. os.reboot()
  186. end
  187.  
  188. function Commands()
  189.  
  190. local evt,command = os.pullEvent("chat_command")
  191. local redStoneBottom = false
  192.  
  193. if command == "redrawhud" then
  194. ReDrawHUD()
  195. end
  196.  
  197. if command == "start" then
  198. redStoneBottom = true
  199. end
  200.  
  201. if command == "stop" then
  202. redstoneBottom = false
  203. end
  204.  
  205. if command == "reboot" then
  206. reboot()
  207. end
  208.  
  209. if command == "clear" then
  210. p.clear()
  211. end
  212.  
  213. if redStoneBottom == true then
  214. redstone.setOutput("bottom", true)
  215. elseif redStoneBottom == false then
  216. redstone.setOutput("bottom", false)
  217. end
  218. end
  219. while true do
  220. parallel.waitForAny(Commands, ReDrawHUD)
  221. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement