TovLenin

upravlenue

Feb 27th, 2014
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. function controls()
  2. print("Controls")
  3. print("W - forward; S - back; A - left; D - right;")
  4. print("E/R/T - dig/up/down;")
  5. print("C/V/B - place/up/down;")
  6. print("Shift - down; space - up;")
  7. print("Arrows - move slot;")
  8. print("G - gps")
  9. print("H - refuel")
  10. print("Fuel: ".. t.getFuelLevel())
  11. print("Slot: "..slot.."; in slot - "..t.getItemCount(slot).." items")
  12. end
  13.  
  14. t=turtle
  15. slot=1
  16. t.select(slot)
  17.  
  18. while true do
  19. term.clear()
  20. term.setCursorPos(1, 1)
  21. controls()
  22. e, keycode = os.pullEvent("key")
  23. if keycode == 17 then t.forward()
  24. elseif keycode == 31 then t.back()
  25. elseif keycode == 42 then t.down()
  26. elseif keycode == 30 then t.turnLeft()
  27. elseif keycode == 32 then t.turnRight()
  28. elseif keycode == 57 then t.up()
  29. elseif keycode == 35 then t.refuel(64)
  30. elseif keycode == 203 then
  31. slot=slot-1
  32. if slot==0 then
  33. slot=1
  34. else
  35. end
  36. t.select(slot)
  37. elseif keycode == 205 then
  38. slot=slot+1
  39. if slot==17 then
  40. slot=16
  41. else
  42. end
  43. t.select(slot)
  44. elseif keycode == 200 then
  45. slot=slot-4
  46. if slot==0 or slot==-1 or slot==-2 or slot==-3 then
  47. slot=slot+4
  48. else
  49. end
  50. t.select(slot)
  51. elseif keycode == 208 then
  52. slot=slot+4
  53. if slot==20 or slot==17 or slot==18 or slot==19 then
  54. slot=slot-4
  55. else
  56. end
  57. t.select(slot)
  58. elseif keycode == 18 then t.dig()
  59. elseif keycode == 19 then t.digUp()
  60. elseif keycode == 20 then t.digDown()
  61. elseif keycode == 46 then t.place()
  62. elseif keycode == 47 then t.placeUp()
  63. elseif keycode == 48 then t.placeDown()
  64. elseif keycode == 16 then os.reboot()
  65. end
  66. end
Advertisement
Add Comment
Please, Sign In to add comment