Advertisement
bojan4416

MajnerZaTurtle

Nov 22nd, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function majnuj()
  2.     for j=1,100 do
  3.         turtle.select(14)
  4.         turtle.refuel(2)
  5.         for i=1,100 do
  6.             print(i)
  7.             turtle.dig()
  8.             local blok=turtle.detect()
  9.             if(blok==true) then
  10.                 turtle.dig()
  11.             end
  12.             turtle.forward()
  13.             turtle.digUp()
  14.             turtle.digDown()
  15.             if(i%10==0)and (j%10==1) and (i<92) then
  16.                 turtle.select(16)
  17.                 turtle.placeDown()
  18.              end
  19.             if(i==99) then
  20.                 turtle.turnRight()
  21.                 turtle.turnRight()
  22.                 turtle.forward()
  23.                 turtle.forward()
  24.                 turtle.select(15)
  25.                 turtle.placeDown()
  26.                 for r=1,13 do
  27.                     turtle.select(r)
  28.                     turtle.dropDown()
  29.                 end
  30.                 turtle.turnRight()
  31.                 turtle.turnRight()
  32.                 turtle.forward()
  33.                 turtle.forward()
  34.             end
  35.         if((j%2==0)and (i==100))then
  36.             turtle.turnLeft()
  37.             turtle.dig()
  38.             turtle.forward()
  39.             turtle.digUp()
  40.             turtle.digDown()
  41.             turtle.turnLeft()
  42.         elseif ((j%2~=0) and (i==100)) then
  43.             turtle.turnRight()
  44.             turtle.dig()
  45.             turtle.forward()
  46.             turtle.digUp()
  47.             turtle.digDown()
  48.             turtle.turnRight()
  49.         end
  50.         end
  51.  
  52.    
  53.     end
  54.     return j;
  55. end
  56.  
  57. local function vratise(PrethodnoMajnovano, level)
  58.     turtle.turnRight()
  59.     for i=0,(100+PrethodnoMajnovano) do
  60.         turtle.forward()
  61.     end
  62.     turtle.turnLeft()
  63.     turtle.forward()
  64.     for i=level,60 do
  65.         turtle.up()
  66.     end
  67. end
  68. local function idinalevel(level)
  69.     print(level)
  70.     local l=60-level
  71.     for i=1,l do
  72.         turtle.down()
  73.     end
  74.     turtle.turnRight()
  75.     turtle.turnRight()
  76. end
  77. local function IdiNaPRethodno(PrethodnoMajnovano)
  78.     turtle.forward()
  79.     turtle.turnRight()
  80.     for i=0,PrethodnoMajnovano do
  81.         local blok=turtle.detect()
  82.             if(blok==true) then
  83.                 turtle.dig()
  84.             end
  85.         turtle.forward()
  86.     end
  87.     turtle.turnRight()
  88.     turtle.dig()
  89.     turtle.forward()
  90.     turtle.turnLeft()
  91.     turtle.dig()
  92.     turtle.forward()
  93.     turtle.turnLeft()
  94. end
  95. rednet.open("right")
  96. local level
  97. local PrethodnoMajnovano=0
  98. while true do
  99.     id,poruka=rednet.receive()
  100.     if (poruka=="start")or (poruka=="estart")then
  101.         rednet.send(32, "Majner ukljucen...")
  102.         print("KRECEM")
  103.         rednet.send(32,"Unesite Visinu pocetka majnovanja...")
  104.         id, level=rednet.receive()
  105.         if(poruka=="estart")then
  106.             rednet.send(32, "Unesite Prethodnu kolonu majnovanja...")
  107.             id, PrethodnoMajnovano=rednet.receive()
  108.         end
  109.        
  110.         idinalevel(level)
  111.         if(PrethodnoMajnovano>0) then
  112.             IdiNaPRethodno(PrethodnoMajnovano)
  113.         end
  114.  
  115.         PrethodnoMajnovano=PrethodnoMajnovano+majnuj()
  116.         vratise(PrethodnoMajnovano,level)
  117.         rednet.send(32,"Masina na pocetnom poloziaju... Ukupno izmajnovanih kolona blokova:")
  118.         rednet.send(32, PrethodnoMajnovano)
  119.        
  120.     end
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement