Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- host = 3
- status = "Inactive"
- pos = vector.new(gps.locate())
- function chopTree()
- local modem = peripheral.find("modem")
- rednet.open("left")
- status = "Chopping"
- while turtle.detect() do
- turtle.dig()
- turtle.digUp()
- turtle.up()
- pos = vector.new(gps.locate())
- end
- status = "Returning"
- while not turtle.detect() and not turtle.detectDown() do
- turtle.down()
- pos = vector.new(gps.locate())
- end
- turtle.select(1)
- turtle.place()
- turtle.select(2)
- status = "Idle"
- end
- function farmTree()
- while true do
- turtle.select(2)
- if(turtle.compare()) then
- chopTree()
- turtle.turnLeft()
- turtle.turnLeft()
- for i=3, 16 do
- turtle.select(i)
- if(turtle.compareTo(1)) then
- print("same!")
- turtle.transferTo(1)
- else
- turtle.drop()
- end
- end
- turtle.select(1)
- turtle.suckDown()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- if(turtle.getFuelLevel() < 20) then
- status = "Waiting for Fuel"
- for i=3, 16 do
- turtle.select(i)
- turtle.refuel()
- end
- turtle.select(1)
- end
- end
- end
- function rangeCheck()
- while true do
- if rednet.receive("failsafe") == null then
- os.shutdown()
- end
- sleep(1)
- end
- end
- function transmit()
- while(true) do
- local sender, message, protocol = rednet.receive("ping")
- if(message ~= nil and message == "send") then
- rednet.send(host, os.getComputerLabel() .. " " .. turtle.getFuelLevel() .. " " .. pos.x .. " " .. pos.y .." " .. pos.z .. " " .. status, "miners")
- sleep(0.5)
- end
- end
- end
- parallel.waitForAny(farmTree, rangeCheck, transmit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement