Advertisement
ecco7777

CC multiplayer irgendwas

Feb 26th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. rednet.open("right")
  2. info={}
  3. x,y=term.getSize()
  4. x=math.floor(x/2)
  5. y=math.floor(y/2)
  6. term.clear()
  7. while true do
  8. event,side,channel,id,message,bol = os.pullEvent()
  9. if event=="modem_message" then
  10. if message["char"]~=nil then
  11. term.setCursorPos(message["x"],message["y"])
  12. term.write(message["char"])
  13. end
  14. end
  15. if event=="key" then
  16. key=side
  17. if key==208 then
  18. char="v"
  19. y=y+1
  20. end
  21.  
  22. if key==200 then
  23. char="^"
  24. y=y-1
  25. end
  26.  
  27. if key==205 then
  28. char=">"
  29. x=x+1
  30. end
  31.  
  32. if key==203 then
  33. char="<"
  34. x=x-1
  35. end
  36.  
  37. info["char"]=char
  38. info["x"]=x
  39. info["y"]=y
  40. term.setCursorPos(x,y)
  41. term.write(char)
  42. rednet.broadcast(info)
  43. end
  44.  
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement