Advertisement
Guest User

clean

a guest
Nov 13th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. print("Pillage the lands")
  2. print("Rape the Earth")
  3.  
  4. t = turtle
  5. kills = 0
  6.  
  7. function forceForward()
  8.   if t.forward() == false then
  9.     t.attack()
  10.     t.dig()
  11.     forrceForward()
  12.   end
  13. end
  14.  
  15. function killTree()
  16.   t.dig()
  17.   t.forward()
  18.   local above = false
  19.   if t.detectUp() then
  20.     above = true
  21.   end
  22.   while above do
  23.     t.digUp()
  24.     t.up()
  25.     above = t.detectUp()
  26.   end
  27.   while t.detectDown() == false do
  28.     t.down()
  29.   end
  30.   kills = kills + 1
  31. end
  32.  
  33. local allowed = {"minecraft:leaves", "minecraft:tallgrass", "minecraft:vine", "minecraft:red_flower", "minecraft:yellow_flower", "minecraft:melon_block"}
  34. function breakable(data)
  35.   for key, value in pairs(allowed) do
  36.     if value == data.name then return true end
  37.   end
  38.   return false
  39. end
  40.  
  41. function step()
  42.   local succF, dF = t.inspect()
  43.   local succU, dU = t.inspectUp()
  44.   local succD, dD = t.inspectDown()
  45.   if succF == false then
  46.     forceForward()
  47.     while t.detectDown() == false do
  48.       t.down()
  49.     end
  50.   else
  51.     if breakable(dF) then
  52.       t.dig()
  53.       forceForward()
  54.       while t.detectDown() == false do
  55.         t.down()
  56.       end
  57.     elseif dF.name == "minecraft:log" then
  58.       killTree()
  59.     else
  60.       if succU == false then
  61.         t.up()
  62.         step()
  63.       else
  64.         if breakable(dU) then
  65.           t.dig()
  66.           t.up()
  67.           step()
  68.         end
  69.       end
  70.     end
  71.   end
  72. end
  73.  
  74. function roam()
  75.   local x = 1
  76.   while x < 50 do
  77.     local i = 0
  78.     while i < 2 do
  79.       t.turnRight()
  80.       local k = 0
  81.       while k < x do        
  82.         step()
  83.         k = k + 1
  84.       end
  85.       i = i + 1
  86.     end
  87.     x = x + 1
  88.   end
  89. end
  90.  
  91. roam()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement