Advertisement
psychedelixx

Minecraft Turtle: Platform

Dec 15th, 2013
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.         Minecraft Turtle: Platform
  3.         2013 (c) psychedelixx
  4.         2013-12-15
  5.  
  6.         Builds a simple platform
  7.  
  8.         Usage:
  9.         - use turtle and type "label set <name>"
  10.           (to give your turtle an unique name so it remembers its programs)
  11.         - type "pastebin get S5K1GvhA platform"
  12. --]]
  13.  
  14. dirCounter = 1
  15. width = 2
  16. length = 2
  17.  
  18. --[[ --- Parameter ---- ]]--
  19. local args = { ... }
  20.  
  21. if #args == 1 then
  22.     width  = tonumber(args[1])
  23.     length = width
  24. end
  25.  
  26. if #args == 2 then
  27.     width  = tonumber(args[1])
  28.     length = tonumber(args[2])
  29. end
  30.  
  31. if width*length > 1024 then
  32.     print("max size: 1024 (32*32)")
  33. end
  34.  
  35. if turtle.getFuelLevel() < width * length then
  36.     turtle.refuel()
  37. end
  38.                    
  39. if turtle.getFuelLevel() < width * length then
  40.     print("Amount of missing fuel: ", width * length - turtle.getFuelLevel())
  41.     print("Missing fuel in coal: ", (width * length - turtle.getFuelLevel())/80+1)
  42. end
  43.  
  44. sumItems = 0
  45. for i=1, 16, 1 do
  46.     sumItems = sumItems + turtle.getItemCount(i)
  47. end        
  48.  
  49. if sumItems < width*length then
  50.     print("Not enough Resources")
  51. else
  52.     print("======== 2013 (c) psychedelixx ========")
  53.     print("=========== Platform Builder ==========")
  54.    
  55.     turtle.up()
  56.  
  57.     slot = 1
  58.  
  59.     for w=1, width, 1 do
  60.     for l=1, length, 1 do
  61.         if turtle.getItemCount(slot) == 0 and slot < 16 then
  62.             slot = slot + 1
  63.         end
  64.             turtle.select(slot)
  65.  
  66.             turtle.digDown()
  67.             turtle.placeDown()
  68.         if l < length then
  69.                 turtle.dig()
  70.             turtle.forward()
  71.         end
  72.     end
  73.  
  74.     if w < width then
  75.             if dirCounter%2 == 1 then
  76.                 turtle.turnRight()
  77.             turtle.forward()
  78.             turtle.turnRight()
  79.         else
  80.             turtle.turnLeft()
  81.             turtle.forward()
  82.             turtle.turnLeft()
  83.         end
  84.         else
  85.             if dirCounter%2 == 1 then
  86.                 turtle.turnRight()
  87.             turtle.turnRight()
  88.         for l=1, length-1, 1 do
  89.                 turtle.forward()
  90.                 end
  91.         end
  92.         turtle.turnRight()
  93.  
  94.         for w=1, width-1, 1 do
  95.             turtle.forward()
  96.             end
  97.     end
  98.     dirCounter = dirCounter + 1
  99.     end    
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement