Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Erstellt von DerMarten Web: http://pastebin.com/u/DerMarten
- -- Tutrtle Api: http://computercraft.info/wiki/Turtle_(API)
- function toBool(data)
- if data == "true" or data == "TRUE" then
- return true
- else
- return false
- end
- end
- local args = { ... }
- local laenge = 0
- local breite = 6
- local torch = false
- local timesleep = 0.4
- local torchSlot = 16
- local status = 0
- if tonumber(args[1]) >= 1 then
- if tonumber(args[1]) >= 1 then
- laenge = tonumber(args[1])
- end
- if args[2] == nil then
- breite = 6
- else
- breite = tonumber(args[2])
- end
- if args[3] == nil then
- torch = true
- else
- torch = toBool(args[3])
- end
- end
- --print("Länge: "..laenge.." - Typ: "..type(laenge))
- --print("Breite: "..breite.." - Typ: "..type(breite))
- --print("Fakeln: "..tostring(torch).." - Typ: "..type(torch))
- -- Funktionen --
- function dig()
- if turtle.detect() then
- turtle.dig()
- os.sleep(timesleep)
- end
- end
- function digUp()
- if turtle.detectUp() then
- turtle.digUp()
- os.sleep(timesleep)
- end
- end
- function digDown()
- if turtle.detectDown() then
- turtle.digDown()
- os.sleep(timesleep)
- end
- end
- function torchCheck()
- local data = turtle.getItemDetail()
- if data then
- if data.name == "minecraft:torch" then
- return true
- else
- return false
- end
- end
- end
- function placeTorch()
- if torch then
- turtle.select(torchSlot)
- if torchCheck() then
- turtle.turnLeft()
- turtle.placeUp()
- turtle.turnRight()
- end
- turtle.select(1)
- end
- end
- -- Movement Functions
- function forward()
- while turtle.detect() do
- dig()
- end
- turtle.forward()
- end
- function up()
- while turtle.detectUp() do
- digUp()
- end
- turtle.up()
- end
- function down()
- while turtle.detectDown() do
- digDown()
- end
- turtle.down()
- end
- -- Mainloop
- if args[1] == "help" then
- print("Syntax: Stripmine <Einheiten [NUMBER]> <Nebengang Breite [NUMBER]> <Fakeln [BOOL]>")
- print("1 Einheit = 3 Blöcke Lang")
- else
- if laenge > 0 then
- if breite > 0 then
- local templ = 0
- for i = laenge,1,-1 do
- status = status + 1
- shell.run("clear")
- print("Aktuelle Einheit: "..status)
- templ = templ + 1
- -- Hauptgang
- for i = 3,1,-1 do
- forward()
- digUp()
- if i == 2 then
- placeTorch()
- end
- end
- turtle.turnRight()
- -- Rechts
- for i = breite,1,-1 do
- forward()
- digUp()
- end
- turtle.turnRight()
- turtle.turnRight()
- for i = breite,1,-1 do
- forward()
- digUp()
- end
- -- Links
- for i = breite,1,-1 do
- forward()
- digUp()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = breite,1,-1 do
- forward()
- digUp()
- end
- if templ ~= laenge then
- turtle.turnLeft()
- end
- end
- --turtle.turnRight()
- turtle.turnRight()
- for i = laenge*3,1,-1 do
- forward()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- up()
- up()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment