Advertisement
Guest User

killbot

a guest
May 25th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. --Drake's Minecraft Killbot (ComputerCraft mod)
  2.  
  3. --moving the computer in a strafe like fashion (as opposed to 'normal' movement)
  4. function strafe(direction)
  5.  
  6.     if direction == "right" then
  7.         turtle.turnRight()
  8.         turtle.forward()
  9.         turtle.turnLeft()
  10.     elseif direction == "left" then
  11.         turtle.turnLeft()
  12.         turtle.forward()
  13.         turtle.turnRight()
  14.     end    
  15. end
  16.  
  17. --menu displaying user options
  18. function menu()
  19.     print("Running Drake's Killbot Prototype...\n")
  20.     print("Please choose from the following actions:\n")
  21.     print("1. Create and detonate bomb.")
  22.     print("2. Murder Shawn.")
  23.     term.write("Your answer:")
  24.     answer = read()
  25.     return answer
  26. end
  27.  
  28. --informing user of fuel warning
  29. if turtle.getFuelLevel() == 0 then
  30.     print("WARNING: NO FUEL LOADED.")
  31. end
  32.  
  33. --getting requested killbot action  
  34. action = menu()
  35.  
  36. --user selects action: bomb
  37. --REQUIREMENTS:
  38. --3 TNT slot 1, 10 redstone slot 2, 1 redstone torch slot 3
  39. if action == "1" then
  40.     print("Initiating bombing sequence...")    
  41.     for i = 1,10 do
  42.         turtle.forward()
  43.     end
  44.        --placing center front bomb
  45.     turtle.select(1)
  46.     turtle.place()
  47.    
  48.     --placing right front block
  49.     strafe("right")
  50.     turtle.place()
  51.    
  52.     --left front block
  53.     strafe("left")
  54.     strafe("left")
  55.     turtle.place()
  56.    
  57.     --recentering
  58.     strafe("right")
  59.    
  60.     --placing redstone while backing up to original position
  61.     turtle.select(2)
  62.     for i = 1,10 do
  63.         turtle.back()
  64.         turtle.place()
  65.     end
  66.    
  67.         --placing the redstone torch
  68.     turtle.back()
  69.     turtle.select(3)
  70.     turtle.place()
  71.    
  72.     --retrieving redstone torch after placing
  73.     turtle.dig()
  74.     turtle.suck()
  75.    
  76. --user selects action: kill shawn
  77. elseif answer == "2" then
  78.     print("Feature not yet added :(")
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement