Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MonSide = "back"
- local Bside = "front"
- local Bcol = colors.lightGray
- mon = peripheral.wrap(MonSide)
- local xMax,yMax = mon.getSize()
- Door = {}
- Door[1] = { 2, 3,10, 6,"Haustuer",colors.pink ,false}
- Door[2] = {12, 3,20, 6,"Bad" ,colors.lime ,false}
- Door[3] = {22, 3,30, 6,"Tuer 3" ,colors.magenta,false}
- Door[4] = {32, 3,40, 6,"Tuer 4" ,colors.cyan ,false}
- Door[5] = { 2, 8,10,11,"Tuer 5" ,colors.white ,false}
- Door[6] = {12, 8,20,11,"Tuer 6" ,colors.orange ,false}
- Door[7] = {22, 8,30,11,"Tuer 7" ,colors.green ,false}
- Door[8] = {32, 8,40,11,"Tuer 8" ,colors.lime ,false}
- function JoJa(xP,yP)
- mon.setCursorPos(xP,yP)
- mon.setBackgroundColor(colors.gray)
- mon.setTextColor(colors.cyan)
- mon.write("Jo")
- mon.setTextColor(colors.orange)
- mon.write("Ja ")
- mon.setTextColor(colors.lightGray)
- mon.write("Productions")
- end
- function checkButton(xP,yP)
- for i = 1,#Door do
- if xP >= Door[i][1] and xP <= Door[i][3] and
- yP >= Door[i][2] and yP <= Door[i][4]
- then
- if Door[i][7] then
- Door[i][7] = false
- else
- Door[i][7] = true
- end
- end
- end
- end
- function checkButton2()
- for i = 1,#Door do
- if colors.test(rs.getBundledInput(Bside),Door[i][6]) then
- Door[i][7] = true
- else
- Door[i][7] = false
- end
- end
- end
- function openDoor()
- rs.setBundledOutput(Bside,0)
- for i = 1,#Door do
- if Door[i][7] then
- rs.setBundledOutput(Bside,rs.getBundledOutput(Bside)+Door[i][6])
- end
- end
- end
- while true do
- mon.setBackgroundColor(Bcol)
- mon.clear()
- JoJa(xMax/2-8,1)
- for d = 1,#Door do
- if Door[d][7] then
- mon.setBackgroundColor(colors.lime)
- else
- mon.setBackgroundColor(colors.red)
- end
- for xPos = Door[d][1],Door[d][3] do
- for yPos = Door[d][2],Door[d][4] do
- mon.setCursorPos(xPos,yPos)
- mon.write(" ")
- end
- end
- mon.setTextColor(colors.white)
- mon.setCursorPos(Door[d][1]+((Door[d][3]-Door[d][1])/2)-(#Door[d][5]/2),Door[d][2]+((Door[d][4]-Door[d][2])/2))
- mon.write(Door[d][5])
- end
- event,timerID,xPos,yPos = os.pullEvent()
- if event == "monitor_touch" then
- checkButton(xPos,yPos)
- end
- openDoor()
- --checkButton2()
- end
Advertisement
Add Comment
Please, Sign In to add comment