Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bridge = peripheral.wrap("right")
- local net = peripheral.wrap("back")
- local width = 50
- local machines = {
- {
- ["id"] = "nuclear_reactor_0",
- ["name"] = "Nuclear Reactor"
- }
- }
- function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- bridge.clear()
- for key,value in pairs(machines) do
- value["label"] = bridge.addText(5,5,"Nuclear Reactor:",0xC5360F)
- value["heatTitle"] = bridge.addText(5,15,"H",0x000000)
- value["heatTitle"].setScale(0.7)
- value["progressbar"] = bridge.addBox(10,15,50,5,0xff0000,0.9)
- value["progressbar"].setZIndex(10)
- value["progressbar"].setGradient(2)
- value["progressbar"].setColor2(0x33ff00)
- -- value["progressbar"].setAlpha(0.5)
- value["progressbarmarker"] = bridge.addBox(10,15,1,5,0x000000,1)
- value["progressbarmarker"].setZIndex(11)
- end
- local heat, maxheat, curHeat
- while true do
- for i=#machines,1,-1 do
- machine = machines[i]
- if (net.isPresentRemote(machine["id"])) then
- heat = net.callRemote(machine["id"],"getHeat")
- maxHeat = net.callRemote(machine["id"],"getMaxHeat")
- curHeat = width / maxHeat * heat
- machine["progressbarmarker"].setX(10 + curHeat)
- end
- end
- for i=#storages,1,-1 do
- storage = storages[i]
- if (net.isPresentRemote(storage["id"])) then
- stored = net.callRemote(storage["id"],"getStored")
- capacity = net.callRemote(storage["id"],"getCapacity")
- curStored = width / capacity * stored
- storage["progressbarmarker"].setX(10 + curStored)
- end
- end
- os.sleep(0.5)
- end
- -- arguments: x, y, width, width, color, opacity
- -- mybox = bridge.addBox(0,0,80,40,0x0099FF,0.7)
- -- arguments: x, y, text, color
- -- mytext = bridge.addText(10, 10, "hello!", 0xCC0000)
Advertisement
Add Comment
Please, Sign In to add comment