local glass = peripheral.wrap('bottom')
rednet.open('right')
local op = 0.4
bridgeS = "..."
lavaS = "..."
manaS = "..."
local P = {
time = {1,1,55,10, 'box',
box = {0xFFFFFF, op},
text = {textutils.formatTime(os.time(), false), 0x000000}
},
bridge = {60,12,55,10, 'box',
box = {0x397fdb, op},
text = {bridgeS, 0xffffff}
},
lava = {60,1,55,10, 'fluid',
fluid = "lava",
text = {lavaS .. "% Lava", 0xffffff}
},
mana = {1,12,55,10, 'box',
box = {0x008000, op},
text = {manaS .. "% Mana", 0xff34b3}
}
}
local function getUpdate()
while true do
local event, ID, mess = os.pullEvent('rednet_message')
if ID == 26 then
manaS = mess
elseif ID == 36 then
lavaS = mess
elseif ID == 16 then
bridgeS = mess and "Open" or 'Closed'
end
end
end
local function commands()
while true do
local event, e1,e2,e3,e4 = os.pullEvent("glasses_chat_command")
if e4 == "bridge" then
rednet.send(16, "zapp")
end
end
end
local function Dis(tName)
if P[tName][5] == 'fluid' then
glass.addFluid(P[tName][1],P[tName][2],P[tName][3],P[tName][4],P[tName].fluid)
else
glass.addBox(P[tName][1],P[tName][2],P[tName][3],P[tName][4],P[tName].box[1],P[tName].box[2])
end
glass.addText(P[tName][1]+5,P[tName][2]+2,P[tName].text[1],P[tName].text[2])
end
function backDis()
glass.addBox(0,0,120,25, 0x000000, op)
end
function updateDis()
while true do
glass.clear()
backDis()
Dis('time')
Dis('mana')
Dis('bridge')
Dis('lava')
glass.sync()
sleep(.1)
end
end
parallel.waitForAny(updateDis, getUpdate, commands)