Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- mouvement
- while true do
- local blockFront, blockF = turtle.inspect()
- local blockBottom, blockB = turtle.inspectDown()
- local command = false
- local wireless = peripheral.wrap("left")
- wireless.open(69)
- wireless.open(70)
- local foodName
- local foodQuan
- local foodHave
- local echStats
- -- fuel
- if (turtle.getFuelLevel() < 40) then
- turtle.select(1)
- turtle.refuel(1)
- print("refuel ! ")
- end
- -- mouvement bloc de face
- if blockFront then
- if (blockF.name == "minecraft:sandstone") then
- turtle.up()
- turtle.forward()
- end
- if (blockF.name == "chisel:limestone") then
- turtle.down()
- end
- if (blockF.name == "minecraft:glass") then
- turtle.turnRight()
- end
- if (blockF.name == "minecraft:sand") then
- turtle.turnLeft()
- end
- if (blockF.name == "minecraft:planks") then
- if (command == false) then
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- if (senderChannel == 69) then
- foodName = message
- command = true
- end
- if (senderChannel == 70) then
- foodQuan = message
- command = true
- end
- end
- if (foodHave == true) then
- turtle.select(2)
- turtle.dropUp()
- foodHave = false
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- -- fin block de devant
- end
- -- mouvement bloc de dessou
- if blockBottom then
- if (blockB.name == "minecraft:stone") then
- turtle.forward()
- end
- if (blockB.name == "minecraft:sandstone") then
- turtle.forward()
- end
- if (blockB.name == "chisel:marble") then
- turtle.turnLeft()
- if (command == true) then
- turtle.select(2)
- turtle.suck(1)
- echStats = turtle.getItemDetail()
- if (echStats.name == foodName) then
- turtle.suck(foodQuan - 1)
- foodHave = true
- command = false
- end
- end
- turtle.turnRight()
- turtle.forward()
- end
- --fin block de dessou
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement