Advertisement
tahg

Untitled

Nov 18th, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. local p = peripheral.wrap("top")
  2. local w = p.getWorld(0)
  3. local r = 3
  4. local d = 8
  5. local b = 0
  6. local f = 0
  7. local c = 0
  8. local s = 0
  9. function WallN(x, y, z)
  10. for yy = (y - r), (y + r) do
  11. for xx = (x - r), (x + r) do
  12. w.setBlockWithoutNotify(xx, yy, z - r, b, s)
  13. end
  14. end
  15. end
  16.  
  17. function WallS(x, y, z)
  18. for yy = (y - r), (y + r) do
  19. for xx = (x - r), (x + r) do
  20. w.setBlockWithoutNotify(xx, yy, z + r, b, s)
  21. end
  22. end
  23. end
  24.  
  25. function WallW(x, y, z)
  26. for yy = (y - r), (y + r) do
  27. for zz = (z - r), (z + r) do
  28. w.setBlockWithoutNotify(x - r, yy, zz, b, s)
  29. end
  30. end
  31. end
  32.  
  33. function WallE(x, y, z)
  34. for yy = (y - r), (y + r) do
  35. for zz = (z - r), (z + r) do
  36. w.setBlockWithoutNotify(x + r, yy, zz, b, s)
  37. end
  38. end
  39. end
  40.  
  41. function Floor(x, y, z)
  42. for zz = (z - r), (z + r) do
  43. for xx = (x - r), (x + r) do
  44. w.setBlockWithoutNotify(xx, y - r, zz, b, f)
  45. end
  46. end
  47. end
  48.  
  49. function Ceiling(x, y, z)
  50. for zz = (z - r), (z + r) do
  51. for xx = (x - r), (x + r) do
  52. w.setBlockWithoutNotify(xx, y + r, zz, b, c)
  53. end
  54. end
  55. end
  56.  
  57. function DoorN(x, y, z)
  58. for yy = (y - r + 1), (y - r + 3) do
  59. for xx = (x - 1), (x + 1) do
  60. w.setBlockWithoutNotify(xx, yy, z - r, 0, 0)
  61. end
  62. end
  63. end
  64.  
  65. function DoorS(x, y, z)
  66. for yy = (y - r), (y - r + 4) do
  67. for xx = (x - 2), (x + 2) do
  68. w.setBlockWithoutNotify(xx, yy, z + r + 1, b, s)
  69. end
  70. end
  71. for yy = (y - r + 1), (y - r + 3) do
  72. for xx = (x - 1), (x + 1) do
  73. w.setBlockWithoutNotify(xx, yy, z + r + 1, 0, 0)
  74. w.setBlockWithoutNotify(xx, yy, z + r, 0, 0)
  75. end
  76. end
  77. end
  78.  
  79. function DoorW(x, y, z)
  80. for yy = (y - r + 1), (y - r + 3) do
  81. for zz = (z - 1), (z + 1) do
  82. w.setBlockWithoutNotify(x - r, yy, zz, 0, 0)
  83. end
  84. end
  85. end
  86.  
  87. function DoorE(x, y, z)
  88. for yy = (y - r), (y - r + 4) do
  89. for zz = (z - 2), (z + 2) do
  90. w.setBlockWithoutNotify(x + r + 1, yy, zz, b, s)
  91. end
  92. end
  93. for yy = (y - r + 1), (y - r + 3) do
  94. for zz = (z - 1), (z + 1) do
  95. w.setBlockWithoutNotify(x + r + 1, yy, zz, 0, 0)
  96. w.setBlockWithoutNotify(x + r, yy, zz, 0, 0)
  97. end
  98. end
  99. end
  100.  
  101. function Floor2(x, y, z)
  102. w.setBlockWithoutNotify(x, y - r, z, 0, 0)
  103. end
  104.  
  105. function Ceiling2(x, y, z)
  106. w.setBlockWithoutNotify(x - 1, y + r + 1, z - 1, b, c)
  107. w.setBlockWithoutNotify(x, y + r + 1, z - 1, b, c)
  108. w.setBlockWithoutNotify(x + 1, y + r + 1, z - 1, b, c)
  109. w.setBlockWithoutNotify(x - 1, y + r + 1, z, b, c)
  110. w.setBlockWithoutNotify(x + 1, y + r + 1, z, b, c)
  111. w.setBlockWithoutNotify(x - 1, y + r + 1, z + 1, b, c)
  112. w.setBlockWithoutNotify(x, y + r + 1, z + 1, b, c)
  113. w.setBlockWithoutNotify(x + 1, y + r + 1, z + 1, b, c)
  114. w.setBlockWithoutNotify(x, y + r, z, 0, 0)
  115. end
  116.  
  117. function room(x, y, z, data)
  118. WallN(x, y, z)
  119. WallS(x, y, z)
  120. WallW(x, y, z)
  121. WallE(x, y, z)
  122. Floor(x, y, z)
  123. Ceiling(x, y, z)
  124. w.setBlock(x - 2, y + 2, z - 2, 1717, 0)
  125. w.setBlock(x + 2, y + 2, z - 2, 1717, 0)
  126. w.setBlock(x - 2, y + 2, z + 2, 1717, 0)
  127. w.setBlock(x + 2, y + 2, z + 2, 1717, 0)
  128. if bit.band(data, 1) ~= 0 then DoorW(x, y, z) end
  129. if bit.band(data, 2) ~= 0 then DoorE(x, y, z) end
  130. if bit.band(data, 4) ~= 0 then DoorN(x, y, z) end
  131. if bit.band(data, 8) ~= 0 then DoorS(x, y, z) end
  132. if bit.band(data, 16) ~= 0 then Floor2(x, y, z) end
  133. if bit.band(data, 32) ~= 0 then Ceiling2(x, y, z) end
  134. end
  135.  
  136. local data = fs.open("data", "r")
  137. function makeRooms()
  138. for y = 1, 9 do
  139. for z = 1, 25 do
  140. for x = 1, 25 do
  141. room(x * 8, y * 8 + 20, z * 8, tonumber(data.readLine()))
  142. os.sleep(.05)
  143. end
  144. end
  145. end
  146. end
  147. makeRooms()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement