Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- noch ergänzen:
- -- benötigte Komponenten?? inventory controller, generator, chunkloader, ...?
- local component = require("component")
- local computer = require("computer")
- local robot = require("robot")
- local shell = require("shell")
- local sides = require("sides")
- local navi = component.navigation
- local r=component.robot
- local c=component.computer
- local weit=100
- local breit=100
- local x, y, z, f = 0, 0, 0, 0
- --x
- --y
- --z
- --f =facing?
- local function tanken()
- os.execute("tanken")
- end
- local function waffe()
- if ((robot.durability()*100) < 50) then
- while (robot.durability()*100) <90 do
- print("Waffe bei",robot.durability()*100)
- tanken()
- os.sleep(5)
- end
- end
- end
- local function turnRight()
- robot.turnRight()
- f = (f + 1) % 4
- end
- local function turnLeft()
- robot.turnLeft()
- f = (f + 1) % 4
- end
- local function dig()
- if (robot.detect()) then
- robot.swing()
- end
- end
- local function forward()
- while not robot.forward() do
- os.sleep(0.5)
- dig()
- if (robot.detect() ) then
- os.sleep(1)
- dig()
- end
- end
- end
- local function back()
- robot.back()
- end
- local function digUp()
- if (robot.detectUp()) then
- robot.swingUp()
- end
- end
- local function digDown()
- if (robot.detectDown()) then
- robot.swingDown()
- end
- end
- local richtung=0
- for y=1,breit do
- print("bin schon ", y," von",breit,"gegangen")
- waffe()
- richtung = y%2
- back =y
- for x=1,weit do
- tanken()
- dig()
- digUp()
- if(x==1 and y==1)then
- else
- digDown()
- end
- forward()
- end
- if (richtung == 0) then
- turnLeft()
- dig()
- digUp()
- --digDown()
- forward()
- turnLeft()
- dig()
- digUp()
- digDown()
- turnLeft()
- for z=1,back do
- forward()
- if (z==back) then
- else
- digDown()
- end
- end
- for x=9,robot.inventorySize() do
- robot.select(x)
- robot.drop()
- end
- robot.select(1)
- turnRight()
- os.sleep(15)
- turnRight()
- for z=1,back do
- forward()
- end
- turnLeft()
- else
- turnRight()
- dig()
- digUp()
- digDown()
- forward()
- turnRight()
- dig()
- digUp()
- digDown()
- end
- end
- turnRight()
- turnRight()
- turnRight()
- for x=1,breit do
- forward()
- end
- turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement