Advertisement
largeNumberGoeshere

unmnt.lua

Apr 25th, 2021
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. --unmnt
  2.  
  3. diskDriveId = "computercraft:disk_drive"
  4. defaultDir = "/tmp/disk/"
  5.  
  6. local driveSlot = 16
  7. local floppySlot= driveSlot - 1
  8.  
  9. function getBlock(inspectInDirection)
  10.         a,b = inspectInDirection()
  11.         local name = b.name
  12.         return name
  13. end
  14.  
  15. function getSideWith(bockName)
  16.         local up  = getBlock(turtle.inspectUp)
  17.         local down= getBlock(turtle.inspectDown)
  18.         local fwd = getBlock(turtle.inspect)
  19.        
  20.         if up == bockName then
  21.                 return "up"
  22.         elseif down == bockName then
  23.                 return "down"
  24.         elseif fwd == bockName then
  25.                 return "fwd"
  26.         else
  27.                 return "none"
  28.         end
  29.        
  30.        
  31.        
  32.        
  33. end
  34.  
  35. function digSideWithDrive()
  36.         local side = getSideWith(diskDriveId)
  37.         if side         == "none" then
  38.                 error("disk drive not found")
  39.                
  40.         elseif side == "down" then
  41.                 turtle.digDown()
  42.         elseif side == "fwd" then
  43.                 turtle.dig()
  44.         elseif side == "up" then
  45.                 turtle.digUp()
  46.         end
  47. end
  48.  
  49. turtle.select(floppySlot)
  50. digSideWithDrive()
  51. shell.setDir(defaultDir)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement