Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fuelSlot = 1
- local torchSlot = 2
- local firstItem,lastItem = 3,16
- local currentHeigt = 1
- local currentLen = 1
- local currentWith = 2
- local startHeight = 1
- local startLen = 1
- local startWith = 2
- local tunnel length = 0
- local fuelBarrel = nil
- local torchBarrel = nil
- local NORTH = 1
- local EAST = 2
- local SOUTH = 3
- local WEST = 4
- local currentFace = NORTH
- function placeAll(all)
- local start = firstItem
- if(all) then
- start = 1
- end
- local i = firstItem
- while i <= lastItem do
- turtle.select(i)
- turtle.drop()
- if not turtle.getItemDetail() then
- i = i + 1
- else
- print("Chest is full, stopping")
- exit()
- end
- end
- end
- function checkAndReset()
- local lookingAt = nil
- local itemData = nil
- lookingAt, itemData = turtle.inspect()
- if lookingAt then
- if string.match(itemData.name, "chest") then
- print("Found Chest")
- placeAll(true)
- else
- print("Missing loot Chest")
- return false
- end
- else
- print("Missing loot Chest")
- return false
- end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- lookingAt, itemData = turtle.inspect()
- if lookingAt then
- if string.match(itemData.name, "barrel") then
- print("found barrel")
- turtle.select(1)
- turtle.suck()
- item = turtle.getItemDetail()
- turtle.drop()
- if item then
- if string.match(item.name, "coal") then
- fuelBarrel = 1
- elseif string.match(item.name, "torch") then
- torchBarrel = 1
- else
- print("Missing coal or torch in barrel")
- return false
- end
- else
- print("Missing coal or torch in barrel")
- return false
- end
- else
- print("Missing coal or torch barrel")
- return false
- end
- else
- print("Missing coal or torch barrel")
- return false
- end
- turtle.up()
- lookingAt, itemData = turtle.inspect()
- if lookingAt then
- if string.match(itemData.name, "barrel") then
- print("found barrel")
- turtle.select(1)
- turtle.suck()
- item = turtle.getItemDetail()
- turtle.drop()
- if item then
- if string.match(item.name, "coal") then
- fuelBarrel = 2
- elseif string.match(item.name, "torch") then
- torchBarrel = 2
- else
- print("Missing coal or torch in barrel")
- return false
- end
- else
- print("Missing coal or torch in barrel")
- return false
- end
- else
- print("Missing coal or torch barrel")
- return false
- end
- else
- print("Missing coal or torch barrel")
- return false
- end
- turtle.down()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- return true
- end
- function setDirection(direction)
- local turnAmount = currentFace - direction
- if turnAmount == 1 or turnAmount == -3 then
- turtle.turnRight()
- end
- if turnAmount == 2 or turnAmount == -2 then
- turtle.turnRight()
- turtle.turnRight()
- end
- if turnAmount == -1 or turnAmount == 3 then
- turtle.turnLeft()
- end
- end
- function Main()
- if checkAndReset() then
- print("All good")
- else
- print("sumting wong")
- end
- setDirection(NORTH)
- setDirection(EAST)
- setDirection(SOUTH)
- setDirection(WEST)
- setDirection(NORTH)
- setDirection(WEST)
- setDirection(SOUTH)
- setDirection(EAST)
- setDirection(NORTH)
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement