Advertisement
Guest User

QuarryReceiver 2.3.3

a guest
Jan 13th, 2013
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.81 KB | None | 0 0
  1. --Made for version 2.3.3
  2. side = nil
  3. tArgs = {...}
  4. if tArgs[1] ~= nil then
  5. side = tArgs[1]
  6. end
  7.  
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. if not side then
  11. print("Modem Side?")
  12. side = io.read()
  13. end
  14. rednet.open(side)
  15. pass = false
  16. repeat
  17. print("Computer #"..os.getComputerID().." is waiting for turtle message")
  18. turt, initCheck, dist = rednet.receive()
  19. if initCheck == "Initial Confirm" then
  20. sleep(1)
  21. print("Turtle Confirmed! Program Functioning")
  22. rednet.send(turt, "Host Confirm")
  23. pass = true
  24. end
  25. until pass == true
  26.  
  27. receivedMessages = 0
  28.  
  29. while pass do
  30. receivedMessages = receivedMessages + 1
  31. turtCheck, message, dist = rednet.receive()
  32. if turtCheck == turt then
  33. rednet.send(turt, "Quarry Confirm")
  34. if message == "Stop" then
  35. pass = false
  36. _, final, _ = rednet.receive()
  37. final = textutils.unserialize(final)
  38. term.clear()
  39. term.setCursorPos(1,1)
  40. print("Turtle Done!")
  41. print("Fuel: "..final.fuel)
  42. print("Blocks Mined: "..final.mined)
  43. print("Cobble: "..final.cobble)
  44. print("Other Raw: "..final.sand)
  45. print("Other: "..final.other)
  46.  
  47. else --The display section until end
  48.  
  49. message = textutils.unserialize(message)
  50. term.clear()
  51. term.setCursorPos(1,1)
  52. print("Mine Dimensions: "..message.length.." x "..message.width.." x "..
  53.     message.height)
  54. print("Turtle #"..message.ID)
  55. print("Fuel: "..message.fuel)
  56. print("Percent Complete: "..message.percent.."%")
  57. print("")
  58. print("Blocks Mined: "..message.blocksMined)
  59. print("Moved Blocks: "..message.blocksMoved.." out of "..message.volume)
  60. print("Blocks remaining: "..message.blocksLeft)
  61. print("")
  62. print("Rows done this layer: "..message.finishedWidth)
  63. print("On Layer: "..message.finishedLayers)
  64. print("")
  65. if message.finishedWidth == message.width then
  66. print("Turtle moving to next layer...")
  67. rows = 0
  68. else
  69. term.clearLine()
  70. end
  71. end
  72. end
  73. end
  74. rednet.close(side)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement