Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- saT1VV7K
- local args = { ... }
- if #args ~= 1 then
- error("Please provide the channel to listen on")
- end
- local modem = peripheral.find("modem")
- if modem == nil or not modem.isWireless() then
- error("Please connect a wireless modem to the pocket computer")
- end
- local channel = tonumber(args[1])
- modem.open(channel)
- term.setPaletteColor(colors.orange, 0x2c2d30) -- discord light
- term.setPaletteColor(colors.magenta, 0x232427) -- discord darker
- term.setPaletteColor(colors.lightBlue, 0x5D5A63) -- discord lighter
- term.setPaletteColor(colors.yellow, 0xA09DA6) -- discord lightest
- term.setPaletteColor(colors.lime, 0xe5e57b) -- discord lightest
- term.setPaletteColor(colors.pink, 0x85818D)
- term.setPaletteColor(colors.gray, 0x07C8F9) -- scanning
- term.setPaletteColor(colors.lightGray, 0x5CB270) -- found ore
- term.setPaletteColor(colors.cyan, 0xf94144) -- bad
- term.setPaletteColor(colors.purple, 0xc77dff) -- storing
- term.setPaletteColor(colors.blue, 0x6A6771) --
- term.setPaletteColor(colors.brown, 0x7C7A81) --
- term.setPaletteColor(colors.green, 0x817F86) --
- local signaled = false
- local mapsx, mapsz
- local mnsx, mnsy
- while true do
- local _, _, senderChannel, _, message = os.pullEvent("modem_message")
- if senderChannel == channel then
- local map = message[1]
- local pos = message[2]
- local dir = message[3]
- local aim = { x = pos.x + dir.x, z = pos.z + dir.z }
- local status = message[4]
- local sx = #map[pos.y]
- local sz = #map[pos.y][0]
- local msx, msy = term.getSize()
- if signaled == false or mapsz ~= sz or mapsx ~= sx or mnsx ~= msx or mnsy ~= msy then
- signaled = true
- term.clear()
- term.setBackgroundColor(colors.magenta)
- mapsx = sx
- mapsz = sz
- mnsy = msy
- mnsx = msx
- end
- term.setCursorPos((msx - sx) * 0.5, (msy - sz) * 0.5)
- local smap = {}
- for i = 0, sz do
- local str = ""
- for j = 0, sx do
- if i == pos.z and j == pos.x then
- if status == 0 then
- str = str .. "5"
- elseif status == 1 then
- str = str .. "7"
- elseif status == 2 then
- str = str .. "8"
- elseif status == 3 then
- str = str .. "9"
- elseif status == 4 then
- str = str .. "a"
- end
- elseif i == aim.z and j == aim.x and map[pos.y][j][i] == 0 then
- str = str .. "b"
- elseif i == aim.z and j == aim.x then
- str = str .. "6"
- else
- -- c is darker mined
- -- 4 is lighter mined
- -- 1 is darker solid
- -- 3 is lighter solid
- if map[pos.y - 1] ~= nil then --
- if map[pos.y][j][i] == 0 then
- if map[pos.y - 1][j][i] == 1 then
- str = str .. "3"
- else
- str = str .. "1"
- end
- else
- if map[pos.y - 1][j][i] == 1 then
- str = str .. "c"
- else
- str = str .. "4"
- end
- end
- else
- if map[pos.y][j][i] == 1 then
- str = str .. "4"
- else
- str = str .. "3"
- end
- end
- end
- end
- smap[i + 1] = str
- end
- for i = 1, #smap do
- term.setCursorPos((msx - sx) * 0.5 + 1, (msy - sz) * 0.5 + i)
- term.blit(string.rep(" ", #smap[i]), smap[i], smap[i])
- end
- term.setCursorPos(2, #smap + 1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement