Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local message, position = "", ""
- local id, delay = 0 ,0.5
- turtle.select(1)
- rednet.open("right")
- print("Current fuel level:" .. turtle.getFuelLevel())
- if turtle.getFuelLevel() < 10 then
- print("This is too less!")
- shutdown()
- end
- if turtle.detectDown() and not turtle.detectUp() then
- position = "ceiling"
- elseif turtle.detectUp() and not turtle.detectDown() then
- position = "floor"
- end
- if position == "" then
- print("Turtle failed to find it's position.")
- sleep(2)
- shutdown()
- else
- print("Current relativ position is the " .. position)
- print("Waiting for rednet message!")
- end
- while true do
- id, message = rednet.receive()
- sleep(delay)
- if message == "open" and position == "ceiling" then
- print("Opening!")
- turtle.digDown()
- turtle.up()
- turtle.placeDown()
- elseif message == "open" and position == "floor" then
- print("Opening!")
- turtle.digUp()
- turtle.down()
- turtle.placeUp()
- elseif message == "close" and position == "ceiling" then
- print("Closeing!")
- turtle.digDown()
- turtle.down()
- turtle.placeDown()
- elseif message == "close" and position == "floor" then
- print("Closeing!")
- turtle.digUp()
- turtle.up()
- turtle.placeUp()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment