nodes_roof.lua 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. -- Boilerplate to support localized strings if intllib mod is installed.
  2. local S = cottages.S
  3. ---------------------------------------------------------------------------------------
  4. -- roof parts
  5. ---------------------------------------------------------------------------------------
  6. -- a better roof than the normal stairs; can be replaced by stairs:stair_wood
  7. -- create the three basic roof parts plus receipes for them;
  8. cottages.register_roof = function( name, tiles, basic_material, homedecor_alternative )
  9. minetest.register_node("cottages:roof_"..name, {
  10. description = S("Roof "..name),
  11. drawtype = "nodebox",
  12. --tiles = {cottages.textures_roof_wood,cottages.texture_roof_sides,cottages.texture_roof_sides,cottages.texture_roof_sides,cottages.texture_roof_sides,cottages.textures_roof_wood},
  13. tiles = tiles,
  14. paramtype = "light",
  15. paramtype2 = "facedir",
  16. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  17. node_box = {
  18. type = "fixed",
  19. fixed = {
  20. {-0.5, -0.5, -0.5, 0.5, 0, 0},
  21. {-0.5, 0, 0, 0.5, 0.5, 0.5},
  22. },
  23. },
  24. selection_box = {
  25. type = "fixed",
  26. fixed = {
  27. {-0.5, -0.5, -0.5, 0.5, 0, 0},
  28. {-0.5, 0, 0, 0.5, 0.5, 0.5},
  29. },
  30. },
  31. is_ground_content = false,
  32. })
  33. -- a better roof than the normal stairs; this one is for usage directly on top of walls (it has the form of a stair)
  34. if( name~="straw" or not(minetest.registered_nodes["stairs:stair_straw"]) or not(cottages.use_farming_straw_stairs)) then
  35. minetest.register_node("cottages:roof_connector_"..name, {
  36. description = S("Roof connector "..name),
  37. drawtype = "nodebox",
  38. -- top, bottom, side1, side2, inner, outer
  39. tiles = tiles,
  40. paramtype = "light",
  41. paramtype2 = "facedir",
  42. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  43. node_box = {
  44. type = "fixed",
  45. fixed = {
  46. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  47. {-0.5, 0, 0, 0.5, 0.5, 0.5},
  48. },
  49. },
  50. selection_box = {
  51. type = "fixed",
  52. fixed = {
  53. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  54. {-0.5, 0, 0, 0.5, 0.5, 0.5},
  55. },
  56. },
  57. is_ground_content = false,
  58. })
  59. else
  60. minetest.register_alias("cottages:roof_connector_straw", "stairs:stair_straw")
  61. end
  62. -- this one is the slab version of the above roof
  63. if( name~="straw" or not(minetest.registered_nodes["stairs:slab_straw"]) or not(cottages.use_farming_straw_stairs)) then
  64. minetest.register_node("cottages:roof_flat_"..name, {
  65. description = S("Roof (flat) "..name),
  66. drawtype = "nodebox",
  67. -- top, bottom, side1, side2, inner, outer
  68. -- this one is from all sides - except from the underside - of the given material
  69. tiles = { tiles[1], tiles[2], tiles[1], tiles[1], tiles[1], tiles[1] };
  70. paramtype = "light",
  71. paramtype2 = "facedir",
  72. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  73. node_box = {
  74. type = "fixed",
  75. fixed = {
  76. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  77. },
  78. },
  79. selection_box = {
  80. type = "fixed",
  81. fixed = {
  82. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  83. },
  84. },
  85. is_ground_content = false,
  86. })
  87. else
  88. minetest.register_alias("cottages:roof_flat_straw", "stairs:slab_straw")
  89. end
  90. if( not( homedecor_alternative )
  91. or ( minetest.get_modpath("homedecor") ~= nil )) then
  92. minetest.register_craft({
  93. output = "cottages:roof_"..name.." 6",
  94. recipe = {
  95. {'', '', basic_material },
  96. {'', basic_material, '' },
  97. {basic_material, '', '' }
  98. }
  99. })
  100. end
  101. -- make those roof parts that use homedecor craftable without that mod
  102. if( homedecor_alternative ) then
  103. basic_material = 'cottages:roof_wood';
  104. minetest.register_craft({
  105. output = "cottages:roof_"..name.." 3",
  106. recipe = {
  107. {homedecor_alternative, '', basic_material },
  108. {'', basic_material, '' },
  109. {basic_material, '', '' }
  110. }
  111. })
  112. end
  113. minetest.register_craft({
  114. output = "cottages:roof_connector_"..name,
  115. recipe = {
  116. {'cottages:roof_'..name },
  117. {cottages.craftitem_wood },
  118. }
  119. })
  120. minetest.register_craft({
  121. output = "cottages:roof_flat_"..name..' 2',
  122. recipe = {
  123. {'cottages:roof_'..name, 'cottages:roof_'..name },
  124. }
  125. })
  126. -- convert flat roofs back to normal roofs
  127. minetest.register_craft({
  128. output = "cottages:roof_"..name,
  129. recipe = {
  130. {"cottages:roof_flat_"..name, "cottages:roof_flat_"..name }
  131. }
  132. })
  133. end -- of cottages.register_roof( name, tiles, basic_material )
  134. ---------------------------------------------------------------------------------------
  135. -- add the diffrent roof types
  136. ---------------------------------------------------------------------------------------
  137. cottages.register_roof( 'straw',
  138. {cottages.straw_texture, cottages.straw_texture,
  139. cottages.straw_texture, cottages.straw_texture,
  140. cottages.straw_texture, cottages.straw_texture},
  141. 'cottages:straw_mat', nil );
  142. cottages.register_roof( 'reet',
  143. {"cottages_reet.png","cottages_reet.png",
  144. "cottages_reet.png","cottages_reet.png",
  145. "cottages_reet.png","cottages_reet.png"},
  146. cottages.craftitem_papyrus, nil );
  147. cottages.register_roof( 'wood',
  148. {cottages.textures_roof_wood, cottages.texture_roof_sides,
  149. cottages.texture_roof_sides, cottages.texture_roof_sides,
  150. cottages.texture_roof_sides, cottages.textures_roof_wood},
  151. cottages.craftitem_wood, nil);
  152. cottages.register_roof( 'black',
  153. {"cottages_homedecor_shingles_asphalt.png", cottages.texture_roof_sides,
  154. cottages.texture_roof_sides, cottages.texture_roof_sides,
  155. cottages.texture_roof_sides, "cottages_homedecor_shingles_asphalt.png"},
  156. 'homedecor:shingles_asphalt', cottages.craftitem_coal_lump);
  157. cottages.register_roof( 'red',
  158. {"cottages_homedecor_shingles_terracotta.png", cottages.texture_roof_sides,
  159. cottages.texture_roof_sides, cottages.texture_roof_sides,
  160. cottages.texture_roof_sides, "cottages_homedecor_shingles_terracotta.png"},
  161. 'homedecor:shingles_terracotta', cottages.craftitem_clay_brick);
  162. cottages.register_roof( 'brown',
  163. {"cottages_homedecor_shingles_wood.png", cottages.texture_roof_sides,
  164. cottages.texture_roof_sides, cottages.texture_roof_sides,
  165. cottages.texture_roof_sides, "cottages_homedecor_shingles_wood.png"},
  166. 'homedecor:shingles_wood', cottages.craftitem_dirt);
  167. cottages.register_roof( 'slate',
  168. {"cottages_slate.png", cottages.texture_roof_sides,
  169. "cottages_slate.png", "cottages_slate.png",
  170. cottages.texture_roof_sides,"cottages_slate.png"},
  171. cottages.craftitem_stone, nil);
  172. ---------------------------------------------------------------------------------------
  173. -- slate roofs are sometimes on vertical fronts of houses
  174. ---------------------------------------------------------------------------------------
  175. minetest.register_node("cottages:slate_vertical", {
  176. description = S("Vertical Slate"),
  177. tiles = {"cottages_slate.png",cottages.texture_roof_sides,"cottages_slate.png","cottages_slate.png",cottages.texture_roof_sides,"cottages_slate.png"},
  178. paramtype2 = "facedir",
  179. groups = {cracky=2, stone=1},
  180. sounds = cottages.sounds.stone,
  181. is_ground_content = false,
  182. })
  183. minetest.register_craft({
  184. output = "cottages:slate_vertical",
  185. recipe = { {cottages.craftitem_stone, cottages.craftitem_wood, '' }
  186. }
  187. });
  188. ---------------------------------------------------------------------------------------
  189. -- Reed might also be needed as a full block
  190. ---------------------------------------------------------------------------------------
  191. minetest.register_node("cottages:reet", {
  192. description = S("Reet for thatching"),
  193. tiles = {"cottages_reet.png"},
  194. groups = {hay = 3, snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3},
  195. sounds = cottages.sounds.leaves,
  196. is_ground_content = false,
  197. })
  198. minetest.register_craft({
  199. output = "cottages:reet",
  200. recipe = { {cottages.craftitem_papyrus,cottages.craftitem_papyrus},
  201. {cottages.craftitem_papyrus,cottages.craftitem_papyrus},
  202. },
  203. })