Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function printStatment()
- print("Loop number:", checkVar)
- percentFuelLevel = (turtle.getFuelLevel() / turtle.getFuelLimit()) * 100
- print("Fuel level: ", math.ceil(percentFuelLevel), "%")
- end
- function dig3x3Func()
- --firstTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --secondTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --thirdTime
- while turtle.detectUp() or turtle.detectDown() do
- turtle.digUp()
- turtle.digDown()
- end
- --rotateForReverse
- turtle.turnLeft()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- turtle.turnLeft()
- --firstTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --secondTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --thirdTime
- while turtle.detectUp() or turtle.detectDown() do
- turtle.digUp()
- turtle.digDown()
- end
- --rotateForDefault
- turtle.turnRight()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- while turtle.detectUp() or turtle.detectDown() do
- turtle.digUp()
- turtle.digDown()
- end
- turtle.turnRight()
- end
- function rotateRightForReverse()
- --firstTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --secondTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --thirdTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --fourTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --fiveTime
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- --sixTime
- while turtle.detectUp() or turtle.detectDown() do
- turtle.digUp()
- turtle.digDown()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- function rotateLeftForReverse()
- turtle.turnLeft()
- turtle.turnLeft()
- while turtle.detect() or turtle.detectUp() or turtle.detectDown() do
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- end
- turtle.forward()
- end
- function fuelFunc(inventoryFuel)
- if turtle.getFuelLevel() < 100 then
- print("need refuel!")
- turtle.select(inventoryFuel)
- turtle.refuel(16)
- print("refuel complete")
- turtle.select(1) --return default
- end
- end
- function chestAndTorchFunc(torch, chest, invCount)
- turtle.digUp()
- turtle.digDown()
- turtle.turnRight()
- turtle.forward()
- turtle.select(chest)
- turtle.placeDown()
- for i = 1, invCount, 1 do -- transferToChest
- turtle.select(i)
- if i == 1 or i == 2 or i == 3 or i == 4 then
- turtle.dropDown(turtle.getItemCount(i) - 1)
- else
- turtle.dropDown(64)
- end
- end
- turtle.back()
- turtle.select(torch)
- turtle.place()
- turtle.turnLeft()
- turtle.select(1) --return default
- end
- function checkInventory(invCount) -- количество слотов под ресурсы
- inventoryFull = invCount * 64
- inventoryCurrent = 0
- for i = 1, invCount, 1 do
- inventoryCurrent = inventoryCurrent + turtle.getItemCount(i)
- end
- invResult = (inventoryCurrent / inventoryFull) * 100
- percentInventoryLevel = (inventoryCurrent / inventoryFull) * 100
- print("inventoryLevel: ", math.ceil(percentInventoryLevel), "%")
- end
- function whiteList(invCount) -- количество слотов под ресурсы
- for i = 1, 13, 1 do
- turtle.select(i)
- if turtle.compareTo(1) == false and turtle.compareTo(2) == false and turtle.compareTo(3) == false and turtle.compareTo(4) == false then
- turtle.drop()
- end
- end
- turtle.select(1) --return default
- end
- --Main #######################################################################################################################################
- --count of main loop
- countLoops = 5000
- checkVar = 0
- for i = 1, countLoops, 1 do
- checkVar = checkVar + 1
- printStatment()
- checkInventory(13)
- fuelFunc(14)
- dig3x3Func()
- if (checkVar % 50) == 0 and (checkVar % 100) ~= 0 then
- rotateRightForReverse()
- print("RIGHT")
- end
- if (checkVar % 50) == 0 and (checkVar % 100) == 0 then
- rotateLeftForReverse()
- print("LEFT")
- end
- if checkVar % 5 == 0 then
- whiteList(13)
- end
- if invResult > 85 then
- chestAndTorchFunc(15, 16, 13)
- end
- print(" ")
- end
- print("Loop end")
- -- pastebin get 99PrJLVv Porniii
Advertisement
Add Comment
Please, Sign In to add comment