Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local comp = require("component")
- local ev = require("event")
- local tun = comp.tunnel
- local g = comp.gpu
- local resW, resH = g.getResolution()
- resH = resH * 2
- local cx = resW / 2
- local cy = resH / 2
- g.setBackground(0x777777)
- g.setForeground(0x777777)
- for ix = 0, resW - 1 do
- for iy = 0, resH - 1 do
- g.set(ix, iy,"▀")
- end
- end
- g.setBackground(0x000000)
- g.setForeground(0xFFFFFF)
- local rx = 0
- local ry = 0
- local function gSet(x, y, col)
- local ry = y / 2
- if y % 2 == 0 then
- local _, ofg, obg = g.get(x, ry)
- g.setForeground(col)
- g.setBackground(obg)
- g.set(x, ry, "▀")
- else
- local _, ofg, obg = g.get(x, ry)
- g.setForeground(ofg)
- g.setBackground(col)
- g.set(x, ry, "▀")
- end
- end
- local ex = false
- while not ex do
- local _, _, _, _, _, cmd, cmdX,cmdY = ev.pull("modem_message")
- if cmd == "in" then
- gSet(cx + cmdX, cy + cmdY, 0x00FF00)
- end
- if cmd == "out" then
- gSet(cx + cmdX, cy + cmdY, 0x000000)
- end
- if cmd == "block" then
- gSet(cx + cmdX, cy + cmdY, 0xFFFFFF)
- end
- if cmd == "end" then
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement