Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --{program="aDaisyFarm",version="1.00",date="2024-09-27"}
- -- Pastebin "CCwjQMZH"
- local cVer = "1.00"
- local cSlotStone = 1
- local cSlotChest = 16
- -- wait for enter to be pressed
- local function waitEnter(prompt)
- write(prompt)
- read()
- end
- -- reverse turtle direction
- local function aboutFace()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- --------------------------------------
- ---- put stone into slot 1 -----------
- --------------------------------------
- local function repackInventory()
- -- store away stuff
- turtle.select(cSlotChest)
- while not turtle.placeUp() -- put chest on top of turtle
- do
- print("Failed to place chest.")
- os.sleep(1)
- end
- for i = 2, 15 do -- leave stone in cSlotStone
- turtle.select(i)
- turtle.dropUp() -- put entire stack from slot into chest
- end
- turtle.select(cSlotStone) -- replace contents
- while turtle.suckUp() do end -- take all from chest
- turtle.select(cSlotChest) -- retrieve the chest
- turtle.digUp()
- turtle.select(cSlotStone)
- end
- -- empty site gets a stone
- local function placeStone()
- turtle.select(cSlotStone)
- if not turtle.detect() and turtle.getItemCount(cSlotStone) > 1
- then
- turtle.place()
- end
- end
- -- put a stone where you were
- local function oneSite()
- turtle.dig()
- turtle.forward() -- move off of target
- aboutFace()
- placeStone() -- place while facing backwards
- end
- -- take care of one corner, place two blocks.
- local function oneCorner()
- oneSite() -- place mid square
- turtle.turnLeft()
- oneSite() -- place in corner
- aboutFace()
- os.sleep(1) -- waste a bit of time to let conversion keep up
- end
- -- move to next daisy
- local function oneRun()
- oneSite() -- place mid square
- aboutFace()
- oneSite() -- place in old daisy corner
- aboutFace()
- turtle.dig()
- turtle.forward() -- move onto next daisy mid
- end
- -- do 8 sites of the 32 sites along the cloverleaf path
- local function oneQuarter()
- oneCorner()
- oneCorner()
- oneRun()
- oneCorner()
- end
- -- harvest without restock
- local function cleanUp()
- for i = 1, 5 -- may be a partial that needs to be cleaned.
- do
- oneQuarter()
- end
- end
- -- run loop until stone is used up
- local function processAll()
- turtle.turnLeft() -- face initial direction
- while turtle.getItemCount(cSlotStone) > 8
- do
- while turtle.getItemCount(cSlotStone) >= 8 --
- do
- oneQuarter()
- end
- if turtle.getItemCount(cSlotStone) < 8
- then
- repackInventory() -- move more stones into cSlotStone
- end
- end
- cleanUp()
- end
- --------------------------------------
- ---- aLivingStone --------------------
- --------------------------------------
- turtle.select(cSlotStone)
- print("+-------------------------------------+") --
- print("| aDaisyFarm "..cVer..", by NortWind |")
- print("+-------------------------------------+")
- print("| slot 1: stone (2 to 64) |")
- print("| slot 2-14: stone (0 to 64) |")
- print("| slot 15: empty |")
- print("| slot 16: chest 1 |")
- print("| Set-up: Place turtle facing daisy. |")
- print("| Logs will work as well as stone. |")
- print("+-------------------------------------+")
- waitEnter("Press enter for layout:")
- print("+-------------------------------------+")
- print("| Layout with turtle facing daisy. |")
- print("+-------------------------------------+")
- print("| +-++-+ |")
- print("| |D||D| D = Pure Daisy |")
- print("| +-++-+ |")
- print("| +-++-+ |")
- print("| |D||D| |")
- print("| -T++-+ T = Mining Turtle |")
- print("+-------------------------------------+")
- waitEnter("Press enter to start:")
- if turtle.getItemCount(1)<2 or turtle.getItemCount(15)~=0 or turtle.getItemCount(16)~=1
- then
- print("Inventory is not correct.")
- elseif turtle.getFuelLevel() < 1000 then
- print("Fuel level "..turtle.getFuelLevel().." is too low.")
- else
- processAll()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement