Advertisement
Guest User

Grief Program by Taking1n1

a guest
Jul 1st, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. -- GRIEF PROGRAM
  2. -- by Taking1n1
  3.  
  4. -- // Slot definitions \\
  5. -- 1: TNT blocks
  6. -- 2: Redstone
  7. -- 3: Any block, only used if there are holes
  8.  
  9. -- Goes forward and finds the building
  10. steps = 0
  11. goDown = 0
  12. while true do
  13.    
  14.     turtle.forward()
  15.     steps = steps + 1
  16.    
  17.     if not turtle.detectDown() then -- If there are no blocks below
  18.         turtle.select(3)
  19.         turtle.placeDown()
  20.         turtle.select(1)
  21.     end
  22.    
  23.     if turtle.detect() then
  24.         break
  25.     end
  26.    
  27. end
  28.  
  29. -- Found the building, prepare
  30. turtle.back()
  31. turtle.select(1)
  32.  
  33. -- Sets up TNT
  34. while true do
  35.    
  36.     turtle.forward()
  37.    
  38.     if turtle.detect() then -- If there is a block in front of you
  39.    
  40.         turtle.back()
  41.         turtle.place()
  42.        
  43.         if turtle.detectUp() then -- If there is a block above us
  44.             break
  45.         end
  46.        
  47.         turtle.up()
  48.         goDown = goDown + 1
  49.        
  50.     else
  51.         turtle.back()
  52.         break
  53.     end
  54.    
  55.     if turtle.getItemCount(1) == 0 then  -- If we've ran out of TNT
  56.         break
  57.     end
  58.    
  59. end
  60.  
  61. -- Goes back down
  62. while goDown ~= 0 do
  63.     turtle.down()
  64.     goDown = goDown - 1
  65. end
  66.  
  67. -- Offset the steps
  68. steps = steps - 1
  69.  
  70. -- Gos back and places redstone along
  71. turtle.select(2)
  72. while steps ~= 0 do
  73.    
  74.     turtle.back()
  75.     steps = steps - 1
  76.     turtle.place()
  77.    
  78.     if turtle.getItemCount(2) == 0 then  -- If we've ran out of redstone
  79.         redstone.setOutput("front", true)
  80.         redstone.setOutput("front", false)
  81.     end
  82.    
  83. end
  84.  
  85. -- Detonates the bomb
  86. redstone.setOutput("front", true)
  87. sleep(1)
  88. redstone.setOutput("front", false)
  89.  
  90. -- We are finished
  91. print("The deed is done.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement