Advertisement
theninthbit

computercraft_build_modem

Feb 16th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. -- ------------------------------------ --
  2. -- build core | crafty | modem | v1     --
  3. -- builds a modem                       --
  4. -- based on vertical array              --
  5. -- ------------------------------------ --
  6. stone,redstone,glass,iron=shell.run("recipe") -- modem recipe pastebin.com/HjaP1eYm
  7. ingredients={stone,{nil},glass,iron}
  8.  
  9. -- resets the robot
  10. shell.run("resetBuild") -- pastebin.com/jHBga2nu
  11.  
  12. -- weird exception. modem needs a torch crafted.
  13. -- assumes robot is at top
  14. shell.run("go down 2") --skip to redstone
  15.     turtle.suck() --from redstone
  16.     turtle.transferTo(11,1)
  17.     turtle.drop()
  18. shell.run("turn left 2") --does 180
  19.     turtle.suck() --from sticks
  20.     turtle.transferTo(15,1)
  21.     turtle.drop()
  22.     turtle.craft() --just made 1 torch
  23.     turtle.transferTo(11) --torch goes to slot 11
  24. shell.run("turn left 2") --does 180 back to normal
  25. shell.run("go up 2") --back to start except with a torch in slot 11
  26.  
  27. -- runs through ingredients
  28. for i=1,getn(ingredients) do
  29.     turtle.down()
  30.     if getn(ingredients[i])>0 then
  31.         turtle.select(1)
  32.         turtle.suck()
  33.         for j=1,getn(ingredients[i]) do
  34.             turtle.transferTo(ingredients[i][j],1)
  35.         end
  36.         turtle.drop()
  37.     end
  38. end
  39.  
  40. --actually creates the modem
  41. turtle.craft()
  42. --go to bottom level to dropoff product
  43. while turtle.detectDown() do
  44.     turtle.down()
  45. end
  46. turtle.drop()
  47.  
  48. -- check fuel levels
  49. shell.run("refuelBuild") -- pastebin.com/n9KMVt9x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement