Utoxin

Tomb Guard Soldier

Jan 10th, 2014
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Code for a turtle acting as a Guard for the Tomb of the Unknown Soldier
  2.  
  3. -- Place turtle at northern end of the path (with tomb to it's left), and place
  4. -- fuel in turtle's inventory. If it drops below 100 fuel, it will stop at the
  5. -- northern end of the path, and wait for someone to refuel it, and then
  6. -- auto-resume
  7.  
  8. while true do
  9.   if turtle.getFuelLevel() < 100 then
  10.     print("Out of fuel! Waiting for more...")
  11.     repeat
  12.       os.sleep(10)
  13.       for i=1,16 do
  14.         turtle.select(i)
  15.         turtle.refuel()
  16.       end
  17.     until turtle.getFuelLevel() >= 100
  18.   end
  19.   os.sleep(21)
  20.   for i=1,21 do
  21.     repeat
  22.       local success = turtle.forward()
  23.     until success
  24.   end
  25.   turtle.turnLeft()
  26.   os.sleep(21)
  27.   turtle.turnLeft()
  28.   os.sleep(21)
  29.   for i=1,21 do
  30.     repeat
  31.       local success = turtle.forward()
  32.     until success
  33.   end
  34.   turtle.turnRight()
  35.   os.sleep(21)
  36.   turtle.turnRight()
  37. end
Advertisement
Add Comment
Please, Sign In to add comment