Advertisement
Utoxin

Botania Lava Supply

Nov 30th, 2014
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. local robot = require("robot")
  2. local os = require("os")
  3.  
  4. local lavaInBucket = false;
  5.  
  6. function checkFlower(direction)
  7.     print("Checking flower to the", direction)
  8.  
  9.     if (lavaInBucket == false) then
  10.         result, description = robot.useDown()
  11.         print(result, description)
  12.         lavaInBucket = true
  13.     end
  14.    
  15.     if (direction == "right") then
  16.         robot.turnRight()
  17.     else
  18.         robot.turnLeft()
  19.     end
  20.    
  21.     robot.forward()
  22.     robot.forward()
  23.     robot.forward()
  24.    
  25.     result, description = robot.detectDown()
  26.     print (result, description)
  27.     if (description == "air") then
  28.         result, description = robot.useDown()
  29.         print(result, description)
  30.         lavaInBucket = false
  31.     end
  32.    
  33.     robot.back()
  34.     robot.back()
  35.     robot.back()
  36.  
  37.     if (direction == "right") then
  38.         robot.turnLeft()
  39.     else
  40.         robot.turnRight()
  41.     end
  42. end
  43.  
  44. while true do
  45.     checkFlower("right")
  46.     checkFlower("left")
  47.     os.sleep(20)
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement