Kasama

LumberJack

Jun 23rd, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.51 KB | None | 0 0
  1. --LightningVoltrix
  2. --------------------------------------------------------------------------------------------------
  3. -- ___   ___         __         ____________         __         ___      ___         __         --
  4. -- |:|   /:/        /::\        |::::::::::|        /::\        |::\    /::|        /::\        --
  5. -- |:|  /:/        /::::\       |::/¨¨¨¨¨¨¨¨       /::::\       |:::\  /:::|       /::::\       --
  6. -- |:| /:/        /::/\::\      |::|              /::/\::\      |::::\/::::|      /::/\::\      --
  7. -- |:|/:/        /::/__\::\     |::\________     /::/__\::\     |::|\::/|::|     /::/__\::\     --
  8. -- |:|\:\       /::/::::\::\    |::::::::::|    /::/::::\::\    |::| \/ |::|    /::/::::\::\    --
  9. -- |:| \:\     /::/¨¨¨¨¨¨\::\   ¨¨¨¨¨¨¨¨\::|   /::/¨¨¨¨¨¨\::\   |::|    |::|   /::/¨¨¨¨¨¨\::\   --
  10. -- |:|  \:\   /::/        \::\          /::|  /::/        \::\  |::|    |::|  /::/        \::\  --
  11. -- |:|   \:\ /::/          \::\ |::::::::::| /::/          \::\ |::|    |::| /::/          \::\ --
  12. -- ¨¨¨   ¨¨¨ ¨¨¨            ¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨            ¨¨¨ ¨¨¨¨    ¨¨¨¨ ¨¨¨            ¨¨¨ --
  13. ----------------------------------------------------------------------------------------Scripts---
  14. ------------------------------------------Lumberjack Turtle---------------------------------------
  15. --------------------------------------------------------------------------------------------------
  16.  
  17. function Move(where)
  18.     if turtle.getFuelLevel() == 0 then
  19.         print("Please put some fuel in the last slot")
  20.         repeat
  21.             turtle.select(16)
  22.             turtle.refuel()
  23.             sleep(2)
  24.         until turtle.getFuelLevel() ~= 0
  25.     else
  26.         if where == "f" then
  27.             turtle.forward()
  28.         elseif where == "b" then
  29.             turtle.back()
  30.         elseif where == "u" then
  31.             turtle.up()
  32.         elseif where == "d" then
  33.             turtle.down()
  34.         end
  35.     end
  36. end
  37.  
  38. function Chest()
  39.     turtle.select(4)
  40.     turtle.turnLeft()
  41.     turtle.drop()
  42.     turtle.suck()
  43.     turtle.turnRight()
  44.     for i=1,3 do
  45.         turtle.select(i)
  46.         turtle.dropDown()
  47.     end
  48.     turtle.select(1)
  49. end
  50.  
  51. function Check()
  52.     turtle.digUp()
  53.     Move("u")
  54.     if turtle.detect() then
  55.         Move("d")
  56.         return true
  57.     else
  58.         Move("d")
  59.         return false
  60.     end
  61. end
  62.  
  63. function Cut()
  64.     turtle.dig()
  65.     Move("f")
  66.     repeat
  67.         t = turtle.digUp()
  68.         Move("u")
  69.     until t == false
  70.     repeat
  71.         Move("d")
  72.     until turtle.detectDown()
  73.     Move("b")
  74.     turtle.select(4)
  75.     turtle.place()
  76.     turtle.select(1)
  77. end
  78.  
  79. while true do
  80.     if Check() then
  81.         Cut()
  82.         Chest()
  83.     end
  84.     sleep(30)
  85. end
Advertisement
Add Comment
Please, Sign In to add comment