Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version =
- 5.0
- -- Pri zmene programu je treba na radku 2 zmenit verzi, aby se program automaticky aktualizoval
- -- local code je treba zmenit dle potreby
- --Vize - plán:
- -- Těžba na více stran
- -- Pokládání anchorů a vkládání Ender pearl pro delší těžbu
- -- Využití všech slotů turtly a pokládání méně často Ender Chestky / méně často vyprazdňovat
- -- Enderchestku na druhé straně vyprazdňovat rychleji
- ------------------------------------------------------------------------------------------------
- --TEST UPDATE
- ------------------------------------------------------------------------------------------------
- local code = "3WrsQeNq"
- --check version
- term.clear()
- term.setCursorPos(1,1)
- print("Program loading...")
- print("Current version: "..version)
- local updateSite= http.get("http://pastebin.com/raw.php?i="..code)
- updateSite.readLine()
- local newVersion = updateSite.readLine()
- if tonumber(newVersion) > version then
- print("Update required. Updating now...")
- local updateSite = http.get("http://pastebin.com/raw.php?i="..code)
- local siteFile = updateSite.readAll()
- local writeFile = fs.open(shell.getRunningProgram(),"w")
- writeFile.write(siteFile)
- writeFile.close()
- print("The program will now restart your computer.")
- sleep(1)
- os.reboot()
- end
- ------------------------------------------------------------------------------------------------
- --START
- ------------------------------------------------------------------------------------------------
- function start()
- -- start hlavního programu
- -- nastavíme hloubku kopani
- local hlb = 50
- local delka = 50
- while true do
- -- cyklus pro kopani dolu
- -- turtla bude kopat dolů a posílat itemy do EnderChest
- ------------------------------------------------------------------------------------------------
- --TEST ENDER CHEST UP
- -- před startem je třeba provést ošetření/kontrolu, zda turtla nemá nad sebou Ender Chest (ECH)
- -- pokud ano, vcucni ji a dej do slotu 16 (ošetřit aby byl slot 16 volný)
- -- kontrola ECH je nutná kvůli odhlášení, či restartu serveru
- ------------------------------------------------------------------------------------------------
- turtle.select(16)
- local success, data = turtle.inspectUp()
- if success then
- print("Block name: ", data.name)
- dataEnder = data.name
- print("Block metadata: ", data.metadata)
- if dataEnder == "EnderStorage:enderChest" then
- print("Nalezena Ender Chest")
- turtle.digUp()
- end
- end
- ------------------------------------------------------------------------------------------------
- --REFUEL
- ------------------------------------------------------------------------------------------------
- --provedeme prvotni refuel, aby Turtla mohla dělat posun
- turtle.select(15)
- turtle.refuel()
- print("Proveden refuel...")
- for a=1,delka,1 do
- turtle.select(1)
- turtle.dig()
- turtle.select(2)
- turtle.digDown()
- turtle.select(3)
- turtle.digUp() --ošetřit gravel a sand
- --provedeme kontrolu, zda neni natezen Coal v sl. 1,2.3
- --pokud je natezen Coal, proved Refuel
- local data1 = turtle.getItemDetail()
- if data1 then
- print("Item name: ", data1.name)
- dataX1 = data1.name
- if dataX1 == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data1.damage)
- print("Item count: ", data1.count)
- end
- local data2 = turtle.getItemDetail()
- turtle.select(2)
- if data2 then
- print("Item name: ", data2.name)
- dataX2 = data2.name
- if dataX2 == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data2.damage)
- print("Item count: ", data2.count)
- end
- local data3 = turtle.getItemDetail()
- turtle.select(3)
- if data3 then
- print("Item name: ", data3.name)
- dataX2 = data3.name
- if dataX3 == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data3.damage)
- print("Item count: ", data3.count)
- end
- turtle.select(16)
- -- Enderchest musi byt umistena ve slotu 16
- -- poloz Ender Chest a Slot 1,2,3 vyprazdni do Ender Chest
- turtle.placeUp()
- turtle.select(1)
- turtle.dropUp()
- turtle.select(2)
- turtle.dropUp()
- turtle.select(3)
- turtle.dropUp()
- --vrat Ender Chest do slotu 16
- turtle.select(16)
- turtle.digUp()
- -- popojedeme o jedno dopredu
- turtle.forward()
- a=a+1
- print(a)
- end
- -- otoceni a chod zpet
- turtle.select(4)
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.Down()
- turtle.digDown() --vypraznit slot 4 take
- turtle.Down()
- turtle.dig()
- a=0
- print("Jedu zpet")
- ------------------------------------------------------------------------
- for a=1,delka,1 do
- turtle.select(1)
- turtle.dig()
- turtle.select(2)
- turtle.digDown()
- turtle.select(3)
- turtle.digUp() --ošetřit gravel a sand
- --provedeme kontrolu, zda neni natezen Coal v sl. 1,2.3
- --pokud je natezen Coal, proved Refuel
- local data1 = turtle.getItemDetail()
- if data1 then
- print("Item name: ", data1.name)
- dataX1 = data1.name
- if dataX1 == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data1.damage)
- print("Item count: ", data1.count)
- end
- local data2 = turtle.getItemDetail()
- turtle.select(2)
- if data2 then
- print("Item name: ", data2.name)
- dataX2 = data2.name
- if dataX2 == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data2.damage)
- print("Item count: ", data2.count)
- end
- local data3 = turtle.getItemDetail()
- turtle.select(3)
- if data3 then
- print("Item name: ", data3.name)
- dataX2 = data3.name
- if dataX3 == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data3.damage)
- print("Item count: ", data3.count)
- end
- turtle.select(16)
- -- Enderchest musi byt umistena ve slotu 16
- -- poloz Ender Chest a Slot 1,2,3 vyprazdni do Ender Chest
- turtle.placeUp()
- turtle.select(1)
- turtle.dropUp()
- turtle.select(2)
- turtle.dropUp()
- turtle.select(3)
- turtle.dropUp()
- --vrat Ender Chest do slotu 16
- turtle.select(16)
- turtle.digUp()
- -- popojedeme o jedno dopredu
- turtle.forward()
- a=a+1
- print(a)
- end
- -----------------------------------------------------------------------------------------
- -- otoceni a chod zpet
- turtle.select(4)
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.Down()
- turtle.digDown() --vypraznit slot 4 take
- turtle.Down()
- -- konec hlavního programu
- end
- end
- ------------------------------------------------------------------------------------------------
- --END
- ------------------------------------------------------------------------------------------------
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement