Fussel01

schaf

Apr 14th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. -- Install a chest on the backside from Shearing Turtle!
  2.  
  3. local maxitem   = 3         -- MaxItems in Slot -> Chest
  4. local sfreq     = 1.5       -- Shearing Frequenz (seconds)
  5. local switch    = "bottom"  -- ON/OFF Switch; H = OFF, L = ON
  6. -----------------------------------------------------------
  7.  
  8. function _rotate()          -- rotate Turtle 180°
  9.   turtle.turnRight()
  10.   turtle.turnRight()
  11. end
  12.  
  13. function _drop()            -- Drop Items[Index/slot(s)] to chest
  14.   _rotate()
  15.   for k = 1, 16, 1 do
  16.     while turtle.getItemCount(k) >= 1 do
  17.         turtle.select(k)
  18.         turtle.drop()
  19.     end
  20.   end  
  21.   _rotate()
  22. end
  23.  
  24. function _shearing()
  25.     for i = 1, 10, 1 do     -- Low Overhead ->
  26.         turtle.attack()     -- shearing
  27.         sleep(sfreq)
  28.     end                     -- <- Low Overhead
  29. end
  30.  
  31. function _checkslots()
  32.     for j = 1 ,16, 1 do     -- check Slots
  33.         if turtle.getItemCount(j) > maxitem then
  34.             _drop()
  35.         end
  36.     end
  37.     turtle.select(1)   
  38. end
  39.  
  40. while true do
  41.     if rs.getInput(switch) == false then
  42.         _shearing()
  43.         _checkslots()
  44.     else
  45.         sleep(2)
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment