Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local liquidGap = 0 -- set to 1 if placing water and lava needs a gap
- local fuelMin = 100 -- minimum amount of fuel to keep at
- local itemID = {
- buildingMaterial = { name = "minecraft:cobblestone", niceName = "cobblestone", requirementDetails = "", }, -- feel free to change this, make sure it's not flammable
- fuel = {name = "minecraft:coal", niceName = "coal or charcoal", requirementDetails = "", }, -- includes charcoal -- if you want to you can change this
- waterBucket = { name = "minecraft:lapis_block"--[["minecraft:water_bucket"]], niceName = "water bucket", requirementDetails = "", },
- lavaBucket = { name = "minecraft:netherrack"--[["minecraft:lava_bucket"]], niceName = "lavaBucket", requirementDetails = "", },
- miningTurtle = { name = "computercraft:CC-Turtle", damage = 1, niceName = "mining turtle", requirementDetails = "", },
- badTurtle = { name = "computercraft:CC-TurtleExpanded", niceName = "unknown non-mining turtle", requirementDetails = "", },
- diskDrive = { name = "computercraft:CC-Peripheral", damage = 0, niceName = "disk drive", requirementDetails = "", },
- disk = { name = "computercraft:disk", niceName = "disk", requirementDetails = "Please make sure that it's empty, I may delete things.", },
- pickaxe = { name = "minecraft:diamond_pickaxe", damage = 0, niceName = "diamond pickaxe", requirementDetails = "Undamaged please, I can't use broken tools.", },
- chest = { name = "minecraft:chest", niceName = "chest", requirementDetails = "", },
- sign = {name = "minecraft:sign", niceName = "sign", requirementDetails = "", },
- }
- local oldLabel = os.getComputerLabel()
- oldError = error
- local function error(message, level)
- os.setComputerLabel(oldLabel)
- if type(level) ~= "number" or type(level) ~= "nil" then error("Error level must be a number", 2) end
- level = level or 0
- oldError(message, level + 1)
- end
- local function termClear()
- term.setCursorPos(1,1)
- term.clear()
- end
- local coverLava = nil
- local coverLavaBlockCost = 20
- local buildingRequirements = {
- buildingMaterial = 114,
- waterBucket = 12,
- lavaBucket = 20,
- miningTurtle = 4,
- diskDrive = 1,
- disk = 1,
- pickaxe = 1,
- fuel = 64,
- chest = 2,
- sign = 2,
- }
- local currentInventory = {
- buildingMaterial = 0,
- waterBucket = 0,
- lavaBucket = 0,
- miningTurtle = 0,
- diskDrive = 0,
- disk = 0,
- pickaxe = 0,
- fuel = 0,
- chest = 0,
- sign = 0,
- }
- -----------------------
- -- Utility functions --
- -----------------------
- local function selectEmptySlot()
- local function checkItem()
- return turtle.getItemCount() == 0
- end
- if checkItem() then return true end
- for i = 1, 16 do
- turtle.select(i)
- if checkItem() then
- return true
- end
- end
- return false -- could not find an empty slot
- end
- local dropOffChest = {1, 7, 1}
- local fuelChest = {9, 7, 9} -- TODO: hang onto the fuel chest until lava is deployed, may need to dump things in it temporarily
- local storageChest = dropOffChest
- local goTo
- local function selectItem(item)
- local function checkItem()
- local i = turtle.getItemDetail()
- if i and i.name == item.name and (item.damage == nil or i.damage == item.damage) then
- return true
- else
- return false
- end
- end
- if checkItem() then return true end
- for i = 1, 16 do
- turtle.select(i)
- if checkItem() then
- return true
- end
- end
- goTo(storageChest)
- -- TODOL check storage
- return false -- could not find item
- end
- local function checkFuel() -- refuel if we need to, complain if we can't
- while turtle.getFuelLevel() < fuelMin do
- if selectItem(itemID.fuel) then
- while turtle.refuel(1) and turtle.getFuelLevel() < fuelMin do
- end
- print("refuelled")
- else
- print("Please add a fuel item")
- local ol = os.getComputerLabel()
- os.setComputerLabel("More fuel please")
- os.pullEvent("turtle_inventory") -- wait until the user does something with the inventory
- os.setComputerLabel(ol)
- end
- end
- end
- termClear()
- print("It is advised that users test how the turtle places a water bucket below itself (sometimes a gap is needed). If a gap is required for placement then edit this program and set the variable 'liquidGap' to 1, this will ensure that the program makes a gap before placing water or lava. (Press any key to continue, terminate to exit)")
- os.setComputerLabel("Waiting for user input")
- os.pullEvent("key")
- termClear()
- print("Please ensure that all walls and the floor have no holes and that there is nothing in the build area.")
- print("When you say to continue I'm going to look for the corner of the space. If you want to do this for me then please place me facing the wall with a wall on my right.")
- print("Also, I may ask for fuel, please give me coal or charcoal. (Press any key to continue)")
- os.setComputerLabel("Waiting for user input")
- os.pullEvent("key")
- -- find a corner
- os.setComputerLabel("looking for a corner")
- termClear()
- print("looking for a corner")
- checkFuel()
- -- TODO: OPTIONAL: find corner may be able to make more efficient
- -- Do a spin to check if we are in a corner
- while not turtle.detect() do
- checkFuel()
- turtle.forward()
- end
- turtle.turnRight()
- while not turtle.detect() do
- checkFuel()
- turtle.forward()
- end
- while turtle.down() do
- checkFuel()
- end
- -----------------
- -- API Fetcher --
- -----------------
- local LAMA_URL = "https://raw.githubusercontent.com/KingofGamesYami/LAMA/master/lama.lua"
- -- Credit where due, this snippet is adapted from: http://www.computercraft.info/forums2/index.php?/topic/24253-monitor-touchscreen-woes/page__view__findpost__p__228877
- if not lama then
- if not (fs.exists("lama") or fs.exists(shell.resolve("lama"))) then
- print("Could not find LAMA API, attempting to download from github.")
- if http then
- if http.checkURL(LAMA_URL) then
- local r = http.get(LAMA_URL)
- local f = fs.open("lama","w")
- f.write(r.readAll())
- f.close()
- r.close()
- print("Successfully downloaded LAMA API")
- else
- error("Could not download LAMA API. Please whitelist the URL or manually download LAMA (saving the file as 'lama', make sure to not have a file extension): "..LAMA_URL)
- end
- else
- error("Could not download LAMA API. Please enable http or manually download LAMA (saving the file as 'lama', make sure to not have a file extension): "..LAMA_URL)
- end
- os.loadAPI(shell.resolve("lama"))
- else os.loadAPI(fs.exists("lama") and "lama" or shell.resolve("lama")) end
- lama.overwrite()
- end
- lama.setPosition(1,1,1,"north")
- local goToSource = [[
- local loc = ...
- if type(loc) ~= "table" then error("require table", 2) end
- if #loc ~= 3 or type(loc[1]) ~= "number" or type(loc[1]) ~= "number" or type(loc[1]) ~= "number" then error("malformed table, should be 3 numbers", 2) end
- local pos = {lama.getPosition()}
- if pos[1] ~= loc[1] then
- if pos[1] > loc[1] then
- -- rotate until facing west
- while pos[4] ~= "west" do
- turtle.turnRight()
- pos = {lama.getPosition()}
- end
- else
- -- rotate until facing east
- while pos[4] ~= "east" do
- turtle.turnRight()
- pos = {lama.getPosition()}
- end
- end
- -- go until we are there
- while pos[1] ~= loc[1] do
- checkFuel()
- turtle.forward()
- pos = {lama.getPosition()}
- end
- end
- if pos[3] ~= loc[3] then
- if pos[3] > loc[3] then
- -- rotate until facing north
- while pos[4] ~= "north" do
- turtle.turnRight()
- pos = {lama.getPosition()}
- end
- else
- -- rotate until facing south
- while pos[4] ~= "south" do
- turtle.turnRight()
- pos = {lama.getPosition()}
- end
- end
- -- go until we are there
- while pos[3] ~= loc[3] do
- checkFuel()
- turtle.forward()
- pos = {lama.getPosition()}
- end
- end
- if pos[2] ~= loc[2] then
- local verticalAction
- if pos[2] > loc[2] then
- verticalAction = turtle.down
- else
- verticalAction = turtle.up
- end
- while pos[2] ~= loc[2] do
- checkFuel()
- verticalAction()
- pos = {lama.getPosition()}
- end
- end
- ]]
- goTo = loadstring(goToSource)
- -- check if we have a pickaxe equipped
- if selectEmptySlot() then
- turtle.equipLeft()
- local checkRight = true
- local r = turtle.getItemDetail()
- if r then
- if r.name == itemID.pickaxe.name then
- currentInventory.pickaxe = currentInventory.pickaxe + 1
- checkRight = false
- end
- turtle.equipLeft() -- reEquip the item, even if it was not a pickaxe
- end
- if checkRight then -- if we already have a pickaxe, don't bother with what is on the right side
- if selectEmptySlot() then
- turtle.equipRight()
- local r = turtle.getItemDetail()
- if r then
- if r.name == itemID.pickaxe.name then
- currentInventory.pickaxe = currentInventory.pickaxe + 1
- end
- turtle.equipLeft()-- reEquip the item, even if it was not a pickaxe
- end
- end
- end
- end
- os.setComputerLabel("Waiting for user input")
- repeat
- termClear()
- print("Do you want me to cover the lava so that you can't step in it? I will need extra blocks (I'll change my request to account for this) (Y/N)")
- local _, c = os.pullEvent("char")
- c = string.upper(c)
- if c == "Y" then coverLava = true
- elseif c == "N" then coverLava = false
- end
- until coverLava ~= nil
- if coverLava then
- buildingRequirements.buildingMaterial = buildingRequirements.buildingMaterial + coverLavaBlockCost
- end
- local gotEverything = false
- local ready = false
- local event = {}
- local neededItems = {}
- --[[
- os.setComputerLabel("I need resources")
- local prevInv = {}
- os.queueEvent("turtle_inventory") -- force first scan of inventory
- repeat
- -- TODO: check scope
- if event[1] == "turtle_inventory" then
- -- check inventory
- termClear()
- print("Scanning inventory")
- for i = 1, 16 do
- local _, currentItem = turtle.getItemDetail()
- if type(currentItem) == "table" then
- if currentItem.name == itemID.buildingMaterial.name then
- currentInventory.buildingMaterial = currentInventory.buildingMaterial + currentItem.count - prevInv[i].count -- TODO: what if the swap the item with a different one?
- -- TODO: reject excess resources?
- -- TODO: add check for badTurtle in inventory
- elseif currentItem.name == itemID.fuel.name then
- currentInventory.fuel = currentInventory.fuel + currentItem.count - prevInv[i].count
- -- TODO: reject two stacks of fuel?
- elseif currentItem.name == itemID.waterBucket.name then
- currentInventory.waterBucket = currentInventory.waterBucket + currentItem.count - prevInv[i].count
- -- TODO: sort water
- elseif currentItem.name == itemID.lavaBucket.name then
- currentInventory.lavaBucket = currentInventory.lavaBucket + currentItem.count - prevInv[i].count
- -- TODO: sort lava
- elseif currentItem.name == itemID.miningTurtle.name then
- if currentItem.damage ~= itemID.miningTurtle.damage then
- -- TODO: figure out how to identify turtles cleanly
- -- Placed turtles are easier to check
- -- place, check, dig, store each turtle?
- print("Turtle in not a mining turtle. Turtle shroud be a stone/iron turtle (NOT gold), and have a pickaxe on the left side. Additionally, they should NOT be labelled.")
- end
- currentInventoryminingTurtle = currentInventory.miningTurtle + currentItem.count - prevInv[i].count
- elseif currentItem.name == itemID.diskDrive.name and currentItem.damage == itemID.diskDrive.damage then
- -- TODO: sort disk drive
- currentInventory.diskDrive = currentInventory.diskDrive + currentItem.count - prevInv[i].count
- elseif currentItem.name == itemID.disk.name then
- -- TODO: sort disk
- currentInventory.disk = currentInventory.disk + currentItem.count - prevInv[i].count
- elseif currentItem.name == itemID.pickaxe.name then
- if currentInventory.pickaxe ~= 0 then
- termClear()
- print("I already have a pickaxe equipped, I don't need another. Please remove.")
- os.pullEvent("turtle_inventory")
- end
- if currentItem.damage ~= itemID.pickaxe.damage then
- termClear()
- print("I can't use damaged tools. Please remove.")
- os.pullEvent("turtle_inventory")
- else
- turtle.equipLeft()
- currentInventory.pickaxe = currentInventory.pickaxe + 1
- print("Pickaxe equipped")
- end
- elseif currentItem.name == ItemID.badTurtle.name then
- -- TODO: reject bad turtle
- elseif currentItem.name == ItemID.sign then
- -- TODO: place sign with text on chests
- else
- print("Unexpected item in slot "..tostring(turtle.getSelectedSlot())..", please remove.")
- end
- end
- prevInv[i] = currentItem
- end
- end
- -- TODO: neededItemTotalCount calc more efficient
- local neededItemTotalCount = 0
- for k, v in pairs(itemID) do
- -- TODO: fix bug
- neededItems.k = buildingRequirements.k - currentInventory.k
- neededItemTotalCount = neededItemTotalCount + neededItems.k
- end
- -- TODO: redo everything
- term.setCursorPos(1,1)
- term.clear()
- print("If I stop at any time then look at my label, I will tell you there if I need something or if I'm done.")
- print("I need some things before I can begin.")
- print("Can you put in my inventory the following:")
- print("(I will reduce these numbers as you add things.)")
- print("Please give me the turtles first, I'll need to use them as extra storage.")
- -- TODO: use niceName
- -- TODO: recheck requirements
- -- TODO: have chests now, turtles not needed for temp storage
- print("")
- print(tostring(buildingRequirements[miningTurtle] - currentInventory[miningTurtle]).." mining turtles (non-advanced)")
- print(tostring(buildingRequirements[buildingMaterial] - currentInventory[buildingMaterial]).." blocks of cobblestone,")
- print(tostring(buildingRequirements[waterBucket] - currentInventory[waterBucket]).." water buckets,")
- print("")
- print(tostring(buildingRequirements[lavaBucket] - currentInventory[lavaBucket]).." lava buckets")
- print(tostring(buildingRequirements[diskDrive] - currentInventory[diskDrive]).." disk drive")
- print(tostring(buildingRequirements[disk] - currentInventory[disk]).." disk")
- print(tostring(buildingRequirements[pickaxe] - currentInventory[pickaxe]).." diamond pickaxe")
- print("")
- print("I'm also going to want a good amount of fuel, a stack should be plenty but I'll change my label if I run out. P.S. I only know how to use coal and charcoal, so if you like to use something else you will have to quit this program (Command-T on MacOS - Oh no the 4th wall!).")
- if neededItemTotalCount == 0 then
- print("That's everything, should I get started? (Y/N)")
- if event[1] == "char" then
- if string.upper(event[2]) == "Y" then
- ready = true
- end
- end
- end
- event = {os.pullEvent()}
- until ready
- --]]
- -- place bottom layer
- os.setComputerLabel("Placing layer 1/3")
- local pattern = {}
- local patternSize = 9
- local currentY = 2
- local function fillPatternWith(value)
- if type(value) ~= "boolean" then error("value must be boolean",2) end
- for j = 1, patternSize do
- pattern[j] = {}
- for i = 1, patternSize do
- pattern[j][i] = value
- end
- end
- end
- do -- pattern
- fillPatternWith(true)
- pattern[3][2] = false
- pattern[7][2] = false
- pattern[2][3] = false
- pattern[4][3] = false
- pattern[6][3] = false
- pattern[8][3] = false
- pattern[3][4] = false
- pattern[5][4] = false
- pattern[7][4] = false
- pattern[4][5] = false
- pattern[6][5] = false
- pattern[3][6] = false
- pattern[5][6] = false
- pattern[7][6] = false
- pattern[2][7] = false
- pattern[4][7] = false
- pattern[6][7] = false
- pattern[8][7] = false
- pattern[3][8] = false
- pattern[7][8] = false
- end
- local function placeLayer(pattern,item)
- if type(pattern) ~= "table" then error("pattern must be table of tables of booleans",2) end
- -- TODO: OPTIONAL: arg checking
- -- TODO: could this be made more efficient?
- for j = 1, patternSize do
- for i = 1, patternSize do
- goTo({j, currentY, i})
- if pattern[j][i] then
- checkFuel()
- print("item: "..tostring(item.niceNamee))
- if not selectItem(item) then error("can't select item: "..item.niceName) end
- while not turtle.placeDown() do end
- end
- end
- end
- end
- placeLayer(pattern, itemID.buildingMaterial)
- -- place middle layer
- os.setComputerLabel("Placing layer 2/3")
- currentY = 3
- do -- pattern
- fillPatternWith(false)
- pattern[2][1] = true
- pattern[4][1] = true
- pattern[6][1] = true
- pattern[8][1] = true
- pattern[1][2] = true
- pattern[5][2] = true
- pattern[9][2] = true
- pattern[1][4] = true
- pattern[9][4] = true
- pattern[2][5] = true
- pattern[8][5] = true
- pattern[1][6] = true
- pattern[9][6] = true
- pattern[1][8] = true
- pattern[5][8] = true
- pattern[9][8] = true
- pattern[2][9] = true
- pattern[4][9] = true
- pattern[6][9] = true
- pattern[8][9] = true
- end
- placeLayer(pattern, itemID.buildingMaterial)
- -- place water
- do -- pattern
- fillPatternWith(false)
- pattern[3][1] = true
- pattern[7][1] = true
- pattern[1][3] = true
- pattern[5][3] = true
- pattern[9][3] = true
- pattern[3][5] = true
- pattern[7][5] = true
- pattern[1][7] = true
- pattern[5][7] = true
- pattern[9][7] = true
- pattern[3][9] = true
- pattern[7][9] = true
- end
- currentY = 3 + liquidGap
- placeLayer(pattern, itemID.waterBucket)
- -- place top layer
- os.setComputerLabel("Placing layer 3/3")
- currentY = 4
- do -- pattern
- fillPatternWith(false)
- pattern[3][1] = true
- pattern[7][1] = true
- pattern[2][2] = true
- pattern[4][2] = true
- pattern[6][2] = true
- pattern[8][2] = true
- pattern[1][3] = true
- pattern[5][3] = true
- pattern[9][3] = true
- pattern[2][4] = true
- pattern[4][4] = true
- pattern[6][4] = true
- pattern[8][4] = true
- pattern[3][5] = true
- pattern[7][5] = true
- pattern[2][6] = true
- pattern[4][6] = true
- pattern[6][6] = true
- pattern[8][6] = true
- pattern[1][7] = true
- pattern[5][7] = true
- pattern[9][7] = true
- pattern[2][8] = true
- pattern[4][8] = true
- pattern[6][8] = true
- pattern[8][8] = true
- pattern[3][9] = true
- pattern[7][9] = true
- end
- placeLayer(pattern, itemID.buildingMaterial)
- -- place lava (and cover if told)
- os.setComputerLabel("Placing lava")
- currentY = 4 + liquidGap
- do -- pattern
- fillPatternWith(false)
- pattern[3][2] = true
- pattern[7][2] = true
- pattern[2][3] = true
- pattern[4][3] = true
- pattern[6][3] = true
- pattern[8][3] = true
- pattern[3][4] = true
- pattern[5][4] = true
- pattern[7][4] = true
- pattern[4][5] = true
- pattern[6][5] = true
- pattern[3][6] = true
- pattern[5][6] = true
- pattern[7][6] = true
- pattern[2][7] = true
- pattern[4][7] = true
- pattern[6][7] = true
- pattern[8][7] = true
- pattern[3][8] = true
- pattern[7][8] = true
- end
- placeLayer(pattern, itemID.lavaBucket)
- currentY = 5
- os.setComputerLabel("Covering Lava")
- placeLayer(pattern, itemID.buildingMaterial)
- -- place and program turtles
- os.setComputerLabel("Deploying Turtles")
- -- multi line string can't have comments in
- -- this basically needs to copy lama and cobbleGen onto the turtle which runs it and make a startup file for cobbleGen
- -- TODO: check all below
- local diskStartupSource = [[-- TODO: put double square brackets here
- fs.copy("/disk/lama", "/lama")
- local c = fs.open("/disk/cobbleGen","r")
- local f = fs.open("/cobbleGen","w")
- f.writeLine("local homePos = "..textutils.serialise(pos))
- f.write(c.readAll())
- f.close()
- c.close()
- f = fs.open("/startup","w")
- f.writeLine("shell.run(\"cobbleGen\")")
- f.close()
- if not lama then
- os.loadAPI("lama")
- lama.overwrite()
- lama.setPosition(table.unpack(pos))
- end
- local stateFile = "stateFile"
- f.writeLine("mine")
- turtle.down()
- os.reboot()
- ]]
- local cobbleGenSource = [[-- TODO: put double square brackets here
- local fuelSlot = 1
- local function checkFuel()
- if turtle.getFuelLevel < 30 then
- turtle.select(fuelSlot)
- turtle.refuel(1)
- end
- end
- ]]..goToSource.."\ndropOffChest = "..textutils.serialise(dropOffChest)..
- "\nfuelChest = "..textutils.serialise(fuelChest).."\n".. [[-- TODO: put double square brackets here
- if not lama then
- os.loadAPI("lama")
- lama.overwrite()
- end
- local stateFile = "stateFile"
- local tergetFuelItemCount = 10
- local states = {
- mine = "mine",
- dropOff = "dropOff",
- goHome = "goHome",
- }
- local f = fs.open(stateFile, "r")
- local currentState = f.readAll()
- f.close()
- local function setState(newState)
- if not states[newState] then error("invalid state", 2) end
- local f = fs.open(stateFile, "w")
- f.writeLine(states[newState])
- f.close()
- currentState = newState
- end
- local function getFuel()
- goTo(fuelChest)
- turtle.select(fuelSlot)
- turtle.suckUp(tergetFuelItemCount)
- end
- local function lowFuelItemCount()
- turtle.select(fuelSlot)
- if turtle.getItemCount() < 5 then
- return true
- else
- return false
- end
- end
- while true do
- if state == states.mine then
- while turtle.down() do end
- -- check inventory
- if turtle.getSelectedSlot() == fuelSlot then
- turtle.select(fuelSlot + 1)
- end
- if turtle.getSelectedSlot() ~= 16 or turtle.getItemCount() ~= 64 then
- repeat
- if turtle.getItemCount() == 64 then
- turtle.select(turtle.getSelectedSlot() + 1)
- end
- turtle.dig()
- turtle.turnRight()
- until turtle.getSelectedSlot() == 16 and turtle.getItemCount() == 64
- end
- goTo(homePos)
- setState(states.dropOff)
- elseif state == states.dropOff then
- if lowFuelItemCount() then
- getFuel()
- end
- goTo(dropOffChest)
- elseif state == states.goHome then
- if lowFuelItemCount() then
- getFuel()
- end
- goTo(homePos)
- setState(states.mine)
- else
- local _, i = turtle.inspectUp()
- if type(i) == "table" and i.name == "minecraft:flowing_lava" then
- turtle.up()
- os.setComputerLabel("ERROR!")
- error("bad state")
- end
- end
- end
- ]]
- local function placeAndProgramTurtle(x, y, z)
- goTo(x, y, z)
- selectItem(itemID.diskDrive)
- turtle.placeUp()
- selectItem(itemID.disk)
- turtle.dropUp()
- -- TODO: program disk
- -- http://www.computercraft.info/wiki/Fs_(API)
- local f = fs.open("/disk/startup", "w")
- f.writeLine("local pos = "..textutils.serialise({lama.getPosition()})) -- prepend position to startup so new turtle knows where it is
- f.writeLine(diskStartupSource)
- f.close()
- fs.copy("/lama", "/disk/lama")
- f = fs.open("/disk/cobbleGen", "w")
- f.writeLine(cobbleGenSource)
- f.close()
- turtle.back()
- selectItem(itemID.miningTurtle)
- turtle.place()
- selectItem(itemID.fuel)
- turtle.drop(5)
- peripheral.call("front", "turnOn") -- activate turtle
- goTo(x, y, z)
- if not selectItem(itemID.disk) then
- selectEmptySlot()
- end
- turtle.suckUp()
- if not selectItem(itemID.diskDrive) then
- selectEmptySlot()
- end
- turtle.digUp()
- end
- placeAndProgramTurtle(3, currentY, 3)
- placeAndProgramTurtle(3, currentY, 7)
- placeAndProgramTurtle(7, currentY, 7)
- placeAndProgramTurtle(7, currentY, 3)
- -- deploy self
- os.setComputerLabel("deploying self")
- -- move fuel to fuel slot
- for i = 1, 16 do
- selectItem(itemID.fuel)
- turtle.transferTo(16)
- end
- turtle.select(16)
- turtle.transferTo(1)
- -- dump the rest of the inventory into the dropOffChest
- goTo(dropOffChest)
- for i = 2,16 do -- skip the fuel slot, we want to keep that
- turtle.select(i)
- turtle.dropUp()
- end
- goTo(5, currentY, 5)
- local f = fs.open("/cobbleGen","w")
- f.writeLine(cobbleGenSource)
- f.close()
- f = fs.open("/startup","w")
- f.writeLine("shell.run(\"cobbleGen\")")
- f.close()
- local stateFile = "stateFile"
- f.writeLine("mine")
- turtle.down()
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment