Advertisement
JoshuaGaming-_-

Untitled

Nov 1st, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. local bridge = peripheral.wrap("top")
  2. local net = peripheral.wrap("back")
  3.  
  4. bridge.clear()
  5.  
  6. local width = 100
  7.  
  8. local storageUnits = {
  9. {
  10. ["id"] = "tile_thermalexpansion_machine_pulverizer_name",
  11. ["name"] = "Pulverizer"
  12. },
  13. {
  14. ["id"] = "cofh_thermalexpansion_tank_1",
  15. ["name"] = "Base Overlay"
  16. }
  17. }
  18.  
  19. local offset = 0
  20. for key, storageUnit in pairs(storageUnits) do
  21. if net.getTypeRemote(storageUnit["id"]) == "cofh_thermalexpansion_tank" then
  22. pxOffset = offset * 10
  23. storageUnit["label"] = bridge.addText(4, 34 + pxOffset, storageUnit["name"].." :", 0xffffff)
  24. storageUnit["num"] = bridge.addText(4, 38 + pxOffset, "Coded By: JoshuaGaming", 0x00b0e6)
  25. offset = offset + 1
  26. elseif net.getTypeRemote(storageUnit["id"]) == "tile_thermalexpansion_machine_pulverizer_name" then
  27. pxOffset = offset * 20
  28. storageUnit["label"] = bridge.addText(4, 4 + pxOffset, storageUnit["name"], 0xffffff)
  29. storageUnit["bar"] = bridge.addBox(4, 14 + pxOffset, 0, 5, 0xCC0000, 0.9)
  30. storageUnit["bar"].setZ(2)
  31. storageUnit["bg"] = bridge.addBox(4, 14 + pxOffset, width, 5, 0x000000, 0.5)
  32. storageUnit["num"] = bridge.addText(4, 24 + pxOffset, "0/0", 0xffffff)
  33. storageUnit["percent"] = bridge.addText(0 + bridge.getStringWidth(storageUnit["name"]), 4 + pxOffset, "##%", 0xffffff)
  34. offset = offset + 2
  35. end
  36. end
  37.  
  38. while true do
  39. for i=#storageUnits,1,-1 do
  40. storageUnit = storageUnits[i]
  41. if net.isPresentRemote(storageUnit["id"]) then
  42. if net.getTypeRemote(storageUnit["id"]) == "tile_thermalexpansion_machine_pulverizer_name" then
  43. t = peripheral.wrap(storageUnit["id"])
  44. capacity = t.getMaxEnergyStored("")
  45. amount = t.getEnergyStored("")
  46. storageUnit["bar"].setWidth(width / capacity * amount)
  47. perc = math.floor(amount/capacity * 100)
  48. tCap = tostring(capacity)
  49. tAmt = tostring(amount)
  50. tPerc = tostring(perc)
  51. storageUnit["num"].setText(tAmt.."/"..tCap)
  52. storageUnit["percent"].setText(tPerc.."%")
  53. end
  54. sleep(0.5)
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement