TheKingElessar

Untitled

Jul 6th, 2020
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. x = 1667
  2. y = 41
  3. z = -4143
  4. suckNowForward = true
  5. suckNowUp = true
  6. currentBrickCount = 0
  7. previousBrickCount = 0
  8. painCount = 0
  9.  
  10. function Scream()
  11. local speaker = peripheral.find("speaker")
  12. speaker.playSound("quark:entity.stoneling.die", math.random(0, 3), math.random(0, 2))
  13. print("Pain: ", currentBrickCount)
  14. end
  15.  
  16. function Reset()
  17. suckNowForward = true
  18. suckNowUp = true
  19. previousBrickCount = currentBrickCount
  20. end
  21.  
  22. function CheckForBricks()
  23. local inspectSuccess, inspectData = turtle.inspect()
  24. if(inspectSuccess) then
  25. if(string.match(inspectData, "chest")) then
  26. suckNowForward = false
  27. end
  28. end
  29.  
  30. inspectSuccess, inspectData = turtle.inspectUp()
  31. if(inspectSuccess) then
  32. if(string.match(inspectData, "chest")) then
  33. suckNowUp = false
  34. end
  35. end
  36.  
  37. if(suckNowForward) then
  38. local suckForward = turtle.suck()
  39.  
  40. if(suckForward) then
  41. currentBrickCount = 0
  42. for i = 1, 16 do
  43. local name = turtle.getItemDetail(i).name
  44. local count = turtle.getItemDetail(i).count
  45.  
  46. if((not name == nil) or (not count == nil)) then
  47. if(string.match(name, "brick")) then
  48. currentBrickCount = currentBrickCount + count
  49. end
  50. end
  51. end
  52. end
  53. end
  54. if(currentBrickCount > previousBrickCount) then
  55. Scream()
  56. end
  57. end
  58.  
  59. function Tick()
  60. CheckForBricks()
  61.  
  62. Reset()
  63. end
  64.  
  65. while true do
  66. Tick()
  67. end
  68.  
  69. function FeelPain()
  70.  
  71.  
  72. end
Add Comment
Please, Sign In to add comment