Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FUELVALUE = 0
- Facing = 0
- MASTERID = 0
- ACTIVE = true
- ChestX,ChestY,ChestZ = 0,0,0
- FuelX,FuelY,FuelZ = 0,0,0
- StartX,StartY,StartZ = 0,0,0
- SavedX,SavedY,SavedZ = 0,0,0
- DISTANCETOHOMEBASE = 0
- function SetChestCoords(x,y,z)
- ChestX = x
- ChestY = y
- ChestZ = z
- end
- function SetFuelCoords(x,y,z)
- FuelX = x
- FuelY = y
- FuelZ = z
- end
- function SetSavedCoords(x,y,z)
- SavedX = x
- SavedY = y
- SavedZ = z
- end
- function SetStartCoords(x,y,z)
- StartX = x
- StartY = y
- StartZ = z
- end
- function EnterWaitModeAndReturnMessage()
- local id,message,protocol = rednet.receive()
- return id,message,protocol
- end
- function MySplit (inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- table.insert(t, str)
- end
- return t
- end
- function InitTurtle()
- local id, fuelMessage = EnterWaitModeAndReturnMessage()
- local id, chestMessage = EnterWaitModeAndReturnMessage()
- local fuelCoords = MySplit(fuelMessage)
- local chestCoords = MySplit(chestMessage)
- local currentX,currentY,currentZ = gps.locate()
- SetFuelValue(1)
- SetFuelCoords(fuelCoords[1],fuelCoords[2],fuelCoords[3])
- print(("%d %d %d"):format(fuelCoords[1],fuelCoords[2],fuelCoords[3]))
- print(("%d %d %d"):format(chestCoords[1],chestCoords[2],chestCoords[3]))
- SetChestCoords(chestCoords[1],chestCoords[2],chestCoords[3])
- SetStartCoords(currentX,currentY,currentZ)
- SetSavedCoords(currentX,currentY,currentZ)
- end
- InitTurtle()
Advertisement
Add Comment
Please, Sign In to add comment