View difference between Paste ID: 2zYJh37x and Ua6xk82K
SHOW: | | - or go back to the newest paste.
1
--Place the Terminal Glasses Bridge to the RIGHT of the Advanced Computer
2
--Place a Wired Modem to the back of the Advanced Computer and on one of the sides of your energy device
3
--Connect the 2 Wired Modems with Networking Cables
4
--Activate the Wired Modems by right clicking on them
5
--You'll be given an ID when activating the modem. Replace 'idsu_0' with that ID.
6
 
7
local msg
8
local command
9
 
10
local bridge = peripheral.wrap("right")
11
local net = peripheral.wrap("bottom")
12
 
13
local function hud()
14
        bridge.clear()
15-
	bridge.addText(4, 54, "Matter Fabricator: ", 0xFFFFFF)
15+
	bridge.addText(4, 54, "MFSU: ", 0xFFFFFF)
16
        local width = 100
17
        local storageUnits = {
18
           {
19-
                 ["id"] = "idsu_2",
19+
                 ["id"] = "??????????",
20-
                 ["name"] = "IDSU"
20+
                 ["name"] = "?????????"
21
           }
22
         
23
        }
24
 
25
        local offset = 0
26
        for key, storageUnit in pairs(storageUnits) do
27
          pxOffset = offset * 20
28
          storageUnit["label"] = bridge.addText(4, 34 + pxOffset, storageUnit["name"], 0xFFFFFF)
29
          storageUnit["bar"] = bridge.addBox(4, 44 + pxOffset, 0, 5, 0xCC0000, 0.9)
30
          storageUnit["bar"].setZIndex(2)
31
          storageUnit["bg"] = bridge.addBox(4, 44 + pxOffset, width, 5, 0x000000, 0.5)
32
          offset = offset + 1
33
        end
34
         
35
        while true do
36
          for i=#storageUnits,1,-1 do
37
                storageUnit = storageUnits[i]
38
                if net.isPresentRemote(storageUnit["id"]) then
39
                  capacity = net.callRemote(storageUnit["id"], "getCapacity")
40
                  amount = net.callRemote(storageUnit["id"], "getStored")
41
                  storageUnit["bar"].setWidth(width / capacity * amount)
42
                else
43
                  storageUnit["bar"].delete()
44
                  storageUnit["bg"].delete()
45
                  storageUnit["label"].delete()
46
                  table.remove(storageUnits, i)
47
                end
48
          end
49
          sleep(0.5)
50
end
51
end
52
 
53
end
54
 
55
local function pullChat()
56
  local e
57
  e, msg = os.pullEvent("chat_command")
58
end
59
 
60
 
61
while true do
62
  if command == "hud" then
63
    parallel.waitForAny(pullChat, hud)
64-
  elseif msg == "mf on" then
64+
  elseif msg == "on" then
65
    bridge.clear()
66-
    redstone.setBundledOutput("bottom", 0)
66+
    redstone.setOutput("bottom", true)
67
    bridge.addText(100, 54, "Active", 0x09B00)
68
    parallel.waitForAny(pullChat, hud)
69-
  elseif msg == "mf off" then
69+
  elseif msg == "off" then
70
    bridge.clear()
71-
    redstone.setBundledOutput("bottom", colors.red)
71+
    redstone.setOutput("bottom", false)
72
    bridge.addText(100, 54, "Inactive", 0xA30000)
73
    parallel.waitForAny(pullChat, hud)
74
  else
75
    pullChat()
76
  end
77
  if msg == "hud" then
78
    command = "hud"
79
  elseif msg == "clear" then
80
    command = bridge.clear()
81
  else
82
    pullChat()
83
  end
84
end