Guest User

untitled

a guest
Feb 23rd, 2014
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. local bridge = peripheral.wrap("right")
  2. local net = peripheral.wrap("back")
  3.  
  4. bridge.clear()
  5.  
  6. local width = 200
  7.  
  8. local storageUnits = {
  9.    {
  10.          ["id"] = "mfsu_0",
  11.          ["name"] = "Mfsu #1"
  12.    },
  13.    {
  14.          ["id"] = "mfsu_1",
  15.          ["name"] = "Mfsu #2"
  16.    }
  17. }
  18.  
  19. local offset = 0
  20. for key, storageUnit in pairs(storageUnits) do
  21.   pxOffset = offset * 20
  22.   storageUnit["label"] = bridge.addText(4, 4 + pxOffset, storageUnit["name"], 0xFF0000)
  23.   storageUnit["bar"] = bridge.addBox(4, 14 + pxOffset, 0, 5, 0x00CC00, 0.9)
  24.   storageUnit["bg"] = bridge.addBox(4, 14 + pxOffset, width, 5, 0x0033CC, 0.5)
  25.   offset = offset + 1
  26. end
  27.  
  28. while true do
  29.   for i=#storageUnits,1,-1 do
  30.         storageUnit = storageUnits[i]
  31.         if net.isPresentRemote(storageUnit["id"]) then
  32.           capacity = net.callRemote(storageUnit["id"], "getCapacity")
  33.           amount = net.callRemote(storageUnit["id"], "getStored")
  34.           storageUnit["bar"].setWidth(width / capacity * amount)
  35.         end
  36.   end
  37.   sleep(0.5)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment