arrow_slits.lua 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. -- internationalization boilerplate
  2. local MP = minetest.get_modpath(minetest.get_current_modname())
  3. local S, NS = dofile(MP.."/intllib.lua")
  4. castle_masonry.register_arrowslit = function(material)
  5. local composition_def, burn_time, tile, desc = castle_masonry.get_material_properties(material)
  6. local mod_name = minetest.get_current_modname()
  7. -- Node Definition
  8. minetest.register_node(mod_name..":arrowslit_"..material.name, {
  9. drawtype = "nodebox",
  10. description = S("@1 Arrowslit", desc),
  11. tiles = tile,
  12. groups = composition_def.groups,
  13. sounds = composition_def.sounds,
  14. paramtype = "light",
  15. paramtype2 = "facedir",
  16. node_box = {
  17. type = "fixed",
  18. fixed = {
  19. {-0.5, -0.375, 0.5, -0.0625, 0.375, 0.3125},
  20. {0.0625, -0.375, 0.5, 0.5, 0.375, 0.3125},
  21. {-0.5, 0.375, 0.5, 0.5, 0.5, 0.3125},
  22. {-0.5, -0.5, 0.5, 0.5, -0.375, 0.3125},
  23. {0.25, -0.5, 0.3125, 0.5, 0.5, 0.125},
  24. {-0.5, -0.5, 0.3125, -0.25, 0.5, 0.125},
  25. },
  26. },
  27. })
  28. minetest.register_node(mod_name..":arrowslit_"..material.name.."_cross", {
  29. drawtype = "nodebox",
  30. description = S("@1 Arrowslit with Cross", desc),
  31. tiles = tile,
  32. groups = composition_def.groups,
  33. sounds = composition_def.sounds,
  34. paramtype = "light",
  35. paramtype2 = "facedir",
  36. node_box = {
  37. type = "fixed",
  38. fixed = {
  39. {-0.5, -0.125, 0.5, -0.0625, 0.375, 0.3125},
  40. {0.0625, -0.125, 0.5, 0.5, 0.375, 0.3125},
  41. {-0.5, 0.375, 0.5, 0.5, 0.5, 0.3125},
  42. {-0.5, -0.5, 0.5, 0.5, -0.375, 0.3125},
  43. {0.0625, -0.375, 0.5, 0.5, -0.25, 0.3125},
  44. {-0.5, -0.375, 0.5, -0.0625, -0.25, 0.3125},
  45. {-0.5, -0.25, 0.5, -0.1875, -0.125, 0.3125},
  46. {0.1875, -0.25, 0.5, 0.5, -0.125, 0.3125},
  47. {0.25, -0.5, 0.3125, 0.5, 0.5, 0.125},
  48. {-0.5, -0.5, 0.3125, -0.25, 0.5, 0.125},
  49. },
  50. },
  51. })
  52. minetest.register_node(mod_name..":arrowslit_"..material.name.."_hole", {
  53. drawtype = "nodebox",
  54. description = S("@1 Arrowslit with Hole", desc),
  55. tiles = tile,
  56. groups = composition_def.groups,
  57. sounds = composition_def.sounds,
  58. paramtype = "light",
  59. paramtype2 = "facedir",
  60. node_box = {
  61. type = "fixed",
  62. fixed = {
  63. {-0.5, -0.375, 0.5, -0.125, 0.375, 0.3125},
  64. {0.125, -0.375, 0.5, 0.5, 0.375, 0.3125},
  65. {-0.5, -0.5, 0.5, 0.5, -0.375, 0.3125},
  66. {0.0625, -0.125, 0.5, 0.125, 0.375, 0.3125},
  67. {-0.125, -0.125, 0.5, -0.0625, 0.375, 0.3125},
  68. {-0.5, 0.375, 0.5, 0.5, 0.5, 0.3125},
  69. {0.25, -0.5, 0.3125, 0.5, 0.5, 0.125},
  70. {-0.5, -0.5, 0.3125, -0.25, 0.5, 0.125},
  71. },
  72. },
  73. })
  74. minetest.register_node(mod_name..":arrowslit_"..material.name.."_embrasure", {
  75. drawtype = "nodebox",
  76. description = S("@1 Embrasure", desc),
  77. tiles = tile,
  78. groups = composition_def.groups,
  79. sounds = composition_def.sounds,
  80. paramtype = "light",
  81. paramtype2 = "facedir",
  82. node_box = {
  83. type = "fixed",
  84. fixed = {
  85. {-0.25, -0.5, 0.375, -0.125, 0.5, 0.5},
  86. {0.125, -0.5, 0.375, 0.25, 0.5, 0.5},
  87. {0.25, -0.5, 0.25, 0.5, 0.5, 0.5},
  88. {0.375, -0.5, 0.125, 0.5, 0.5, 0.25},
  89. {-0.5, -0.5, 0.25, -0.25, 0.5, 0.5},
  90. {-0.5, -0.5, 0.125, -0.375, 0.5, 0.25},
  91. },
  92. },
  93. })
  94. minetest.register_craft({
  95. output = mod_name..":arrowslit_"..material.name.." 6",
  96. recipe = {
  97. {material.craft_material,"", material.craft_material},
  98. {material.craft_material,"", material.craft_material},
  99. {material.craft_material,"", material.craft_material} },
  100. })
  101. minetest.register_craft({
  102. output = mod_name..":arrowslit_"..material.name.."_cross",
  103. recipe = {
  104. {mod_name..":arrowslit_"..material.name} },
  105. })
  106. minetest.register_craft({
  107. output = mod_name..":arrowslit_"..material.name.."_hole",
  108. recipe = {
  109. {mod_name..":arrowslit_"..material.name.."_cross"} },
  110. })
  111. minetest.register_craft({
  112. output = mod_name..":arrowslit_"..material.name.."_embrasure",
  113. recipe = {
  114. {mod_name..":arrowslit_"..material.name.."_hole"} },
  115. })
  116. minetest.register_craft({
  117. output = mod_name..":arrowslit_"..material.name,
  118. recipe = {
  119. {mod_name..":arrowslit_"..material.name.."_embrasure"} },
  120. })
  121. if burn_time > 0 then
  122. minetest.register_craft({
  123. type = "fuel",
  124. recipe = mod_name..":arrowslit_"..material.name,
  125. burntime = burn_time,
  126. })
  127. minetest.register_craft({
  128. type = "fuel",
  129. recipe = mod_name..":arrowslit_"..material.name.."_cross",
  130. burntime = burn_time,
  131. })
  132. minetest.register_craft({
  133. type = "fuel",
  134. recipe = mod_name..":arrowslit_"..material.name.."_hole",
  135. burntime = burn_time,
  136. })
  137. minetest.register_craft({
  138. type = "fuel",
  139. recipe = mod_name..":arrowslit_"..material.name.."_embrasure",
  140. burntime = burn_time,
  141. })
  142. end
  143. end
  144. castle_masonry.register_arrowslit_alias = function(old_mod_name, old_material_name, new_mod_name, new_material_name)
  145. minetest.register_alias(old_mod_name..":arrowslit_"..old_material_name, new_mod_name..":arrowslit_"..new_material_name)
  146. minetest.register_alias(old_mod_name..":arrowslit_"..old_material_name.."_cross", new_mod_name..":arrowslit_"..new_material_name.."_cross")
  147. minetest.register_alias(old_mod_name..":arrowslit_"..old_material_name.."_hole", new_mod_name..":arrowslit_"..new_material_name.."_hole")
  148. minetest.register_alias(old_mod_name..":arrowslit_"..old_material_name.."_embrasure", new_mod_name..":arrowslit_"..new_material_name.."_embrasure")
  149. end
  150. castle_masonry.register_arrowslit_alias_force = function(old_mod_name, old_material_name, new_mod_name, new_material_name)
  151. minetest.register_alias_force(old_mod_name..":arrowslit_"..old_material_name, new_mod_name..":arrowslit_"..new_material_name)
  152. minetest.register_alias_force(old_mod_name..":arrowslit_"..old_material_name.."_cross", new_mod_name..":arrowslit_"..new_material_name.."_cross")
  153. minetest.register_alias_force(old_mod_name..":arrowslit_"..old_material_name.."_hole", new_mod_name..":arrowslit_"..new_material_name.."_hole")
  154. minetest.register_alias_force(old_mod_name..":arrowslit_"..old_material_name.."_embrasure", new_mod_name..":arrowslit_"..new_material_name.."_embrasure")
  155. end