Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- startX = 728
- startY = 253
- startZ = -169
- function gotoNextChunkCenter()
- local x,y,z = gps.locate()
- local nextX = x + 16
- while x ~= nextX or z ~= startZ do
- x,y,z = gps.locate()
- turtle.refuel()
- if x ~= nextX then
- if x > nextX then
- turtle.back()
- else
- turtle.forward()
- end
- end
- if z ~= startZ then
- turtle.turnRight()
- if z > startZ then
- turtle.back()
- else
- turtle.forward()
- end
- turtle.turnLeft()
- end
- end
- end
- RelativePosition = {x = 0, y = 0, z = 0}
- function RelativePosition:new ()
- self.x = 0
- self.y = 0
- self.z = 0
- return self
- end
- BLOCK_IDS = {
- digiminer = "mekanism:digital_miner",
- tesseract = "mekanism:quantum_entangloporter",
- fluxpoint = "fluxnetworks:flux_point",
- modem = "computerecraft:wired_modem_full",
- }
- function findItemSlot(itemName)
- print("Finding item '"..itemName.."'...")
- for i=1,16 do
- print(" Testing slot "..i)
- turtle.select(i)
- item = turtle.getItemDetail()
- if item then
- print(" - Slot contains "..item.name)
- if item.name == itemName then
- return i
- end
- else
- print(" - Slot is nil")
- end
- end
- return -1
- end
- function deconstructDigiminerComplex()
- turtle.equipLeft()
- --- Dig entangloporter
- turtle.forward()
- turtle.forward()
- turtle.up()
- turtle.digUp()
- turtle.down()
- turtle.back()
- turtle.back()
- --- Dig fluxpoint
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.digUp()
- turtle.back()
- turtle.back()
- turtle.turnLeft()
- --- Mine digiminer
- turtle.digUp()
- end
- function constructDigiminerComplex()
- digiminerSlot = findItemSlot(BLOCK_IDS.digiminer)
- tesseractSlot = findItemSlot(BLOCK_IDS.tesseract)
- fluxpointSlot = findItemSlot(BLOCK_IDS.fluxpoint)
- modemSlot = findItemSlot(BLOCK_IDS.modem)
- --- place digiminer
- turtle.select(digiminerSlot)
- turtle.placeUp()
- --- place entangloporter
- turtle.forward()
- turtle.forward()
- turtle.up()
- turtle.select(tesseractSlot)
- turtle.placeUp()
- turtle.down()
- turtle.back()
- turtle.back()
- --- place fluxpoint
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.select(fluxpointSlot)
- turtle.placeUp()
- turtle.back()
- turtle.back()
- turtle.turnLeft()
- end
- function main()
- while true do
- local digiminer = peripheral.wrap("top")
- if peripheral.getType(digiminer) ~= "digitalMiner" then
- print("Loop broken: Digiminer not found above turtle")
- return -1
- end
- local toMine = digiminer.getToMine()
- if toMine ~= 0 then
- print("Digminer still mining with "..toMine.." left to go. Sleeping for 1 miunte...")
- os.sleep(60)
- else
- print("Digiminer finished mining. Starting relocation process...")
- print(" Deconstructing digiminer complex...")
- deconstructDigiminerComplex()
- print(" Digiminer complex deconstructed!")
- print(" Moving to next chunk...")
- gotoNextChunkCenter()
- print(" Reached next chunk!")
- print(" Constructing digiminer complex...")
- constructDigiminerComplex()
- print(" Constructed digiminer complex!")
- digiminer = peripheral.wrap("top")
- if peripheral.getType(digiminer) ~= "digitalMiner" then
- print("Loop broken: Digiminer not found above turtle after relocation")
- return -1
- end
- digiminer.start()
- end
- end
- end
- deconstructDigiminerComplex()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement