Advertisement
osmarks

ThingDigger

Sep 21st, 2019
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local placer = "left"
  2. local laser = "right"
  3.  
  4. local function find_slot()
  5.     for i = 1, 16 do
  6.         if turtle.getItemCount(i) == 0 then
  7.             return true
  8.         end
  9.     end
  10.     return false
  11. end
  12.  
  13. local function pulse(side)
  14.     rs.setOutput(side, true)
  15.     sleep(0.2)
  16.     rs.setOutput(side, false)
  17.     sleep(0.2)
  18. end
  19.  
  20. local function is_non_stone(front)
  21.     local exists, what = turtle.inspect()
  22.     return exists and type(what) == "table" and what.name ~= "minecraft:stone"
  23. end
  24.  
  25. local function is_stone(front)
  26.     local exists, what = turtle.inspect()
  27.     return exists and type(what) == "table" and what.name == "minecraft:stone"
  28. end
  29.  
  30. while true do
  31.     repeat sleep() until turtle.detect()
  32.     repeat pulse(laser) print "attempting conversion to ore" until is_non_stone()
  33.     if find_slot() then turtle.dig() end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement