Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monitor=peripheral.wrap("back")
- rednet.open("bottom")
- mapInfo={
- {13,1,128},
- {14,1,128},
- {15,1,128},
- {16,1,128},
- {17,1,128},
- {13,2,128},
- {14,2,256},
- {15,2,256},
- {16,2,256},
- {17,2,128},
- {13,3,128},
- {14,3,256},
- {15,3,256},
- {16,3,256},
- {17,3,128},
- {13,4,128},
- {14,4,128},
- {15,4,128},
- {16,4,128},
- {17,4,128},
- {14,5,128},
- {15,5,256},
- {16,5,128},
- {14,6,256},
- {15,6,256},
- {16,6,128},
- {14,7,128},
- {15,7,256},
- {16,7,128},
- {14,8,128},
- {15,8,256},
- {16,8,128},
- {14,9,128},
- {15,9,256},
- {16,9,128},
- {14,10,128},
- {15,10,256},
- {16,10,128},
- {14,11,256},
- {15,11,256},
- {16,11,128},
- {14,12,128},
- {15,12,256},
- {16,12,128},
- {14,13,128},
- {15,13,256},
- {16,13,128},
- {14,14,128},
- {15,14,256},
- {16,14,128},
- {14,16,128},
- {15,16,256},
- {16,16,128},
- {14,15,256},
- {15,15,256},
- {16,15,128},
- {14,16,128},
- {15,16,128},
- {16,16,128},
- {11,10,128},
- {12,10,128},
- {13,10,128},
- {11,11,128},
- {12,11,256},
- {13,11,256},
- {11,12,128},
- {12,12,128},
- {13,12,128},
- {11,14,128},
- {12,14,256},
- {13,14,128},
- {11,16,128},
- {12,16,256},
- {13,16,128},
- {11,15,128},
- {12,15,256},
- {13,15,256},
- {11,16,128},
- {12,16,256},
- {13,16,128},
- {11,16,128},
- {12,16,128},
- {13,16,128},
- {10,4,128},
- {11,4,128},
- {12,4,128},
- {13,4,128},
- {10,5,128},
- {11,5,256},
- {12,5,256},
- {13,5,256},
- {10,6,128},
- {11,6,256},
- {12,6,256},
- {13,6,256},
- {10,7,128},
- {11,7,256},
- {12,7,256},
- {13,7,256},
- {10,8,128},
- {11,8,128},
- {12,8,128},
- {13,8,128},
- }
- fieldsInfo={
- {15,4,"securityField",false},
- {14,11,"reactorfield",false},
- {15,13,"hallwayfield",false},
- }
- function drawMap()
- monitor.setBackgroundColor(32768)
- monitor.clear()
- for id,data in pairs(mapInfo) do
- x=data[1]
- y=data[2]
- backGroundColor=data[3]
- monitor.setCursorPos(x,y)
- monitor.setBackgroundColor(backGroundColor)
- monitor.write(" ")
- end
- for id,data in pairs(fieldsInfo) do
- x=data[1]
- y=data[2]
- monitor.setCursorPos(x,y)
- monitor.setBackgroundColor(16384)
- monitor.write(" ")
- end
- end
- drawMap()
- function checkPress()
- event,side,x,y=os.pullEvent("monitor_touch")
- for id,data in pairs(fieldsInfo) do
- if x>=data[1]-1 and x<=data[1]+1 and y>=data[2]-1 and y<=data[2]+1 then
- if data[4]==true then
- data[4]=false
- monitor.setBackgroundColor(16384)
- else
- data[4]=true
- monitor.setBackgroundColor(8192)
- end
- rednet.broadcast(data[3])
- monitor.setCursorPos(data[1],data[2])
- monitor.write(" ")
- end
- end
- maxx,maxy=monitor.getSize()
- monitor.setBackgroundColor(512)
- monitor.setCursorPos(maxx-5,maxy)
- x=tostring(x)
- y=tostring(y)
- if string.len(x)<2 then
- x=" "..x
- end
- if string.len(y)<2 then
- y=y.." "
- end
- monitor.write(x ..","..y)
- end
- while true do checkPress() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement