Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This program is for OpenCCSensors 0.1.2
- -- Monitor to be placed above the computer
- -- Sensor peripheral to be placed below the computer
- -- Inventory sensor card in the sensor (any level of card)
- -- A chest should be below the sensor, with a map in slot 1
- os.loadAPI("ocs/apis/sensor")
- local monitor = peripheral.wrap("top")
- local inventory = sensor.wrap("bottom")
- local width, height = monitor.getSize()
- local function getColorIndex(x, y)
- return ((x-1) + (y-1) * 128) + 1
- end
- local function drawPixel(x, y, color)
- monitor.setCursorPos(x, y)
- monitor.setBackgroundColor(color)
- monitor.write(" ")
- end
- local function displayMapColors(colors)
- for x=1, width do
- for y=1, height do
- local index = getColorIndex(x, y)
- local color = colors[index]
- drawPixel(x, y, color)
- end
- end
- end
- local mapData = inventory.sensorCardCall("getMapData", "0,-1,0", 1)
- displayMapColors(mapData.Colors)
Advertisement
Add Comment
Please, Sign In to add comment