Advertisement
TheKingElessar

Untitled

Jul 6th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 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. print("Brick check")
  24. local inspectSuccess, inspectData = turtle.inspect()
  25. if(inspectSuccess) then
  26. if(string.match(inspectData, "chest")) then
  27. suckNowForward = false
  28. end
  29. end
  30.  
  31. inspectSuccess, inspectData = turtle.inspectUp()
  32. if(inspectSuccess) then
  33. if(string.match(inspectData, "chest")) then
  34. suckNowUp = false
  35. end
  36. end
  37.  
  38. if(suckNowForward) then
  39. local suckForward = turtle.suck()
  40.  
  41. if(suckForward) then
  42. print("Suck forward")
  43. currentBrickCount = 0
  44. for i = 1, 16 do
  45. if(turtle.getItemDetail(i) == not nil) then
  46. local name = turtle.getItemDetail(i).name
  47. local count = turtle.getItemDetail(i).count
  48.  
  49. if((not name == not nil) or (not count == not nil)) then
  50. if(string.match(name, "brick")) then
  51. currentBrickCount = currentBrickCount + count
  52. end
  53. end
  54. end
  55. end
  56. end
  57. end
  58. if(currentBrickCount > previousBrickCount) then
  59. Scream()
  60. end
  61. end
  62.  
  63. function Tick()
  64. CheckForBricks()
  65.  
  66. Reset()
  67. end
  68.  
  69. while true do
  70. Tick()
  71. end
  72.  
  73. function FeelPain()
  74.  
  75.  
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement