Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --fly the drone with a tablet in openComputer mod
- --table requires internet card + wireless network card while drone requires wireless network card + custom eeprom program
- component = require("component")
- m = component.modem
- m.broadcast(2412,"d=component.proxy( component.list(\"drone\")())")
- side = "0"
- while true do
- table = {coroutine.yield()}
- if table[1] == "key_down" then
- if table[3] == 119 and table[4] == 17 then
- print("w")
- m.broadcast(2412,"d.move(1,0,0)")
- elseif table[3] == 115 and table[4] == 31 then
- print("s")
- m.broadcast(2412,"d.move(-1,0,0)")
- elseif table[3] == 97 and table[4] == 30 then
- print("a")
- m.broadcast(2412,"d.move(0,0,-1)")
- elseif table[3] == 100 and table[4] == 32 then
- print("d")
- m.broadcast(2412,"d.move(0,0,1)")
- elseif table[3] == 32 and table[4] == 57 then
- print("space")
- m.broadcast(2412,"d.move(0,1,0)")
- elseif table[3] == 0 and table[4] == 29 then
- print("ctrl")
- m.broadcast(2412,"d.move(0,-1,0)")
- elseif table[3] == 56 and table[4] == 72 then
- print("forward")
- side = "3"
- elseif table[3] == 0 and table[4] == 203 then
- print("left")
- side = "5"
- elseif table[3] == 54 and table[4] == 77 then
- print("right")
- side = "4"
- elseif table[3] == 50 and table[4] == 80 then
- print("back")
- side = "2"
- elseif table[3] == 57 and table[4] == 73 then
- print("up")
- side = "1"
- elseif table[3] == 51 and table[4] == 81 then
- print("down")
- side = "0"
- elseif table[3] == 49 and table[4] == 2 then
- print("1")
- m.broadcast(2412,"d.select(1)")
- elseif table[3] == 50 and table[4] == 3 then
- print("2")
- m.broadcast(2412,"d.select(2)")
- elseif table[3] == 51 and table[4] == 4 then
- print("3")
- m.broadcast(2412,"d.select(3)")
- elseif table[3] == 52 and table[4] == 5 then
- print("4")
- m.broadcast(2412,"d.select(4)")
- end
- elseif table[1] == "touch" then
- if table[5] == 0 then
- print("left_click")
- m.broadcast(2412,"d.swing("..side..")")
- elseif table[5] == 1 then
- print("right_click")
- m.broadcast(2412,"d.place("..side..")")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement