View difference between Paste ID: HEYKfaCe and HvNruwzN
SHOW: | | - or go back to the newest paste.
1-
local bridge = peripheral.wrap("left")
1+
local bridge = peripheral.wrap("right")
2
local net = peripheral.wrap("back")
3
4
5
local width = 50
6
local machines = {
7-
	["id"] = "nuclear_reactor_0",
7+
8-
	["name"] = "Matter Fab"
8+
	["id"] = "generator_0",
9
	["name"] = "Nuclear Reactor"
10
	}
11
}
12
13
local storages = {
14-
	["id"] = "mfsu_0",
14+
15
	["id"] = "batbox_0",
16
	["name"] = "MFSU"
17
	}
18
}
19
20
function round(num, idp)
21
  local mult = 10^(idp or 0)
22
  return math.floor(num * mult + 0.5) / mult
23
end
24
25
bridge.clear()
26
	
27
function outInfo()
28
	net.callRemote("generator_0","getOutput")
29
	return
30
end
31
for key,value in pairs(machines) do
32
	--outInf = net.callRemote("generator_0","getOutput")
33
	--currOut = 'bridge.addText(25,25,"outInf",0xC5360F)'
34
	value["label"] = bridge.addText(5,5,"Nuclear Reactor:",0xC5360F)
35-
    value["progressbar"].setAlpha(0.5)
35+
36
	value["heatTitle"].setScale(0.7)
37
	value["progressbar"] = bridge.addBox(10,15,50,5,0xff0000,0.9)
38
    value["progressbar"].setZIndex(10)
39
    value["progressbar"].setGradient(2)
40-
local offset = 17
40+
41
    value["progressbarmarker"] = bridge.addBox(10,15,1,5,0x000000,1)
42
    value["progressbarmarker"].setZIndex(11)
43
	--value["outputName"] = bridge.addText(5,25,"Out:",0x0033ff)
44
	--value["outputName"].setScale(0.7)
45
	--value["outputValue"] = bridge.addText(25,25,"outInfo()",0xC5360F)
46
	--value["outputValue"] = currOut
47
	--value["outputValue"].setScale(0.7)
48
	--value["outputTitle"] = bridge.addBox(10,15,50,5,0xff0000,0.9)
49-
    value["progressbar"].setAlpha(0.5)
49+
50
	
51
   -- value["progressbar"].setZIndex(10)
52
    --value["progressbar"].setGradient(2)
53
    --value["progressbar"].setColor2(0x33ff00)
54
end
55
56
local offset = 30
57
for key,value in pairs(storages) do
58
	value["label"] = bridge.addText(5,5+offset,"MFSU:",0xC5360F)
59
	value["heatTitle"] = bridge.addText(5,15+offset,"E",0x000000)
60
	value["heatTitle"].setScale(0.7)
61
	value["progressbar"] = bridge.addBox(10,15+offset,50,5,0x0033ff,0.9)
62
    value["progressbar"].setZIndex(10)
63
    value["progressbar"].setGradient(2)
64
    value["progressbar"].setColor2(0x66ccff)
65
    value["progressbarmarker"] = bridge.addBox(10,15+offset,1,5,0x000000,1)
66
    value["progressbarmarker"].setZIndex(11)
67
end
68
69
local heat, maxheat, curHeat
70
71
72
73
while true do
74
	for i=#machines,1,-1 do
75
			
76
			machine = machines[i]
77
		if (net.isPresentRemote(machine["id"])) then
78
			
79
			heat = net.callRemote(machine["id"],"getHeat")
80
			maxHeat = net.callRemote(machine["id"],"getMaxHeat")
81
			curHeat = width / maxHeat * heat
82
			
83
			--machine["outputValue"].setText(outInfo)
84
			machine["progressbarmarker"].setX(10 + curHeat)
85
		end
86
	end
87
88
	for i=#storages,1,-1 do
89
			storage = storages[i]
90
		if (net.isPresentRemote(storage["id"])) then
91
			stored = net.callRemote(storage["id"],"getStored")
92
			capacity = net.callRemote(storage["id"],"getCapacity")
93
			curStored = width / capacity * stored
94
			
95
			storage["progressbarmarker"].setX(10 + curStored)
96
		end
97
	end
98
99
100
	os.sleep(0.5)
101
end
102
103
104
105
-- arguments: x, y, width, width, color, opacity
106
-- mybox = bridge.addBox(0,0,80,40,0x0099FF,0.7)
107
108
-- arguments: x, y, text, color
109
-- mytext = bridge.addText(10, 10, "hello!", 0xCC0000)