Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[Copyright PrinceTommen - Script developed for CyanideEpic (twitch.tv/cyanideepic)]]--
- --[[Everyone is allowed to use it as long as you don't pretend it's yours]]--
- --[[Have fun !]]--
- local function setFacingAngle(FacingAngle, WishedFacingAngle)
- if FacingAngle < WishedFacingAngle then
- for DiffFacingAngle = 1, (WishedFacingAngle - FacingAngle) do
- turtle.turnRight()
- FacingAngle = FacingAngle + 1
- end
- elseif FacingAngle > WishedFacingAngle then
- for DiffFacingAngle = 1, (FacingAngle - WishedFacingAngle) do
- turtle.turnLeft()
- FacingAngle = FacingAngle - 1
- end
- end
- return FacingAngle
- end
- local function refuel(coal_slot)
- turtle.select(coal_slot)
- boolRefuel = turtle.refuel(1)
- if boolRefuel then
- refuel_count = 0
- print("Successfully Refueled")
- else
- print("Out of fuel")
- while not(turtle.refuel(1)) do
- setFacingAngle(FacingAngle, FacingAngle + 2)
- setFacingAngle(FacingAngle, FacingAngle - 2)
- end
- end
- turtle.select(1)
- return refuel_count
- end
- local function moveForward(FacingAngle, Boolfb, moving_integer, digUpBool, digDownBool, refuel_count)
- local moving_count = 1
- for moving_count=1,moving_integer do
- if (refuel_count == 80) then
- refuel_count = refuel(2)
- end
- Bool1 = false
- while not(Bool1) do
- if (Boolfb) then
- turtle.dig()
- Bool1 = turtle.forward()
- if (digUpBool) then
- turtle.digUp()
- end
- if (digDownBool) then
- turtle.digDown()
- end
- else
- Bool1 = turtle.back()
- if not(Bool1) then
- setFacingAngle(FacingAngle, (FacingAngle + 2))
- turtle.dig()
- setFacingAngle(FacingAngle, (FacingAngle - 2))
- end
- end
- end
- moving_count = moving_count + 1
- refuel_count = refuel_count + 1
- end
- return refuel_count
- end
- local function moveUp(Boolud, moving_integer, refuel_count)
- local moving_count = 1
- for moving_count=1, moving_integer do
- if (refuel_count == 80) then
- refuel_count = refuel(2)
- end
- Bool2 = false
- while not(Bool2) do
- if (Boolud) then
- turtle.digUp()
- Bool2 = turtle.up()
- else
- turtle.digDown()
- Bool2 = turtle.down()
- end
- end
- moving_count = moving_count + 1
- refuel_count = refuel_count + 1
- end
- return refuel_count
- end
- local function inventoryManagement(saved_slots,refuel_count)
- turtle.select(1)
- n = saved_slots + 1
- repeat
- item_count = turtle.getItemCount(n)
- if (item_count ~= 0) then
- boolSlotOccupied = true
- n = n + 1
- else
- boolSlotOccupied = false
- end
- until (boolSlotOccupied == false) or (n == 17)
- if (n == 17) then
- print("Inventory full")
- FacingAngle = setFacingAngle(FacingAngle, (FacingAngle - 1))
- refuel_count = moveForward(FacingAngle, true, 1, true, false, refuel_count)
- refuel_count = moveForward(FacingAngle, false, 1, false, false, refuel_count)
- turtle.select(3)
- turtle.place()
- for u=(saved_slots+1),16 do
- turtle.select(u)
- turtle.drop()
- end
- turtle.select(1)
- FacingAngle = setFacingAngle(FacingAngle, (FacingAngle + 1))
- end
- return refuel_count
- end
- FacingAngle = 2
- coal_slot = 2
- print("Please place torches in the first slot (upper-left corner), coal in the second one and chests in the third one")
- print("How many parallel tunnels are you willing to dig ?")
- tunnels_integer = read()
- print("How long do you want each tunnel to be ?")
- tunnels_lenght = read()
- print("How many blocks do you want between two tunnels ?")
- tunnels_separation = read()
- print("Your patient and efficient servant is starting his work !")
- local a = 1
- local i = 1
- local refuel_count = 0
- refuel(2)
- refuel_count = moveUp(true, 1, refuel_count)
- for a=1,(tunnels_integer) do
- for i=1,(tunnels_lenght) do
- refuel_count = moveForward(FacingAngle, true, 1, true, true, refuel_count)
- if (0 == i%5) then
- turtle.turnRight()
- turtle.dig()
- turtle.place()
- turtle.turnLeft()
- end
- refuel_count = inventoryManagement(3,refuel_count)
- end
- refuel_count = moveForward(FacingAngle, false, tunnels_lenght, true, true, refuel_count)
- FacingAngle = setFacingAngle(FacingAngle, (FacingAngle - 1))
- refuel_count = moveForward(FacingAngle, true, (tunnels_separation+1), true, true, refuel_count)
- FacingAngle = setFacingAngle(FacingAngle, (FacingAngle - 1))
- refuel_count = moveForward(FacingAngle, true, 1, true, true, refuel_count)
- FacingAngle = setFacingAngle(FacingAngle, (FacingAngle - 1))
- refuel_count = moveForward(FacingAngle, true, (tunnels_separation), true, true, refuel_count)
- refuel_count = moveForward(FacingAngle, false, (tunnels_separation), true, true, refuel_count)
- FacingAngle = setFacingAngle(FacingAngle, (FacingAngle + 1))
- refuel_count = moveForward(FacingAngle, false, 1, true, true, refuel_count)
- turtle.select(1)
- turtle.place()
- FacingAngle = setFacingAngle(FacingAngle, (FacingAngle + 2))
- end
Add Comment
Please, Sign In to add comment