Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --{program="aLivingStone",version="1.00",date="2024-03-27"}
- -- Pastebin "DAFFkuV6"
- local cVer = "1.00"
- local cSlotStone = 1
- local cSlotChest = 16
- -- wait for enter to be pressed
- local function waitEnter(prompt)
- write(prompt)
- read()
- end
- local function moveLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- 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 slot gets a stone
- local function placeStone()
- turtle.select(cSlotStone)
- if not turtle.detect() and turtle.getItemCount(cSlotStone) > 1
- then
- turtle.place()
- end
- end
- -- take care of spot in front of turtle
- local function service()
- placeStone()
- turtle.select(cSlotStone)
- if not turtle.compare() -- slot with living stone gets mined
- then
- turtle.dig()
- placeStone()
- end
- end
- -- take care of one corner, two blocks.
- local function oneCorner()
- service() -- center block
- moveLeft()
- service() -- left side block
- moveLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- end
- -- move to next daisy
- local function oneRun()
- service()
- moveLeft()
- service()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- 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()
- while turtle.getItemCount(cSlotStone) > 8
- do
- while turtle.getItemCount(cSlotStone) > 8 --
- do
- oneQuarter()
- end
- if turtle.getItemCount(cSlotStone) <= 8
- then
- repackInventory()
- end
- end
- cleanUp()
- end
- --------------------------------------
- ---- aLivingStone --------------------
- --------------------------------------
- turtle.select(cSlotStone)
- print("+-------------------------------------+")
- print("| aLivingStone "..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 one square |")
- print("| from pure daisy, facing daisy. |")
- print("| Logs will work as well as stone. |")
- print("+-------------------------------------+")
- waitEnter("Press enter for layout:")
- print("+-------------------------------------+")
- print("| ......... |")
- print("| .### ###. |")
- print("| .#P#.#P#. P = Pure Daisy |")
- print("| .###.###. |")
- print("| ......... . = Clear space |")
- print("| .###.###. |")
- print("| .#P#.#P#. # = conversion site |")
- print("| .###.###. |")
- 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.")
- else
- processAll()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement