Kagee

build-3d-backup

May 6th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. os.loadAPI("libstruct")
  2. b=libstruct
  3. a=aware
  4. args = {...}
  5. if #args < 1 then
  6. error("Arguments: <name>")
  7. end
  8. t=b.load(args[1]..".3d")
  9. height=t["height"]
  10. width=t["width"]
  11. depth=t["depth"]
  12. endblock=t["endblock"]
  13. a.setposition("start")
  14. firstdown=true
  15. for h=0,height do
  16. if(firstdown) then
  17. firstdown=false
  18. pos=a.getposition("current")
  19. pos[3] = pos[3] - height-h --down
  20. a.goto(pos)
  21. elseif (h<=height) then
  22. pos=a.getposition("current")
  23. pos[3] = pos[3] + 1
  24. a.goto(pos)
  25. end
  26. w=width
  27. moveleft=true
  28. while (w > 0) do
  29. for d=0,depth do
  30. pos = a.getposition("current")
  31. print("Pos: h" .. pos[3]*-1 .. "-w" .. pos[1] .. "-d" .. pos[2])
  32. block = t[pos[3]*-1][pos[1]][pos[2]]
  33. b.place(block)
  34. if(d<depth) then
  35. a.df()
  36. end
  37. end
  38. w = w - 1
  39. if (w < 0) then
  40. moveleft=true
  41. else
  42. if(moveleft) then
  43. a.l()
  44. a.df()
  45. a.l()
  46. moveleft=false
  47. else
  48. a.r()
  49. a.df()
  50. a.r()
  51. moveleft=true
  52. end
  53. end
  54. end
  55. if(h<height) then
  56. a.r()
  57. a.r()
  58. end
  59. end
  60. a.goto(a.getposition("start"))
  61. b.awarecleanup()
Advertisement
Add Comment
Please, Sign In to add comment