Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echarbon = false
- local modem = peripheral.wrap("right")
- local ig = {netherwart = {-318,108,749,1},
- glowstone = {423,4,-800,2},
- sucre = {-317,109,749,1},
- hopper = {-318,110,750,3},
- botle = {-318,109,749,1},
- bs = {-318,108,750,3},
- gunpowder = {423,6,-799,2},
- dragon = {423,5,-800,2},
- blazepowder = {423,5,-801,2},
- pasteque = {423,5,-801,2},
- oeila = {423,5,-801,2},
- larmeghast = {423,5,-801,2},
- magma = {423,5,-801,2},
- poissonglobe = {423,5,-801,2},
- carotte = {423,5,-801,2},
- oeilafermenter = {423,5,-801,2},
- spectral = {423,5,-801,2},
- redstone = {},
- charbon ={422,4,-802,2}}
- local orientation = 2
- function corientation(o)
- while orientation ~= o do
- turtle.turnLeft()
- orientation = orientation+1
- if orientation == 4 then
- orientation = 0
- end
- end
- end
- function afficheinfo()
- x, y, z = gps.locate(5)
- --term.clear()
- print("x: "..x)
- print("y: "..y)
- print("z: "..z)
- print("orientation: "..orientation)
- end
- function verifcharbon()
- if echarbon == true then
- else
- if turtle.getFuelLevel() < 25 then
- echarbon = true
- deplacementO(ig["charbon"][1],ig["charbon"][2],ig["charbon"][3],ig["charbon"][4])
- turtle.select(15)
- turtle.suck(64)
- turtle.refuel(turtle.getItemCount(15))
- turtle.select(1)
- end
- echarbon = false
- end
- echarbon = false
- end
- function deplacementy(y2)
- x, y, z = gps.locate(5)
- afficheinfo()
- print(y2)
- while y ~= y2 do
- if y > y2 then
- turtle.down()
- verifcharbon()
- else
- turtle.up()
- verifcharbon()
- end
- x, y, z = gps.locate(5)
- afficheinfo()
- end
- end
- function deplacementz(z2)
- x, y, z = gps.locate(5)
- afficheinfo()
- if z > z2 then
- corientation(1)
- else
- corientation(3)
- end
- while z ~= z2 do
- turtle.forward()
- verifcharbon()
- x, y, z = gps.locate(5)
- afficheinfo()
- print("orientation"..orientation)
- end
- end
- function deplacementx(x2)
- print("p")
- x, y, z = gps.locate(5)
- afficheinfo()
- if x > x2 then
- corientation(2)
- else
- corientation(0)
- end
- while x ~= x2 do
- turtle.forward()
- verifcharbon()
- x, y, z = gps.locate(5)
- afficheinfo()
- end
- end
- function deplacement(xa,ya,za)
- deplacementy(ya)
- deplacementx(xa)
- deplacementz(za)
- end
- function deplacemento(xa,ya,za,o)
- deplacementy(ya)
- deplacementx(xa)
- deplacementz(za)
- corientation(o)
- end
- function cbottle(potion, potion2, potion3, potion4)
- print("test")
- deplacemento(ig["botle"][1],ig["botle"][2],ig["botle"][3],ig["botle"][4])
- turtle.select(1)
- verify("water botle",potion, potion2, potion3, potion4)
- turtle.select(2)
- verify("water botle",potion, potion2, potion3, potion4)
- turtle.select(3)
- verify("water botle",potion, potion2, potion3, potion4)
- end
- function cnetherwart()
- deplacemento(ig["netherwart"][1],ig["netherwart"][2],ig["netherwart"][3],ig["netherwart"][4])
- turtle.select(4)
- verify(potion, potion2, potion3, potion4)
- end
- function ccnetherwart()
- deplacemento(ig["netherwart"][1],ig["netherwart"][2],ig["netherwart"][3],ig["netherwart"][4])
- turtle.select(4)
- turtle.drop(1)
- end
- function verify(item,potion, potion2, potion3, potion4)
- if not turtle.suck(1) then
- modem.transmit(45,45, "manque")
- modem.transmit(45,45, item)
- print("il manque :"..item)
- sleep(4)
- deplacemento(ig["botle"][1],ig["botle"][2],ig["botle"][3],ig["botle"][4])
- turtle.select(1)
- turtle.drop(1)
- turtle.select(2)
- turtle.drop(1)
- turtle.select(3)
- turtle.drop(1)
- if potion == "speed" then
- ccnetherwart()
- deplacemento(ig["sucre"][1],ig["sucre"][2],ig["sucre"][3],ig["sucre"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "force" then
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["blazepowder"][1],ig["blazepowder"][2],ig["blazepowder"][3],ig["blazepowder"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "soin" then
- ccnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["pasteque"][1],ig["pasteque"][2],ig["pasteque"][3],ig["pasteque"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "poison" then
- ccnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["oeila"][1],ig["oeila"][2],ig["oeila"][3],ig["oeila"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "regen" then
- ccnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["larmeghast"][1],ig["larmeghast"][2],ig["larmeghast"][3],ig["larmeghast"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "resistance" then
- ccnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["magma"][1],ig["magma"][2],ig["magma"][3],ig["magma"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "respiration" then
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["poissonglobe"][1],ig["poissonglobe"][2],ig["poissonglobe"][3],ig["poissonglobe"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "visionnocturne" then
- ccnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["carotte"][1],ig["carotte"][2],ig["carotte"][3],ig["carotte"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "faiblesse" then
- deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "invisibilite" then
- ccnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["spectral"][1],ig["spectral"][2],ig["spectral"][3],ig["spectral"][4])
- turtle.select(5)
- turtle.drop(1)
- elseif potion == "lenteur" then
- ccnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["sucre"][1],ig["sucre"][2],ig["sucre"][3],ig["sucre"][4])
- turtle.select(5)
- turtle.drop(1)
- deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
- turtle.select(6)
- turtle.drop(1)
- elseif potion == "degat" then
- ccnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["pasteque"][1],ig["pasteque"][2],ig["pasteque"][3],ig["pasteque"][4])
- turtle.select(5)
- turtle.drop(1)
- deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
- turtle.select(6)
- turtle.drop(1)
- end
- if potion2 == "glowstone" then
- deplacemento(ig["glowstone"][1],ig["glowstone"][2],ig["glowstone"][3],ig["glowstone"][4])
- turtle.select(7)
- turtle.drop(1)
- elseif potion2 == "redstone" then
- deplacemento(ig["redstone"][1],ig["redstone"][2],ig["redstone"][3],ig["redstone"][4])
- turtle.select(7)
- turtle.drop(1)
- end
- if potion3 == true then
- deplacemento(ig["gunpowder"][1],ig["gunpowder"][2],ig["gunpowder"][3],ig["gunpowder"][4])
- turtle.select(8)
- turtle.drop(1)
- end
- if potion4 == true then
- deplacemento(ig["dragon"][1],ig["dragon"][2],ig["dragon"][3],ig["dragon"][4])
- turtle.select(9)
- turtle.drop(1)
- end
- corientation(2)
- sleep(5)
- os.reboot()
- end
- end
- function potion(potion, potion2, potion3, potion4)
- local etape = 0
- print(potion)
- print(potion2)
- print(potion3)
- print(potion4)
- cbottle(potion, potion2, potion3, potion4)
- if potion == "speed" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["sucre"][1],ig["sucre"][2],ig["sucre"][3],ig["sucre"][4])
- turtle.select(5)
- verify("sucre",potion, potion2, potion3, potion4)
- elseif potion == "force" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["blazepowder"][1],ig["blazepowder"][2],ig["blazepowder"][3],ig["blazepowder"][4])
- turtle.select(5)
- verify("blazepowder",potion, potion2, potion3, potion4)
- elseif potion == "soin" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["pasteque"][1],ig["pasteque"][2],ig["pasteque"][3],ig["pasteque"][4])
- turtle.select(5)
- verify("pasteque",potion, potion2, potion3, potion4)
- elseif potion == "poison" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["oeila"][1],ig["oeila"][2],ig["oeila"][3],ig["oeila"][4])
- turtle.select(5)
- verify("oeila",potion, potion2, potion3, potion4)
- elseif potion == "regen" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["larmeghast"][1],ig["larmeghast"][2],ig["larmeghast"][3],ig["larmeghast"][4])
- turtle.select(5)
- verify("larmeghast",potion, potion2, potion3, potion4)
- elseif potion == "resistance" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["magma"][1],ig["magma"][2],ig["magma"][3],ig["magma"][4])
- turtle.select(5)
- verify("magma",potion, potion2, potion3, potion4)
- elseif potion == "respiration" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["poissonglobe"][1],ig["poissonglobe"][2],ig["poissonglobe"][3],ig["poissonglobe"][4])
- turtle.select(5)
- verify("poissonglobe",potion, potion2, potion3, potion4)
- elseif potion == "visionnocturne" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["carotte"][1],ig["carotte"][2],ig["carotte"][3],ig["carotte"][4])
- turtle.select(5)
- verify("carotte",potion, potion2, potion3, potion4)
- elseif potion == "faiblesse" then
- etape = etape + 1
- deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
- turtle.select(5)
- verify("oeilafermenter",potion, potion2, potion3, potion4)
- elseif potion == "invisibilite" then
- etape = etape + 2
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["spectral"][1],ig["spectral"][2],ig["spectral"][3],ig["spectral"][4])
- turtle.select(5)
- verify("spectral",potion, potion2, potion3, potion4)
- elseif potion == "lenteur" then
- etape = etape + 3
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["sucre"][1],ig["sucre"][2],ig["sucre"][3],ig["sucre"][4])
- turtle.select(5)
- verify("sucre",potion, potion2, potion3, potion4)
- deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
- turtle.select(6)
- verify("oeilafermenter",potion, potion2, potion3, potion4)
- elseif potion == "degat" then
- etape = etape + 3
- cnetherwart(potion, potion2, potion3, potion4)
- deplacemento(ig["pasteque"][1],ig["pasteque"][2],ig["pasteque"][3],ig["pasteque"][4])
- turtle.select(5)
- verify("pasteque",potion, potion2, potion3, potion4)
- deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
- turtle.select(6)
- verify("oeilafermenter",potion, potion2, potion3, potion4)
- end
- if potion2 == "glowstone" then
- etape = etape + 1
- deplacemento(ig["glowstone"][1],ig["glowstone"][2],ig["glowstone"][3],ig["glowstone"][4])
- turtle.select(7)
- verify("glowstone",potion, potion2, potion3, potion4)
- elseif potion2 == "redstone" then
- etape = etape + 1
- deplacemento(ig["redstone"][1],ig["redstone"][2],ig["redstone"][3],ig["redstone"][4])
- turtle.select(7)
- verify("redstone",potion, potion2, potion3, potion4)
- end
- if potion3 == true then
- etape = etape + 1
- deplacemento(ig["gunpowder"][1],ig["gunpowder"][2],ig["gunpowder"][3],ig["gunpowder"][4])
- turtle.select(8)
- verify("gunpowder",potion, potion2, potion3, potion4)
- end
- if potion4 == true then
- etape = etape + 1
- deplacemento(ig["dragon"][1],ig["dragon"][2],ig["dragon"][3],ig["dragon"][4])
- turtle.select(9)
- verify("souffle du dragon",potion, potion2, potion3, potion4)
- end
- print("bs")
- os.sleep(3)
- deplacemento(ig["bs"][1],ig["bs"][2],ig["bs"][3],ig["bs"][4])
- print("bs2")
- turtle.select(1)
- turtle.drop(1)
- turtle.select(2)
- turtle.drop(1)
- turtle.select(3)
- turtle.drop(1)
- deplacemento(ig["hopper"][1],ig["hopper"][2],ig["hopper"][3],ig["hopper"][4])
- for i = 3,10 do
- turtle.select(i)
- turtle.drop(1)
- end
- corientation(2)
- modem.open(35)
- modem.transmit(35,35,(etape*20)+2)
- os.reboot()
- end
- --deplacemento(ig["bs"][1],ig["bs"][2],ig["bs"][3],ig["bs"][4])
- modem.closeAll()
- modem.open(45)
- local event, modemside, senderchannel,replychannel, message, senderdistance = os.pullEvent("modem_message")
- print(message)
- if not textutils.unserialize( message ) then
- os.reboot()
- end
- tableau = textutils.unserialize( message )
- local x, y, z = gps.locate(5)
- print(tableau[1])
- print(tableau[2])
- print(tableau[3])
- print(tableau[4])
- os.sleep(5)
- potion(tostring(tableau[1]),tostring(tableau[2]),tableau[3],tableau[4])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement