Advertisement
clarence123

uwc copy

Feb 23rd, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 27.51 KB | None | 0 0
  1. --MENU
  2. --VARIABLES
  3.  
  4. local w,h = term.getSize()
  5. local select, program, distance = 1, 0, 7
  6. local running, chopping, usebonemeal = true, true, true
  7. local version = "ULTIMATE WOOD CHOPPER 0.8.6"
  8. local a, b, c, d, e, z = 6,7,8,9,10,h-2
  9. turtle.select(1)
  10.  
  11. --DRAW
  12.  
  13. local function printCentered(str, ypos)
  14.  term.setCursorPos(w/2 - #str/2, ypos)
  15.  term.write(str)
  16. end
  17.  
  18. local function printRight(str, ypos)
  19.  term.setCursorPos(w-#str, ypos)
  20.  term.write(str)
  21. end
  22.  
  23. --MENUS
  24.  
  25. function clearScreen()
  26.  term.clear()
  27.  term.setCursorPos(1,1)
  28.  term.clear()
  29. end
  30.  
  31. function drawMenuMain()
  32.  drawCopyright()
  33.  drawHeader(version, 1)
  34.  
  35.  if select == 1 then
  36.   printCentered("> Chop Programs <", a)
  37.  else
  38.   printCentered("Chop Programs", a)
  39.  end
  40.  if select == 2 then
  41.   printCentered("> Build and Expand Programs <", b)
  42.  else
  43.   printCentered("Build and Expand Programs",b)
  44.  end
  45.  if select == 3 then
  46.   printCentered("> Single Tree Chop Programs <", c)
  47.  else
  48.   printCentered("Single Tree Chop Programs",c)
  49.  end
  50.  if select == 4 then
  51.   printCentered("> Help Programs <", d)
  52.  else
  53.   printCentered("Help Programs",d)
  54.  end
  55.  if select == 5 then
  56.   printCentered("> Quit <", z)
  57.  else
  58.   printCentered("Quit", z)
  59.  end
  60. end
  61.  
  62. function drawMenuChopPrograms()
  63.  drawHeader(version, 1)
  64.  drawHeader("CHOP PROGRAMS", 3)
  65.  
  66.  if select == 1 then
  67.   printCentered("> Standard Farm <", a)
  68.  else
  69.   printCentered("Standard Farm", a)
  70.  end
  71.  if select == 2 then
  72.   printCentered("> Expanded Farm <", b)
  73.  else
  74.   printCentered("Expanded Farm", b)
  75.  end
  76.  if select == 3 then
  77.   printCentered("> Standard Farm without bonemeal <", c)
  78.  else
  79.   printCentered("Standard Farm without bonemeal", c)
  80.  end
  81.  if select == 4 then
  82.   printCentered("> Expanded Farm without bonemeal <", d)
  83.  else
  84.   printCentered("Expanded Farm without bonemeal", d)
  85.  end
  86.  if select == 5 then
  87.   printCentered("> Back <", z)
  88.  else
  89.   printCentered("Back", z)
  90.  end
  91. end
  92.  
  93. function drawMenuBuildPrograms()
  94.  drawHeader(version, 1)
  95.  drawHeader("BUILD AND EXPAND PROGRAMS", 3)
  96.  printCentered("Be sure the Turtle has all materials!",10)
  97.  
  98.  if select == 1 then
  99.   printCentered("> Set up a farm <", a)
  100.  else
  101.   printCentered("Set up a farm", a)
  102.  end
  103.  if select == 2 then
  104.   printCentered("> Expand your farm <", b)
  105.  else
  106.   printCentered("Expand your farm", b)
  107.  end
  108.  if select == 3 then
  109.   printCentered("> Add more chests <", c)
  110.  else
  111.   printCentered("Add more chests", c)
  112.  end
  113.  if select == 4 then
  114.   printCentered("> Back <", z)
  115.  else
  116.   printCentered("Back", z)
  117.  end
  118. end
  119.  
  120. function drawMenuHelpPrograms()
  121.  drawHeader(version, 1)
  122.  drawHeader("HELP PROGRAMS", 3)
  123.  
  124.  if select == 1 then
  125.   printCentered("> Help Interface <", a)
  126.  else
  127.   printCentered("Help Interface", a)
  128.  end
  129.  if select == 2 then
  130.   printCentered("> Position <", b)
  131.  else
  132.   printCentered("Position", b)
  133.  end
  134.  if select == 3 then
  135.   printCentered("> Debug standard farm <", c)
  136.  else
  137.   printCentered("Debug standard farm", c)
  138.  end
  139.  if select == 4 then
  140.   printCentered("> Debug expanded farm <", d)
  141.  else
  142.   printCentered("Debug expanded farm", d)
  143.  end
  144.  if select == 5 then
  145.   printCentered("> Dig needed space <", e)
  146.  else
  147.   printCentered("Dig needed space", e)
  148.  end
  149.  if select == 6 then
  150.   printCentered("> Back <", z)
  151.  else
  152.   printCentered("Back", z)
  153.  end
  154. end
  155.  
  156. function drawSingleTreeChopPrograms()
  157.  drawHeader(version, 1)
  158.  drawHeader("SINGLE TREE CHOP PROGRAMS", 3)
  159.  
  160.  if select == 1 then
  161.   printCentered("> General 1x1 Tree <", a)
  162.  else
  163.   printCentered("General 1x1 Tree", a)
  164.  end
  165.  if select == 2 then
  166.   printCentered("> General 2x2 Tree <", b)
  167.  else
  168.   printCentered("General 2x2 Tree", b)
  169.  end
  170.  if select == 3 then
  171.   printCentered("> Back <", z)
  172.  else
  173.   printCentered("Back", z)
  174.  end
  175. end
  176.  
  177. --HEADER
  178.  
  179. function drawHeader(title, line)
  180.  printCentered(title, line)
  181.  printCentered(string.rep("-", w), line+1)
  182. end
  183.  
  184. function drawCopyright()
  185.  printRight("by UNOBTANIUM", h)
  186. end
  187.  
  188. --MENUSTATE
  189.  
  190. local menustate = "main"
  191.  
  192. local mopt = {
  193.  ["main"] = {
  194.   options = {"chopprograms", "buildprograms", "singletreechopprograms", "helpprograms", "quit"},
  195.   draw = drawMenuMain
  196.  },
  197.  
  198.  ["chopprograms"] = {
  199.   options = {"standard", "expanded", "standardnobonemeal", "expandednobonemeal", "main"},
  200.   draw = drawMenuChopPrograms
  201.  },
  202.  ["buildprograms"] = {
  203.   options = {"build","expand", "expandchests", "main"},
  204.   draw = drawMenuBuildPrograms
  205.  },
  206.  ["singletreechopprograms"] = {
  207.   options = {"onebyone", "twobytwo", "main"},
  208.   draw = drawSingleTreeChopPrograms
  209.  },
  210.  ["helpprograms"] = {
  211.   options = {"help", "position", "debugstandard", "debugexpanded", "digSpace","main"},
  212.   draw = drawMenuHelpPrograms
  213.  }
  214. }
  215.  
  216.  
  217. --RUN MENU
  218.  
  219. function runMenu()
  220.  while true do
  221.   program = 0
  222.   clearScreen()
  223.   mopt[menustate].draw()
  224.  
  225.   local id, key = os.pullEvent("key")
  226.   if key == 200 then
  227.    select = select-1
  228.   end
  229.   if key == 208 then
  230.    select = select+1
  231.   end
  232.   if select == 0 then
  233.    select = #mopt[menustate].options
  234.   end
  235.   if select > #mopt[menustate].options then
  236.    select = 1
  237.   end
  238.   if key == 28 then
  239.    if mopt[menustate].options[select] == "quit" then
  240.     program = 0
  241.     break
  242.    end
  243.    if mopt[menustate].options[select] == "standard" then
  244.     program = 1
  245.     usebonemeal = true
  246.     break
  247.    end
  248.    if mopt[menustate].options[select] == "expanded" then
  249.     program = 2
  250.     usebonemeal = true
  251.     break
  252.    end
  253.    if mopt[menustate].options[select] == "debugstandard" then
  254.     program = 3
  255.     break
  256.    end
  257.    if mopt[menustate].options[select] == "debugexpanded" then
  258.     program = 4
  259.     break
  260.    end
  261.    if mopt[menustate].options[select] == "build" then
  262.     program = 5
  263.     break
  264.    end
  265.    if mopt[menustate].options[select] == "expand" then
  266.     program = 6
  267.     break
  268.    end
  269.    if mopt[menustate].options[select] == "help" then
  270.     program = 7
  271.     break
  272.    end
  273.    if mopt[menustate].options[select] == "position" then
  274.     program = 8
  275.     break
  276.    end
  277.    if mopt[menustate].options[select] == "expandchests" then
  278.     program = 9
  279.     break
  280.    end
  281.    if mopt[menustate].options[select] == "onebyone" then
  282.     program = 10
  283.     break
  284.    end  
  285.    if mopt[menustate].options[select] == "twobytwo" then
  286.     program = 11
  287.     break
  288.    end
  289.    if mopt[menustate].options[select] == "standardnobonemeal" then
  290.     program = 1
  291.     usebonemeal = false
  292.     break
  293.    end
  294.    if mopt[menustate].options[select] == "expandednobonemeal" then
  295.     program = 2
  296.     usebonemeal = false
  297.     break
  298.    end
  299.    if mopt[menustate].options[select] == "digSpace" then
  300.     program = 12
  301.     break
  302.    end
  303.    menustate = mopt[menustate].options[select]
  304.    select = 1
  305.   end
  306.  end
  307. end
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315. --FIR WOOD CHOPPER PROGRAMS
  316. --VARIABLES
  317. local dirtexpand, pipeexpand, obsidianpipeexpand, blockslot, coal, chest, furnace, dirt, pipe, ironpipe, goldpipe, obsidianpipe, woodenpipe, engine, lever, bonemeal, stone1, stone2, stone3, sapling, fuel = 2,3,4,5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,3
  318.  
  319. --MOVE FUNCTIONS
  320.  
  321. function forward()
  322.  while not turtle.forward() do end
  323. end
  324.  
  325. function back()
  326.  while not turtle.back() do end
  327. end
  328.  
  329. function up()
  330.  while not turtle.up() do end
  331. end
  332.  
  333. function down()
  334.  while not turtle.down() do end
  335. end
  336.  
  337. --RUN PROGRAM
  338.  
  339. function checkSelectedProgram()
  340.  clearScreen()
  341.  if program == 0 then
  342.   running = false
  343.  end
  344.  if program == 1 then
  345.   FWCchop()
  346.  end
  347.  if program == 2 then
  348.   FWCchop2()
  349.  end
  350.  if program == 3 then
  351.   FWCdebugstandard()
  352.  end
  353.  if program == 4 then
  354.   FWCdebugexpanded()
  355.  end
  356.  if program == 5 then
  357.   FWCbuild()
  358.  end
  359.  if program == 6 then
  360.   FWCexpand()
  361.  end
  362.  if program == 7 then
  363.   FWChelp()
  364.  end
  365.  if program == 8 then
  366.   FWCposition()
  367.  end
  368.  if program == 9 then
  369.   FWCexpandchests()
  370.  end
  371.  if program == 10 then
  372.   FWConebyone()
  373.  end
  374.  if program == 11 then
  375.   FWCtwobytwo()
  376.  end
  377.  if program == 12 then
  378.   FWCdigSpace()
  379.  end
  380. end
  381.  
  382. --MAIN CHOP PROGRAM FUNCTIONS
  383.  
  384. local function refreshItemStack(i)
  385.  turtle.select(4)
  386.  turtle.suck()
  387.  turtle.select(i)
  388.  turtle.drop()
  389.  turtle.select(4)
  390.  turtle.drop()
  391.  turtle.select(i)
  392.  turtle.suck()
  393.  if turtle.getItemCount(4) > 0 then
  394.   print("!!!!!!!!!")
  395.   print("The coal or sapling chest is full! Please take out some stacks, otherwise you lose items! The turtle will drop them!")
  396.   print("!!!!!!!!!")
  397.   turtle.select(4)
  398.   turtle.dropDown()
  399.  end
  400. end
  401.  
  402. local function moveForward(j)
  403.  for i = 1,j do
  404.   forward()
  405.  end
  406. end
  407.  
  408. local function checkFuel()
  409.  while turtle.getFuelLevel() < 96 and turtle.getItemCount(coal) > 0 do
  410.   turtle.select(1)
  411.   turtle.refuel(1)
  412.   print("Refueled!")
  413.  end
  414. end
  415.  
  416. local function getCoal()
  417.  local taking = true
  418.  local delay = os.startTimer(2)
  419.  print("Taking coal out of the chest!")
  420.  print("If nothing happens the chest has too less materials!")
  421.  print("Press Enter to terminate process!")
  422.  
  423.  while taking == true do
  424.   event = { os.pullEvent() }
  425.   if event[1] == "timer" and event[2] == delay then
  426.    refreshItemStack(1)
  427.    if turtle.getItemCount(1) < 8 then
  428.     delay = os.startTimer(2)
  429.    else
  430.     taking = false
  431.    end
  432.   elseif event[1] == "key" and event[2] == 28 then
  433.    print("Terminated by User!")
  434.    clearScreen()
  435.    os.shutdown()
  436.   end
  437.  end
  438.  print("Succesful!")
  439. end
  440.  
  441. local function getSaplings()
  442.  local taking = true
  443.  local delay = os.startTimer(2)
  444.  print("Taking saplings out of the chest!")
  445.  print("If nothing happens the chest has too less materials!")
  446.  print("Press Enter to terminate process!")
  447.  
  448.  while taking == true do
  449.   event = { os.pullEvent() }
  450.   if event[1] == "timer" and event[2] == delay then
  451.    refreshItemStack(2)
  452.    if turtle.getItemCount(2) < 16 then
  453.     delay = os.startTimer(2)
  454.    else
  455.     taking = false
  456.    end
  457.   elseif event[1] == "key" and event[2] == 28 then
  458.    print("Terminated by User!")
  459.    turtle.turnRight()
  460.    forward()
  461.    turtle.turnRight()
  462.    clearScreen()
  463.    os.shutdown()
  464.   end
  465.  end
  466.  print("Succesful!")
  467. end
  468.  
  469. local function getBonemeal()
  470.  local taking = true
  471.  local delay = os.startTimer(2)
  472.  print("Taking bonemeal out of the chest!")
  473.  print("If nothing happens the chest has too less materials!")
  474.  print("Press Enter to terminate process!")
  475.  
  476.  while taking == true do
  477.   event = { os.pullEvent() }
  478.   if usebonemeal == true then
  479.    if event[1] == "timer" and event[2] == delay then
  480.     turtle.select(4)
  481.     turtle.suckUp()
  482.     turtle.select(3)
  483.     turtle.dropUp()
  484.     turtle.select(4)
  485.     turtle.dropUp()
  486.     turtle.select(3)
  487.     turtle.suckUp()
  488.     if turtle.getItemCount(4) > 0 then
  489.      print("!!!!!!!!!")
  490.      print("The bonemeal chest is full! Please take out some stacks, otherwise you lose items! The turtle will drop them!")
  491.      print("!!!!!!!!!")
  492.      turtle.select(4)
  493.      turtle.dropDown()
  494.     end
  495.     if turtle.getItemCount(3) < 8 then
  496.      delay = os.startTimer(2)
  497.     else
  498.      taking = false
  499.     end
  500.    elseif event[1] == "key" and event[2] == 28 then
  501.     print("Terminated by User!")
  502.     turtle.turnRight()
  503.     forward()
  504.     turtle.turnRight()
  505.     clearScreen()
  506.     os.shutdown()
  507.    end
  508.   else
  509.    turtle.select(3)
  510.    turtle.dropUp()
  511.    taking = false
  512.   end
  513.  end
  514.  print("Successful!")
  515. end
  516.  
  517. local function storeWood()
  518.  print("Storing wood in the chests!")
  519.  chestfull = true
  520.  while chestfull == true do
  521.   if usebonemeal == true then
  522.    for i=4,16 do
  523.     if turtle.getItemCount(i) > 0 then
  524.      turtle.select(i)
  525.      chestfull = turtle.drop()
  526.     end
  527.    end
  528.   else
  529.    for i=3,16 do
  530.     if turtle.getItemCount(i) > 0 then
  531.      turtle.select(i)
  532.      chestfull = turtle.drop()
  533.     end
  534.    end
  535.   end
  536.  
  537.   chestfull = not chestfull
  538.    
  539.   if chestfull == true and turtle.detectUp() == true then
  540.    print("Wood! Wood everywhere!!!")
  541.    print("Your wood chests are full!")
  542.    print("Try to add more vertical chests or take wood out of them.")
  543.    print("")
  544.    chopping = false
  545.    while turtle.detectDown() == false do
  546.     down()
  547.    end
  548.    turtle.turnRight()
  549.      
  550.   end
  551.  
  552.   if chestfull == true and turtle.detectUp() == false then
  553.    up()
  554.    print("This Chest is full!")
  555.   end
  556.  
  557.  end
  558.  
  559.  while turtle.detectDown() == false do
  560.  down()
  561.  end
  562.  
  563.  print("Successful stored the wood!")
  564.  print("")
  565. end
  566.  
  567. local function plantTree()
  568.  print("Planting saplings!")
  569.  moveForward(2)
  570.  turtle.turnRight()
  571.  turtle.select(2)
  572.  turtle.place()
  573.  turtle.turnLeft()
  574.  back()
  575.  turtle.place()
  576.  turtle.turnRight()
  577.  turtle.place()
  578.  turtle.turnLeft()
  579.  back()
  580.  turtle.place()
  581.  turtle.select(2)
  582.  if usebonemeal == true then
  583.   while turtle.compare() == true and turtle.getItemCount(3) > 1 do
  584.    print("Fertilizing the tree with bonemeal!")
  585.    turtle.select(3)
  586.    turtle.place()
  587.    turtle.select(2)
  588.   end
  589.  else
  590.   print("Waiting for the tree to grow!")
  591.   print("Get some coffee this may take a while ;D")
  592.   while turtle.compare() == true do
  593.    os.sleep(5)
  594.   end
  595.  end
  596.  print("Successful planted new tree!")
  597.  print("")
  598. end
  599.  
  600. local function getMaterials()
  601.  print("Need more materials to continue!")
  602.  turtle.turnRight()
  603.  turtle.turnRight()
  604.  moveForward(distance)
  605.  
  606.  turtle.select(4)
  607.  turtle.dropDown()
  608.  
  609.  storeWood()
  610.  
  611.  turtle.turnRight()
  612.    
  613.  if redstone.getInput("back") == false then
  614.   print("Shutdown by redstone signal!")
  615.   chopping = false
  616.  else
  617.   getCoal()
  618.   turtle.turnRight()
  619.   turtle.forward()
  620.   turtle.turnRight()  
  621.   getSaplings()
  622.   getBonemeal()
  623.   turtle.turnLeft()
  624.   moveForward(distance-1)
  625.  end
  626. end
  627.  
  628. local function cutWood()
  629.  print("Chopping down the tree!")
  630.  local height = 0
  631.  if usebonemeal then
  632.   turtle.select(4)
  633.  else
  634.   turtle.select(3)
  635.  end
  636.  turtle.dig()
  637.  forward()
  638.  turtle.dig()
  639. while turtle.detectUp() do
  640.   turtle.digUp()
  641.   up()
  642.   turtle.dig()
  643.   height = height + 1
  644.  end
  645.  checkFuel()
  646.  print("Reached the top of the tree!")
  647.  turtle.turnRight()
  648.  turtle.dig()
  649.  forward()
  650.  turtle.turnLeft()
  651.  turtle.dig()
  652.  while height > 0 do
  653.   turtle.digDown()
  654.   down()
  655.   turtle.dig()
  656.   height = height - 1
  657.  end
  658.  print("Successful chopped the tree!")
  659.  print("")
  660.  back()
  661.  turtle.turnLeft()
  662.  forward()
  663.  turtle.turnRight()
  664. end
  665.  
  666. function chop()
  667.  if redstone.getInput("back") == true then
  668.   print("Starting the Fir Wood Chooper program!")
  669.   getCoal()
  670.   checkFuel()
  671.   if turtle.getItemCount(4) > 0 or turtle.getItemCount(16) > 0 then
  672.    turtle.turnLeft()
  673.    storeWood()
  674.    turtle.turnRight()
  675.   end
  676.   turtle.turnRight()
  677.   forward()
  678.   turtle.turnRight()
  679.   if turtle.getItemCount(2) < 16 then
  680.    getSaplings()
  681.   end
  682.   if turtle.getItemCount(3) < 4 and usebonemeal == true then
  683.    getBonemeal()
  684.   end
  685.   if turtle.getItemCount(3) > 0 and usebonemeal == false then
  686.    turtle.select(3)
  687.    turtle.dropUp()
  688.   end
  689.   turtle.turnRight()
  690.   forward()
  691.   turtle.turnRight()
  692.   turtle.turnRight()
  693.   moveForward(distance)
  694.  
  695.   while chopping == true do
  696.    checkFuel()
  697.    local needMaterials = false
  698.    if turtle.getItemCount(1) < 5 or turtle.getItemCount(2) < 2 then
  699.     needMaterials = true
  700.    end
  701.    if turtle.getItemCount(3) < 2 and usebonemeal == true then
  702.     needMaterials = true
  703.    end
  704.    if usebonemeal and turtle.getItemCount(14) > 0 then
  705.     needMaterials = true
  706.    end
  707.    if usebonemeal == false and turtle.getItemCount(7) > 0 then
  708.     needMaterials = true
  709.    end
  710.    if needMaterials == true then
  711.     getMaterials()
  712.    end
  713.    if chopping == true then
  714.     plantTree()
  715.     checkFuel()
  716.     cutWood()
  717.    end
  718.   end
  719.  else
  720.   print("No redstone signal, no wood!")
  721.   print("Be sure the Turtle is facing the coal chest and stays above the furnace!")
  722.   print("The redstone signal has to be in the back of the Turtle!")
  723.  end
  724.  print("Press Enter to get back into the menu!")
  725.  read()
  726.  chopping = true
  727. end
  728.  
  729. --FWCchop 11111111111111111111111
  730.  
  731. function FWCchop()
  732.  distance = 7
  733.  chop()
  734. end
  735.  
  736.  
  737. --FWCchop2 2222222222222222222222
  738.  
  739. function FWCchop2()
  740.  distance = 9
  741.  chop()
  742. end
  743.  
  744. --MAIN DEBUG FUNCTIONS
  745.  
  746. local function debugTree()
  747.  local height = 0
  748.  turtle.select(4)
  749.  turtle.dig()
  750.  forward()
  751.  turtle.dig()
  752.  while height < 45 do
  753.   turtle.digUp()
  754.   turtle.up()
  755.   turtle.dig()
  756.   height = height + 1
  757.  end
  758.  checkFuel()
  759.  turtle.turnRight()
  760.  turtle.dig()
  761.  forward()
  762.  turtle.turnLeft()
  763.  turtle.dig()
  764.  while height > 0 do
  765.   turtle.digDown()
  766.   down()
  767.   turtle.dig()
  768.   height = height - 1
  769.  end
  770.  back()
  771.  turtle.turnLeft()
  772.  forward()
  773.  turtle.turnLeft()
  774. end
  775.  
  776. --FWCdebugstandard 33333333333333333333333333
  777.  
  778. function FWCdebugstandard()
  779.  checkFuel()
  780.  turtle.turnRight()
  781.  moveForward(7)
  782.  debugTree()
  783.  moveForward(7)
  784.  turtle.turnRight()
  785.  print("Debug for standard farm finished!")
  786.  print("Press Enter to get back into the menu!")
  787.  read()
  788. end
  789.  
  790. --FWCdebugexpand 44444444444444444444444444444
  791.  
  792. function FWCdebugexpanded()
  793.  checkFuel()
  794.  turtle.turnRight()
  795.  moveForward(9)
  796.  debugTree()
  797.  moveForward(9)
  798.  turtle.turnRight()
  799.  print("Debug for expanded farm finished!")
  800.  print("Press Enter to get back into the menu!")
  801.  read()
  802. end
  803.  
  804. --MAIN BUILD FUNCTIONS
  805.  
  806. local function dbp(j)
  807.  for i=1,j do
  808.   turtle.placeDown()
  809.   turtle.back()
  810.   turtle.place()
  811.  end
  812. end
  813.  
  814. local function fd(j)
  815.  for i=1,j do
  816.   turtle.forward()
  817.   turtle.placeDown()
  818.  end
  819. end
  820.  
  821. local function bp(j)
  822.  for i=1,j do
  823.   turtle.back()
  824.   turtle.place()
  825.  end
  826. end
  827.  
  828. local function lb()
  829.  turtle.turnLeft()
  830.  turtle.back()
  831. end
  832.  
  833. --FWCbuild 55555555555555555555555555555555555
  834.  
  835. function FWCbuild()
  836.  if turtle.detectDown() then
  837.   print("There is a block underneath the turtle.")
  838.   print("Be sure you have free space under the turtle.")
  839.   print("Press Enter to get back to the menu.")
  840.   read()
  841.   return false
  842.  end
  843.  turtle.select(coal)
  844.  turtle.refuel(fuel)
  845.  turtle.select(stone1)
  846.  moveForward(2)
  847.  turtle.turnRight()
  848.  forward()
  849.  turtle.placeUp()
  850.  dbp(1)
  851.  turtle.placeUp()
  852.  turtle.placeDown()
  853.  back()
  854.  turtle.placeUp()
  855.  dbp(1)
  856.  down()
  857.  down()
  858.  turtle.turnLeft()
  859.  turtle.turnLeft()
  860.  forward()
  861.  
  862.  dbp(4)
  863.  turtle.select(stone1)
  864.  bp(1)
  865.  
  866.  dbp(3)
  867.  
  868.  lb()
  869.  dbp(2)
  870.  bp(8)
  871.  
  872.  lb()
  873.  bp(8)
  874.  
  875.  lb()
  876.  bp(8)
  877.  dbp(1)
  878.  turtle.placeDown()
  879.  turtle.turnLeft()
  880.  bp(1)
  881.  
  882.  turtle.turnRight()
  883.  turtle.turnRight()
  884.  down()
  885.  turtle.placeDown()
  886.  fd(7)
  887.  turtle.turnLeft()
  888.  fd(1)
  889.  turtle.turnLeft()
  890.  turtle.select(stone3)
  891.  fd(7)
  892.  
  893.  turtle.select(stone2)
  894.  turtle.turnRight()
  895.  up()
  896.  for i = 1,4 do
  897.   fd(8)
  898.   turtle.turnRight()
  899.   fd(1)
  900.   turtle.turnRight()
  901.   fd(7)
  902.   if i < 4 then
  903.    turtle.turnLeft()
  904.    fd(1)
  905.    turtle.turnLeft()
  906.   end
  907.  end
  908.  
  909.  turtle.select(stone3)
  910.  up()
  911.  up()
  912.  turtle.turnRight()
  913.  moveForward(3)
  914.  turtle.turnRight()
  915.  moveForward(2)
  916.  turtle.select(dirt)
  917.  fd(2)
  918.  turtle.turnLeft()
  919.  fd(1)
  920.  turtle.turnLeft()
  921.  fd(1)
  922.  moveForward(7)
  923.  
  924.  turtle.select(stone1)
  925.  turtle.placeDown()
  926.  turtle.turnLeft()
  927.  turtle.select(chest)
  928.  turtle.place()
  929.  turtle.select(sapling)
  930.  turtle.drop()
  931.  turtle.turnRight()
  932.  turtle.select(chest)
  933.  turtle.placeUp()
  934.  turtle.select(bonemeal)
  935.  turtle.dropUp()
  936.  forward()
  937.  turtle.select(chest)
  938.  turtle.place()
  939.  up()
  940.  turtle.place()
  941.  up()
  942.  turtle.place()
  943.  turtle.select(stone3)
  944.  turtle.placeUp()
  945.  
  946.  down()
  947.  down()
  948.  down()
  949.  turtle.turnRight()
  950.  turtle.select(woodenpipe)
  951.  turtle.place()
  952.  turtle.turnLeft()
  953.  down()
  954.  turtle.select(furnace)
  955.  turtle.placeUp()
  956.  turtle.select(coal)
  957.  turtle.dropUp(1)
  958.  turtle.select(ironpipe)
  959.  turtle.place()
  960.  lb()
  961.  turtle.select(pipe)
  962.  turtle.place()
  963.  turtle.turnLeft()
  964.  back()
  965.  turtle.select(goldpipe)
  966.  turtle.place()
  967.  up()
  968.  up()
  969.  turtle.select(chest)
  970.  turtle.place()
  971.  turtle.select(coal)
  972.  turtle.drop(1)
  973.  turtle.select(engine)
  974.  turtle.placeDown()
  975.  back()
  976.  turtle.select(stone3)
  977.  turtle.placeDown()
  978.  lb()
  979.  turtle.select(lever)
  980.  turtle.place()
  981.  back()
  982.  turtle.turnRight()
  983.  moveForward(2)
  984.  down()
  985.  turtle.select(pipe)
  986.  turtle.place()
  987.  down()
  988.  turtle.place()
  989.  down()
  990.  moveForward(2)
  991.  turtle.select(obsidianpipe)
  992.  turtle.place()
  993.  back()
  994.  turtle.select(pipe)
  995.  turtle.place()
  996.  back()
  997.  turtle.place()
  998.  
  999.  turtle.turnLeft()
  1000.  up()
  1001.  up()
  1002.  up()
  1003.  turtle.select(stone3)
  1004.  turtle.placeDown()
  1005.  forward()
  1006.  turtle.turnRight()
  1007.  turtle.turnRight()
  1008.  turtle.select(lever)
  1009.  turtle.place()
  1010.  turtle.turnRight()
  1011.  turtle.turnRight()
  1012.  
  1013.  print("Finally set up farm! Enjoy!")
  1014.  print("Flip the lever for the redstone engine.")
  1015.  print("")
  1016.  print("Press Enter to get back into the menu!")
  1017.  read()
  1018. end
  1019.  
  1020. --MAIN EXPAND FUNCTIONS
  1021.  
  1022. local function checkBlocks()
  1023.  if turtle.getItemCount(blockslot) == 0 and blockslot < 10 then
  1024.   blockslot = blockslot + 1
  1025.   turtle.select(blockslot)
  1026.  end
  1027. end
  1028.  
  1029. local function checkFuelexpand()
  1030.  print("The refueling needs around 8 coal!")
  1031.  while turtle.getFuelLevel() < 600 do
  1032.   print("Refueling!")
  1033.   turtle.select(coal)
  1034.   turtle.refuel(1)
  1035.  end
  1036. end
  1037.  
  1038.  
  1039. local function fde(j)
  1040.  for i=1,j do
  1041.   checkBlocks()
  1042.   forward()
  1043.   turtle.placeDown()
  1044.   checkBlocks()
  1045.  end
  1046. end
  1047.  
  1048. local function df(j)
  1049.  for i=1,j do
  1050.   turtle.dig()
  1051.   forward()
  1052.  end
  1053. end
  1054.  
  1055. local function dfd(j)
  1056.  for i=1,j do
  1057.   turtle.dig()
  1058.   forward()
  1059.   turtle.digDown()
  1060.  end
  1061. end
  1062.  
  1063. local function destroy()
  1064.  turtle.turnRight()
  1065.  moveForward(3)
  1066.  down()
  1067.  down()
  1068.  down()
  1069.  turtle.turnRight()
  1070.  turtle.select(obsidianpipeexpand)
  1071.  turtle.dig()
  1072.  forward()
  1073.  turtle.turnRight()
  1074.  turtle.select(pipeexpand)
  1075.  turtle.dig()
  1076.  turtle.select(blockslot)
  1077.  forward()
  1078.  turtle.turnLeft()
  1079.  df(4)
  1080.  turtle.turnLeft()
  1081.  up()
  1082.  dfd(2)
  1083.  df(9)
  1084.  turtle.turnLeft()
  1085.  df(9)
  1086.  turtle.turnLeft()
  1087.  df(8)
  1088.  dfd(2)
  1089.  down()
  1090.  down()
  1091.  turtle.turnLeft()
  1092.  df(8)
  1093.  turtle.turnLeft()
  1094.  df(1)
  1095.  turtle.turnLeft()
  1096.  df(7)
  1097.  turtle.turnRight()
  1098.  turtle.up()
  1099.  for i=1,4 do
  1100.   df(8)
  1101.   turtle.turnRight()
  1102.   df(1)
  1103.   turtle.turnRight()
  1104.   df(8)
  1105.   if i < 4 then
  1106.    turtle.turnLeft()
  1107.    forward()
  1108.    turtle.turnLeft()
  1109.   end
  1110.  end
  1111. end
  1112.  
  1113. local function layout()
  1114.  turtle.select(blockslot)
  1115.  forward()
  1116.  up()
  1117.  up()
  1118.  up()
  1119.  forward()
  1120.  turtle.turnLeft()
  1121.  back()
  1122.  back()
  1123.  turtle.placeDown()
  1124.  fde(7)
  1125.  for i=1,3 do
  1126.   turtle.turnLeft()
  1127.   fde(7)
  1128.   forward()
  1129.   down()
  1130.   turtle.placeDown()
  1131.   fde(1)
  1132.   up()
  1133.   back()
  1134.   turtle.placeDown()
  1135.   fde(9)
  1136.  end
  1137.  turtle.turnLeft()
  1138.  fde(6)
  1139.  turtle.turnLeft()
  1140.  forward()
  1141.  turtle.turnRight()
  1142.  moveForward(10)
  1143.  turtle.turnLeft()
  1144.  moveForward(8)
  1145. end
  1146.  
  1147. local function corners()
  1148.  turtle.down()
  1149.  for i=1,4 do
  1150.   fde(7)
  1151.   turtle.turnLeft()
  1152.   fde(6)
  1153.   turtle.turnLeft()
  1154.   forward()
  1155.   turtle.turnLeft()
  1156.   fde(5)
  1157.   turtle.turnRight()
  1158.   fde(4)
  1159.   turtle.turnRight()
  1160.   forward()
  1161.   turtle.turnRight()
  1162.   fde(3)
  1163.   turtle.turnLeft()
  1164.   fde(2)
  1165.   turtle.back()
  1166.   turtle.turnLeft()
  1167.   fde(1)
  1168.   turtle.turnRight()
  1169.   turtle.turnRight()
  1170.   moveForward(3)
  1171.   turtle.turnLeft()
  1172.   moveForward(5)
  1173.  end
  1174. end
  1175.  
  1176. local function lines(j)
  1177.  fde(j)
  1178.  back()
  1179.  turtle.turnLeft()
  1180.  fde(1)
  1181.  turtle.turnLeft()
  1182.  fde(j-2)
  1183.  if j > 4 then
  1184.   back()
  1185.   turtle.turnRight()
  1186.   fde(1)
  1187.   turtle.turnRight()
  1188.   lines(j-4)
  1189.  end
  1190. end
  1191.  
  1192. local function plateau()
  1193.  down()
  1194.  back()
  1195.  turtle.placeDown()
  1196.  turtle.turnLeft()
  1197.  lines(15)
  1198.  turtle.turnLeft()
  1199.  moveForward(8)
  1200.  turtle.turnLeft()
  1201.  moveForward(8)
  1202.  turtle.turnRight()
  1203.  turtle.turnRight()
  1204.  turtle.placeDown()
  1205.  lines(15)
  1206. end
  1207.  
  1208. local function pipeAndDirt()
  1209.  back()
  1210.  turtle.turnLeft()
  1211.  moveForward(9)
  1212.  turtle.select(dirtexpand)
  1213.  turtle.digUp()
  1214.  forward()
  1215.  turtle.digUp()
  1216.  turtle.turnRight()
  1217.  forward()
  1218.  turtle.digUp()
  1219.  turtle.turnRight()
  1220.  forward()
  1221.  turtle.digUp()
  1222.  forward()
  1223.  turtle.placeUp()
  1224.  forward()
  1225.  turtle.placeUp()
  1226.  turtle.turnRight()
  1227.  forward()
  1228.  turtle.placeUp()
  1229.  turtle.turnRight()
  1230.  forward()
  1231.  turtle.placeUp()
  1232.  turtle.digDown()
  1233.  down()
  1234.  turtle.digDown()
  1235.  down()
  1236.  df(9)
  1237.  turtle.select(pipeexpand)
  1238.  for i=1,9 do
  1239.   back()
  1240.   turtle.place()
  1241.  end
  1242.  up()
  1243.  turtle.placeDown()
  1244.  up()
  1245.  turtle.placeDown()
  1246.  back()
  1247.  turtle.select(obsidianpipeexpand)
  1248.  turtle.place()
  1249.  turtle.turnRight()
  1250.  forward()
  1251.  turtle.turnLeft()
  1252.  moveForward(8)
  1253.  up()
  1254.  up()
  1255.  moveForward(3)
  1256.  turtle.turnRight()
  1257. end
  1258.  
  1259. --FWCexpand 66666666666666666666666666
  1260. function FWCexpand()
  1261.  print("Expanding farm!")
  1262.  if turtle.getItemCount(1) < 9 then
  1263.   getCoal()
  1264.  end
  1265.  checkFuelexpand()
  1266.  blockslot = 5
  1267.  destroy()
  1268.  layout()
  1269.  corners()
  1270.  plateau()
  1271.  pipeAndDirt()
  1272.  print("Finished!")
  1273.  print("Press Enter to get back into the menu!")
  1274.  read()
  1275. end
  1276.  
  1277. --FWChelp 77777777777777777777777777777777777777777
  1278.  
  1279. function FWChelp()
  1280.  print("Welcome to the UWC Help Interface!")
  1281.  print("If you have any question, suggestions, bugs or feedback, let me know: Type")
  1282.  print("computercraft forum ultimate wood chopper")
  1283.  print("in Google and write a post or PM at me ;D")
  1284.  read()
  1285. end
  1286.  
  1287. --FWCposition 999999999999999999999999999999999999
  1288.  
  1289. function FWCposition()
  1290.  turtle.select(coal)
  1291.  turtle.refuel(1)
  1292.  up()
  1293.  up()
  1294.  up()
  1295.  up()
  1296.  turtle.turnRight()
  1297.  forward()
  1298.  forward()
  1299.  forward()
  1300.  forward()
  1301.  turtle.turnLeft()
  1302.  forward()
  1303.  forward()
  1304.  print(" ")
  1305.  print("Turtle in Base. Ready to set up farm.")
  1306.  print("Be sure the turtle has all the materials it needs.")
  1307.  print("Press Enter to get back into the menu.")
  1308.  read()
  1309. end
  1310.  
  1311. --FWCexpandchests
  1312.  
  1313. function FWCexpandchests()
  1314.  print("Adding more chests!")
  1315.  checkFuel()
  1316.  local amount = turtle.getItemCount(2)
  1317.  turtle.turnLeft()
  1318.  while not turtle.detectUp() do
  1319.   turtle.up()
  1320.  end
  1321.  turtle.select(3)
  1322.  turtle.digUp()
  1323.  turtle.select(2)
  1324.  while amount > 0 do
  1325.   up()
  1326.   turtle.place()
  1327.   amount = amount-1
  1328.  end
  1329.  turtle.select(3)
  1330.  turtle.placeUp()
  1331.  while turtle.down() do end
  1332.  turtle.turnRight()
  1333.  print("Finsihed!")
  1334.  print("Press Enter to get back into the menu.")
  1335.  read()
  1336. end
  1337.  
  1338. --FWCtwobytwo
  1339.  
  1340. function FWCtwobytwo()
  1341.  print("Chopping down 2x2 tree.")
  1342.  checkFuel()
  1343.  cutWood()
  1344.  print("Press Enter to get back into the menu.")
  1345.  read()
  1346. end
  1347.  
  1348. --FWConebyone
  1349.  
  1350. function FWConebyone()
  1351.  print("Chopping down 1x1 tree.")
  1352.  checkFuel()
  1353.  turtle.select(2)
  1354.  turtle.dig()
  1355.  forward()
  1356.  while turtle.compareUp() do
  1357.   turtle.digUp()
  1358.   up()
  1359.  end
  1360.  while not turtle.detectDown() do
  1361.   turtle.down()
  1362.  end
  1363.  print("Finsihed!")
  1364.  print("Press Enter to get back into the menu.")
  1365.  read()
  1366. end
  1367.  
  1368. --FWCdigSpace
  1369.  
  1370. function FWCdigSpace()
  1371.  os.sleep(2)
  1372.  turtle.select(1)
  1373.  turtle.refuel(5)
  1374.  back()
  1375.  back()
  1376.  turtle.turnLeft()
  1377.  forward()
  1378.  turtle.turnRight()
  1379.  turtle.digDown()
  1380.  turtle.down()
  1381.  turtle.digDown()
  1382.  turtle.down()
  1383.  for i=1,3 do
  1384.   for j=1,4 do
  1385.    turtle.forward()
  1386.    turtle.digUp()
  1387.    turtle.dig()
  1388.   end
  1389.   if i<3 then
  1390.    for j=1,4 do
  1391.     turtle.back()
  1392.    end
  1393.    turtle.turnRight()
  1394.    turtle.dig()
  1395.    turtle.forward()
  1396.    turtle.turnLeft()
  1397.   end
  1398.  end
  1399.  turtle.digDown()
  1400.  turtle.back()
  1401.  turtle.digDown()
  1402.  turtle.forward()
  1403.  turtle.up()
  1404.  turtle.up()
  1405.  turtle.turnLeft()
  1406.  moveForward(5)
  1407.  turtle.turnRight()
  1408.  turtle.forward()
  1409.  turtle.digDown()
  1410.  turtle.down()
  1411.  turtle.digDown()
  1412.  turtle.down()
  1413.  turtle.digDown()
  1414.  for i=1,5 do
  1415.   for j=1,11 do
  1416.    turtle.dig()
  1417.    turtle.forward()
  1418.    turtle.digUp()
  1419.    turtle.digDown()
  1420.   end
  1421.   turtle.turnRight()
  1422.   turtle.dig()
  1423.   turtle.forward()
  1424.   turtle.turnRight()
  1425.   turtle.digUp()
  1426.   turtle.digDown()
  1427.   for j=1,11 do
  1428.    turtle.dig()
  1429.    turtle.forward()
  1430.    turtle.digUp()
  1431.    turtle.digDown()  
  1432.   end
  1433.   if i < 5 then
  1434.    turtle.turnLeft()
  1435.    turtle.dig()
  1436.    turtle.forward()
  1437.    turtle.turnLeft()
  1438.    turtle.digDown()
  1439.    turtle.digUp()
  1440.   end
  1441.  end
  1442.  turtle.back()
  1443.  turtle.turnRight()
  1444.  turtle.forward()
  1445.  turtle.down()
  1446.  turtle.digDown()
  1447.  turtle.down()
  1448.  for i=1,8 do
  1449.   turtle.turnRight()
  1450.   turtle.dig()
  1451.   turtle.turnLeft()
  1452.   turtle.dig()
  1453.   turtle.forward()
  1454.  end
  1455.  turtle.turnLeft()
  1456.  turtle.up()
  1457.  turtle.up()
  1458.  turtle.up()
  1459.  turtle.up()
  1460.  moveForward(3)
  1461.  turtle.turnLeft()
  1462.  moveForward(4)
  1463.  turtle.turnLeft()
  1464.  print("Finished!")
  1465.  print("Press Enter to get back into the menu!")
  1466.  read()
  1467. end
  1468.  
  1469. --MAIN PROGRAM
  1470.  
  1471. while running == true do
  1472.  runMenu()
  1473.  checkSelectedProgram()
  1474. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement