Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Youtube http://www.youtube.com/user/gnoor1s
- --Made by Gnoor1s/Gunnar
- --Most of this code is over engineered
- --But it's fun
- --User changeable if needed
- local fuelSlot = 16
- local supplySlot = 15
- local homeBlockSlot = 2 --The slot for comparison for home location
- local checkHome = true
- --Do not change (developers variables)
- local lastSlot = 0
- local t = turtle
- local running = true
- local version = "b2.9.1"
- function init()
- term.clear()
- term.setCursorPos(1, 1)
- print("Living Creator, version "..version)
- print("Made by GNOOR1S on YouTube")
- end
- function isBlockForward() -- Turtle breaking block if not forward
- while not t.forward() do
- t.dig()
- end
- fuel()
- end
- function fuel()
- if t.getFuelLevel() <= 10 then
- lastSlot = t.getSelectedSlot()
- t.select(fuelSlot)
- t.refuel(1)
- t.select(lastSlot)
- end
- if t.getFuelLevel() <= 1 then
- print("Ran Out of fuel")
- running = false
- end
- end
- function collectBlocks()
- print("Collecting Blocks")
- fuel()
- t.dig()
- isBlockForward()
- t.dig()
- isBlockForward()
- t.dig()
- isBlockForward()
- t.turnLeft()
- for i = 1, 2 do
- t.dig()
- isBlockForward()
- end
- fuel()
- t.turnLeft()
- for i = 1, 2 do
- t.dig()
- isBlockForward()
- end
- t.turnLeft()
- t.dig()
- isBlockForward()
- isBlockForward()
- t.turnLeft()
- fuel()
- t.back()
- end
- --Placing Blocks
- function placeBlocks()
- print("Placing Blocks")
- t.select(supplySlot)
- fuel()
- t.up()
- isBlockForward()
- for i = 1, 2 do
- t.placeDown()
- isBlockForward()
- end
- t.placeDown()
- fuel()
- t.turnLeft()
- for i = 1, 2 do
- t.placeDown()
- isBlockForward()
- end
- fuel()
- t.placeDown()
- t.turnLeft()
- for i = 1, 2 do
- t.placeDown()
- isBlockForward()
- end
- t.turnLeft()
- t.placeDown()
- isBlockForward()
- t.placeDown()
- isBlockForward()
- t.turnLeft()
- t.back()
- t.down()
- end
- --Start of code
- init()
- while running do
- sleep(5)
- if t.getItemCount(supplySlot) <= 7 then
- print("Put resources in slot '15'")
- break
- end
- if t.getItemCount(1) >= 1 then
- while true do
- t.select(1)
- if t.compare() == true then
- if t.getItemCount(supplySlot) >= 8 then
- print("Starting Methods")
- print("")
- sleep(5)
- collectBlocks()
- t.select(supplySlot)
- placeBlocks()
- if checkHome then
- lastSlot = t.getSelectedSlot()
- t.select(homeBlockSlot)
- if not t.compareDown() then
- running = false
- print("Turtle did not land in the right location")
- end
- t.select(lastSlot)
- end
- else
- print("Put resources in slot '15'")
- running = false
- break
- end
- else
- sleep(5)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement