Advertisement
Guest User

Untitled

a guest
Oct 7th, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.90 KB | None | 0 0
  1. -- This file supplies plain, non-windowed doors.
  2.  
  3. -- Left-opening
  4.  
  5. minetest.register_node("homedecor:door_wood_plain_top_left", {
  6. description = "wood/glass door top half",
  7. drawtype = "nodebox",
  8. tiles = {
  9. "homedecor_door_wood_plain_tb.png",
  10. "homedecor_door_wood_plain_tb.png",
  11. "homedecor_door_wood_plain_lr.png",
  12. "homedecor_door_wood_plain_lr.png",
  13. "homedecor_door_wood_plain_right_top.png",
  14. "homedecor_door_wood_plain_left_top.png",
  15. },
  16. paramtype = "light",
  17. paramtype2 = "facedir",
  18. is_ground_content = true,
  19. groups = {snappy=3, not_in_creative_inventory=1},
  20. sounds = default.node_sound_wood_defaults(),
  21. walkable = true,
  22. selection_box = {
  23. type = "fixed",
  24. fixed = { -0.5, -0.5, 6/16, 0.5, 0.5, 8/16 }
  25. },
  26. node_box = {
  27. type = "fixed",
  28. fixed = { -0.5, -0.5, 6/16, 0.5, 0.5, 8/16 }
  29. },
  30. drop = "homedecor:door_wood_plain_bottom_left",
  31. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  32. if minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "homedecor:door_wood_plain_bottom_left" then
  33. minetest.env:remove_node({x=pos.x, y=pos.y-1, z=pos.z})
  34. end
  35. end,
  36. on_punch = function(pos, node, puncher)
  37. nfdir=node.param2-1
  38. if nfdir < 0 then nfdir = 3 end
  39. minetest.env:add_node(pos, { name = "homedecor:door_wood_plain_top_right", param2=nfdir})
  40. minetest.env:add_node({x=pos.x, y=pos.y-1, z=pos.z}, { name = "homedecor:door_wood_plain_bottom_right", param2=nfdir})
  41. end
  42. })
  43.  
  44. minetest.register_node("homedecor:door_wood_plain_bottom_left", {
  45. description = "Wood and Glass Grid-Style Door",
  46. drawtype = "nodebox",
  47. tiles = {
  48. "homedecor_door_wood_plain_tb.png",
  49. "homedecor_door_wood_plain_tb.png",
  50. "homedecor_door_wood_plain_lr.png",
  51. "homedecor_door_wood_plain_lr.png",
  52. "homedecor_door_wood_plain_right_bottom.png",
  53. "homedecor_door_wood_plain_left_bottom.png",
  54. },
  55. wield_image = "homedecor_door_wood_plain_left_inv.png",
  56. inventory_image = "homedecor_door_wood_plain_left_inv.png",
  57. wield_scale = {x=1,y=1,z=0.25},
  58. paramtype = "light",
  59. paramtype2 = "facedir",
  60. is_ground_content = true,
  61. groups = {snappy=3},
  62. sounds = default.node_sound_wood_defaults(),
  63. walkable = true,
  64. selection_box = {
  65. type = "fixed",
  66. fixed = { -0.5, -0.5, 6/16, 0.5, 0.5, 8/16 }
  67. },
  68. node_box = {
  69. type = "fixed",
  70. fixed = { -0.5, -0.5, 6/16, 0.5, 0.5, 8/16 }
  71. },
  72. on_place = function(itemstack, placer, pointed_thing)
  73. fdir = minetest.dir_to_facedir(placer:get_look_dir())
  74. local pos = pointed_thing.above
  75. if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
  76. minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' )
  77. return
  78. end
  79. minetest.env:place_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_plain_top_left", param2=fdir})
  80. return minetest.item_place(itemstack, placer, pointed_thing)
  81.  
  82. end,
  83. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  84. if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_wood_plain_top_left" then
  85. minetest.env:remove_node({x=pos.x, y=pos.y+1, z=pos.z})
  86. end
  87. end,
  88. on_punch = function(pos, node, puncher)
  89. nfdir=node.param2-1
  90. if nfdir < 0 then nfdir = 3 end
  91. minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_plain_top_right", param2=nfdir})
  92. minetest.env:add_node(pos, { name = "homedecor:door_wood_plain_bottom_right", param2=nfdir})
  93. end
  94. })
  95.  
  96. -- Right-opening
  97.  
  98. minetest.register_node("homedecor:door_wood_plain_top_right", {
  99. description = "wood/glass door top half",
  100. drawtype = "nodebox",
  101. tiles = {
  102. "homedecor_door_wood_plain_tb.png",
  103. "homedecor_door_wood_plain_tb.png",
  104. "homedecor_door_wood_plain_lr.png",
  105. "homedecor_door_wood_plain_lr.png",
  106. "homedecor_door_wood_plain_left_top.png",
  107. "homedecor_door_wood_plain_right_top.png",
  108. },
  109. paramtype = "light",
  110. paramtype2 = "facedir",
  111. is_ground_content = true,
  112. groups = {snappy=3, not_in_creative_inventory=1},
  113. sounds = default.node_sound_wood_defaults(),
  114. walkable = true,
  115. selection_box = {
  116. type = "fixed",
  117. fixed = { -0.5, -0.5, 6/16, 0.5, 0.5, 8/16 }
  118. },
  119. node_box = {
  120. type = "fixed",
  121. fixed = { -0.5, -0.5, 6/16, 0.5, 0.5, 8/16 }
  122. },
  123. drop = "homedecor:door_wood_plain_bottom_left",
  124. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  125. if minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "homedecor:door_wood_plain_bottom_right" then
  126. minetest.env:remove_node({x=pos.x, y=pos.y-1, z=pos.z})
  127. end
  128. end,
  129. on_punch = function(pos, node, puncher)
  130. nfdir=node.param2+1
  131. if nfdir > 3 then nfdir = 0 end
  132. minetest.env:add_node(pos, { name = "homedecor:door_wood_plain_top_left", param2=nfdir})
  133. minetest.env:add_node({x=pos.x, y=pos.y-1, z=pos.z}, { name = "homedecor:door_wood_plain_bottom_left", param2=nfdir})
  134. end
  135. })
  136.  
  137. minetest.register_node("homedecor:door_wood_plain_bottom_right", {
  138. description = "Wood and Glass Grid-Style Door (Right-opening)",
  139. drawtype = "nodebox",
  140. tiles = {
  141. "homedecor_door_wood_plain_tb.png",
  142. "homedecor_door_wood_plain_tb.png",
  143. "homedecor_door_wood_plain_lr.png",
  144. "homedecor_door_wood_plain_lr.png",
  145. "homedecor_door_wood_plain_left_bottom.png",
  146. "homedecor_door_wood_plain_right_bottom.png",
  147. },
  148. wield_image = "homedecor_door_wood_plain_right_inv.png",
  149. inventory_image = "homedecor_door_wood_plain_right_inv.png",
  150. wield_scale = {x=1,y=1,z=0.25},
  151. paramtype = "light",
  152. paramtype2 = "facedir",
  153. is_ground_content = true,
  154. groups = {snappy=3},
  155. sounds = default.node_sound_wood_defaults(),
  156. walkable = true,
  157. selection_box = {
  158. type = "fixed",
  159. fixed = { -0.5, -0.5, 6/16, 0.5, 0.5, 8/16 }
  160. },
  161. node_box = {
  162. type = "fixed",
  163. fixed = { -0.5, -0.5, 6/16, 0.5, 0.5, 8/16 }
  164. },
  165. drop = "homedecor:door_wood_plain_bottom_left",
  166. on_place = function(itemstack, placer, pointed_thing)
  167. fdir = minetest.dir_to_facedir(placer:get_look_dir())
  168. local pos = pointed_thing.above
  169. if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
  170. minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' )
  171. return
  172. end
  173. minetest.env:place_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_plain_top_right", param2=fdir})
  174. return minetest.item_place(itemstack, placer, pointed_thing)
  175.  
  176. end,
  177. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  178. if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_wood_plain_top_right" then
  179. minetest.env:remove_node({x=pos.x, y=pos.y+1, z=pos.z})
  180. end
  181. end,
  182. on_punch = function(pos, node, puncher)
  183. nfdir=node.param2+1
  184. if nfdir > 3 then nfdir = 0 end
  185. minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_plain_top_left", param2=nfdir})
  186. minetest.env:add_node(pos, { name = "homedecor:door_wood_plain_bottom_left", param2=nfdir})
  187. end
  188. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement