Advertisement
Bendix

MC_TurbinenBau

Apr 10th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.61 KB | None | 0 0
  1. function detectDevice(DeviceName)
  2.   DeviceSide="nix"
  3.    for a,b in pairs(redstone.getSides()) do
  4.       if peripheral.getType(b)==DeviceName then
  5.          DeviceSide = b
  6.          break
  7.       end
  8.    end
  9.    return(DeviceSide)
  10. end
  11. kiste = peripheral.wrap(detectDevice("chest"))
  12.  
  13. function sortChest()
  14.    for a = 1,16 do
  15.       if turtle.getItemCount(a) > 0 then
  16.          turtle.select(a)
  17.          turtle.dropDown()
  18.       end
  19.    end
  20.    y=0
  21.  
  22.    for x=1,kiste.getInventorySize() do
  23.       item = kiste.getStackInSlot(x)
  24.       if item then
  25.          if item.display_name == "Turbine Housing" then
  26.             kiste.pushItem("up",x,64)
  27.          end
  28.          if item.display_name == "Turbine Rotor Bearing" then
  29.             kiste.pushItem("up",x,1,8)
  30.          end
  31.          if item.display_name == "Turbine Rotor Shaft" then
  32.             kiste.pushItem("up",x,25,9)
  33.          end
  34.          if item.display_name == "Turbine Rotor Blade" then
  35.             if y==0 then
  36.                y=10
  37.             end
  38.          kiste.pushItem("up",x,64,y)
  39.          y=11
  40.          end
  41.          if item.display_name == "Turbine Fluid Port" then
  42.          kiste.pushItem("up",x,2,12)
  43.          end
  44.          if item.display_name == "Turbine Controller" then
  45.          kiste.pushItem("up",x,1,13)
  46.          end
  47.          if item.display_name == "Turbine Power Port" then
  48.          kiste.pushItem("up",x,2,14)
  49.          end
  50.          if item.display_name == "Enderium Block" then
  51.          kiste.pushItem("up",x,37,15)
  52.          end
  53.       end
  54.    end
  55. turtle.select(1)
  56. end
  57.  
  58. function getInventory()
  59.    anzahlHousing = 0
  60.    anzahlBearing = 0
  61.    anzahlShaft = 0
  62.    anzahlBlade = 0
  63.    anzahlFluid = 0
  64.    anzahlController = 0
  65.    anzahlPower = 0
  66.    anzahlEnderium = 0
  67.    for x=1,16 do
  68.       turtleItem=turtle.getItemDetail(x)
  69.       if turtleItem then
  70.          if turtleItem.damage == 0 and turtleItem.name == "BigReactors:BRTurbinePart" then
  71.             anzahlHousing = anzahlHousing + turtle.getItemCount(x)
  72.          elseif turtleItem.damage == 4 and turtleItem.name == "BigReactors:BRTurbinePart" then
  73.             anzahlBearing = anzahlBearing + turtle.getItemCount(x)
  74.          elseif turtleItem.damage == 0 and turtleItem.name == "BigReactors:BRTurbineRotorPart" then
  75.             anzahlShaft = anzahlShaft + turtle.getItemCount(x)
  76.          elseif turtleItem.damage == 1 and turtleItem.name == "BigReactors:BRTurbineRotorPart" then
  77.             anzahlBlade = anzahlBlade + turtle.getItemCount(x)
  78.          elseif turtleItem.damage == 3 and turtleItem.name == "BigReactors:BRTurbinePart" then
  79.             anzahlFluid = anzahlFluid + turtle.getItemCount(x)
  80.          elseif turtleItem.damage == 1 and turtleItem.name == "BigReactors:BRTurbinePart" then
  81.             anzahlController = anzahlController + turtle.getItemCount(x)
  82.          elseif turtleItem.damage == 2 and turtleItem.name == "BigReactors:BRTurbinePart" then
  83.             anzahlPower = anzahlPower + turtle.getItemCount(x)
  84.          elseif turtleItem.damage == 12 and turtleItem.name == "ThermalFoundation:Storage" then
  85.             anzahlEnderium = anzahlEnderium + turtle.getItemCount(x)
  86.          end
  87.       end
  88.    end
  89.    if anzahlHousing ~= 444 then
  90.       print(anzahlHousing, " von 444 Housing")
  91.    end
  92.    if anzahlBearing ~= 1 then
  93.       print(anzahlBearing, " von 1 Bearing")
  94.    end
  95.    if anzahlShaft ~= 25 then
  96.       print(anzahlShaft, " von 25 Shaft")
  97.    
  98.    end
  99.    if anzahlBlade ~= 80 then
  100.       print(anzahlBlade, " von 80 Blade")
  101.    end
  102.    if anzahlFluid ~= 2 then
  103.       print(anzahlFluid, " von 2 Fluid")
  104.    end
  105.    if anzahlController ~= 1 then
  106.       print(anzahlController, " von 1 Controller")
  107.    end
  108.    if anzahlPower ~= 2 then
  109.       print(anzahlPower, " von 2 Power")
  110.    end
  111.    if anzahlEnderium ~= 37 then
  112.       print(anzahlEnderium, " von 37 Enderium")
  113.    end
  114.    if anzahlHousing ==444 and anzahlBearing ==1 and anzahlShaft ==25 and anzahlBlade == 80 and anzahlFluid ==2 and anzahlController == 1 and anzahlPower ==2 and anzahlEnderium == 37 then
  115.       print("true")
  116.       return true
  117.    else
  118.       print("false")
  119.       return false
  120.      
  121.    end
  122. end
  123.  
  124. function abfrage()
  125.    if getInventory() == false then
  126.       print("weitermachen? j drücken")
  127.       print("Abbrechen     n drücken")
  128.       auswahl = io.read()
  129.    else
  130.       beginn = 1
  131.       return beginn
  132.    end
  133.    
  134.    if auswahl == "j" then
  135.       beginn = 1
  136.    elseif auswahl == "n" then
  137.       beginn = 0
  138.    else
  139.       print("wie bitte?")
  140.       abfrage()
  141.    end
  142.    return beginn
  143. end
  144.  
  145.  
  146. function base()
  147.    for x=1,5 do
  148.       turtle.placeDown()
  149.       turtle.forward()
  150.    end
  151.    turtle.placeDown()
  152.    turtle.turnRight()
  153.    turtle.forward()
  154.    turtle.turnRight()
  155.    for x=1,4 do
  156.       turtle.placeDown()
  157.       turtle.forward()
  158.    end
  159.    turtle.placeDown()
  160.    turtle.turnLeft()
  161.    turtle.forward()
  162.    turtle.turnLeft()  
  163.    turtle.placeDown()
  164.    turtle.forward()
  165.    turtle.placeDown()
  166.    turtle.forward()
  167.    turtle.select(8)
  168.    turtle.placeDown()  
  169.    turtle.select(1)
  170.    turtle.forward()
  171.    turtle.placeDown()
  172.    turtle.forward()
  173.    turtle.placeDown()
  174.  
  175.    turtle.turnRight()
  176.    turtle.forward()
  177.    turtle.turnRight()
  178.    for x=1,4 do
  179.       turtle.placeDown()
  180.       turtle.forward()
  181.    end
  182.    turtle.placeDown()
  183.    turtle.turnLeft()
  184.    turtle.forward()
  185.    turtle.turnLeft()
  186.    for x=1,4 do
  187.       turtle.placeDown()
  188.       turtle.forward()
  189.    end
  190.    turtle.placeDown()
  191. end
  192.  
  193. function ring()
  194.    turtle.up()
  195.    turtle.turnLeft()
  196.    for x=1,4 do
  197.       turtle.placeDown()
  198.       turtle.forward()
  199.    end
  200.    turtle.placeDown()
  201.    turtle.turnLeft()
  202.    for x=1,4 do
  203.       turtle.placeDown()
  204.       turtle.forward()
  205.    end
  206.    turtle.placeDown()
  207.    turtle.turnLeft()
  208.    for x=1,4 do
  209.       turtle.placeDown()
  210.       turtle.forward()
  211.    end
  212.    turtle.placeDown()
  213.    turtle.turnLeft()
  214.    for x=1,4 do
  215.       turtle.placeDown()
  216.       turtle.forward()
  217.    end
  218.    
  219.    if turtle.getItemCount(1) < 20 then
  220.       for x=2,7 do
  221.          turtle.select(x)
  222.          turtle.transferTo(1)
  223.       end
  224.    turtle.select(1)
  225.    end
  226. end
  227.  
  228. function shaft()
  229.    turtle.turnLeft()
  230.    turtle.forward()
  231.    turtle.forward()
  232.    turtle.turnLeft()
  233.    turtle.forward()
  234.    turtle.forward()
  235.    for x=1,25 do
  236.       turtle.down()
  237.    end
  238.    for x=1,20 do
  239.       subShaft()
  240.       if turtle.getItemCount(10) < 8 then
  241.          turtle.select(11)
  242.          turtle.transferTo(10)
  243.          turtle.select(10)
  244.       end
  245.    end
  246.    
  247.    for x=1,5 do
  248.       turtle.select(9) --shaft  
  249.       turtle.up()
  250.       turtle.placeDown()
  251.       enderium()
  252.    end
  253.    
  254. end
  255. function subShaft()
  256.    turtle.select(10)
  257.    turtle.place()
  258.    turtle.turnLeft()
  259.    turtle.place()
  260.    turtle.turnLeft()
  261.    turtle.place()
  262.    turtle.turnLeft()
  263.    turtle.place()
  264.    turtle.up()
  265.    turtle.select(9)
  266.    turtle.placeDown()
  267.    turtle.turnLeft()
  268. end
  269.    
  270.  
  271. function enderium() --funktioniert noch nicht (baut krum)
  272.    turtle.forward()
  273.    turtle.select(15)
  274.    turtle.placeDown()
  275.    turtle.turnLeft() turtle.forward()
  276.    turtle.placeDown()
  277.    turtle.turnLeft() turtle.forward()
  278.    turtle.placeDown()
  279.    turtle.forward()
  280.    turtle.placeDown()
  281.    turtle.turnLeft() turtle.forward()
  282.    turtle.placeDown()
  283.    turtle.forward()
  284.    turtle.placeDown()
  285.    turtle.turnLeft() turtle.forward()
  286.    turtle.placeDown()
  287.    turtle.forward()
  288.    turtle.placeDown()
  289.    turtle.turnLeft() turtle.forward()
  290.    turtle.turnRight()
  291.    turtle.back()
  292. end
  293.  
  294. function deckel()
  295. turtle.up()
  296. turtle.select(13)
  297. turtle.placeDown()
  298.  
  299. turtle.back()
  300. turtle.select(1)
  301. turtle.placeDown()
  302. turtle.turnLeft()
  303. turtle.forward()
  304. turtle.select(14)
  305. turtle.placeDown()
  306.  
  307.  
  308. turtle.turnRight()
  309. turtle.forward()
  310. turtle.select(1)
  311. turtle.placeDown()
  312. turtle.forward()
  313. turtle.select(14)
  314. turtle.placeDown()
  315.  
  316.  
  317. turtle.turnRight()
  318. turtle.forward()
  319. turtle.select(1)
  320. turtle.placeDown()
  321.  
  322.  
  323. turtle.forward()
  324. turtle.select(12)
  325. turtle.placeDown()
  326. turtle.turnRight()
  327. turtle.forward()
  328. turtle.select(1)
  329. turtle.placeDown()
  330.  
  331. turtle.forward()
  332. turtle.select(12)
  333. turtle.placeDown()
  334.  
  335.  
  336. turtle.forward()
  337. turtle.select(1)
  338. turtle.placeDown()
  339. turtle.turnRight()
  340.  
  341. for x=1,3 do
  342. turtle.forward()
  343. turtle.placeDown()
  344. end
  345. turtle.turnRight()
  346. for x=1,4 do
  347. turtle.forward()
  348. turtle.placeDown()
  349. end
  350. turtle.turnRight()
  351. for x=1,4 do
  352. turtle.forward()
  353. turtle.placeDown()
  354. end
  355. turtle.turnRight()
  356. for x=1,4 do
  357. turtle.forward()
  358. turtle.placeDown()
  359. end
  360. turtle.turnRight()
  361.  
  362. end
  363.  
  364.  
  365.  
  366.    
  367. sortChest()
  368. if abfrage() == 1 then
  369.    print("alles ok")
  370.    base()
  371. for x=1,25 do
  372.    ring()
  373. end
  374. shaft()
  375. deckel()
  376. else
  377.    print(abfrage())
  378. end
  379. --20000
  380. --12 = fluid
  381. --13=controler
  382. --14=power
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement