Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Automata banyaszo Turtle v0.6--
- --By Leslie--
- --2012. 11.18--
- --[[
- ----------------------------------------
- 0.1 -Banyaszas.
- 0.2 -Minden inditasnal tankol.
- 2012.11.19
- 0.3 -HotFIX: ha nincs elotte block
- akkor is banyasz maga felett.
- 0.4 -Fordulokent elmegy es
- kiuriti magat a chest-be.
- 0.5 -Ha soder hullik ra, erzekeli
- es kibanyassza.
- -Csak akkor tankol, ha 2000 ala
- esik az uzemanyag szint.
- 0.6 -Maga alatt is banyasz.
- A tankolas fordulonkent van, nem
- indulasonkent.
- ----------------------------------------
- ]]--
- function reFuel()
- turtle.select(1)
- turtle.refuel(10)
- print("Tankoltam.")
- end
- function dropAll()
- local slot = 2
- turtle.select(1)
- while slot ~= 17 do
- turtle.select(slot)
- turtle.drop()
- slot = slot+1
- end
- end
- function targetC()
- lepes = 0
- turtle.turnRight()
- while turtle.forward() do
- lepes = lepes + 1
- print("Lepesek a chest-ig: "..lepes)
- end
- while not turtle.forward() do
- dropAll()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- print("Ennyit megyek vissza: "..lepes)
- for i = 2, lepes do
- turtle.forward()
- end
- turtle.turnRight()
- end
- function lepesE()
- while turtle.detectDown() do
- turtle.digDown()
- end
- while not turtle.forward() do
- turtle.dig()
- end
- sleep(0.4)
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.4)
- end
- end
- function turnL()
- turtle.turnLeft()
- lepesE()
- turtle.turnLeft()
- end
- function turnR()
- turtle.turnRight()
- lepesE()
- turtle.turnRight()
- end
- --Main program--
- while true do
- local fuel = turtle.getFuelLevel()
- print("Online")
- print("Uzemanyag szint: "..fuel)
- local hossz = 0
- local szeles = 0
- write("Szelesseg: ")
- local szeles = read()
- if szeles == "test" then
- targetC()
- else
- write("Hossz: ")
- local hosszu = read()
- local hosszu = hosszu-1
- local szeles = szeles-1
- for i = 1, szeles, 2 do
- for i = 1, hosszu do
- lepesE()
- end
- turnL()
- for i = 1, hosszu do
- lepesE()
- end
- turnR()
- targetC()
- if fuel < 2000 then
- reFuel()
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement