Advertisement
TheKingElessar

Untitled

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