pillars.lua 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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_pillar = function(material)
  5. local composition_def, burn_time, tile, desc = castle_masonry.get_material_properties(material)
  6. local crossbrace_connectable_groups = {}
  7. for group, val in pairs(composition_def.groups) do
  8. crossbrace_connectable_groups[group] = val
  9. end
  10. crossbrace_connectable_groups.crossbrace_connectable = 1
  11. local mod_name = minetest.get_current_modname()
  12. -- Node Definition
  13. minetest.register_node(mod_name..":pillar_"..material.name.."_bottom", {
  14. drawtype = "nodebox",
  15. description = S("@1 Pillar Base", desc),
  16. tiles = tile,
  17. groups = crossbrace_connectable_groups,
  18. sounds = composition_def.sounds,
  19. paramtype = "light",
  20. paramtype2 = "facedir",
  21. node_box = {
  22. type = "fixed",
  23. fixed = {
  24. {-0.5,-0.5,-0.5,0.5,-0.375,0.5},
  25. {-0.375,-0.375,-0.375,0.375,-0.125,0.375},
  26. {-0.25,-0.125,-0.25,0.25,0.5,0.25},
  27. },
  28. },
  29. })
  30. minetest.register_node(mod_name..":pillar_"..material.name.."_bottom_half", {
  31. drawtype = "nodebox",
  32. description = S("@1 Half Pillar Base", desc),
  33. tiles = tile,
  34. groups = composition_def.groups,
  35. sounds = composition_def.sounds,
  36. paramtype = "light",
  37. paramtype2 = "facedir",
  38. node_box = {
  39. type = "fixed",
  40. fixed = {
  41. {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
  42. {-0.375, -0.375, 0.125, 0.375, -0.125, 0.5},
  43. {-0.25, -0.125, 0.25, 0.25, 0.5, 0.5},
  44. },
  45. },
  46. })
  47. minetest.register_node(mod_name..":pillar_"..material.name.."_top", {
  48. drawtype = "nodebox",
  49. description = S("@1 Pillar Top", desc),
  50. tiles = tile,
  51. groups = crossbrace_connectable_groups,
  52. sounds = composition_def.sounds,
  53. paramtype = "light",
  54. paramtype2 = "facedir",
  55. node_box = {
  56. type = "fixed",
  57. fixed = {
  58. {-0.5,0.3125,-0.5,0.5,0.5,0.5},
  59. {-0.375,0.0625,-0.375,0.375,0.3125,0.375},
  60. {-0.25,-0.5,-0.25,0.25,0.0625,0.25},
  61. },
  62. },
  63. })
  64. minetest.register_node(mod_name..":pillar_"..material.name.."_top_half", {
  65. drawtype = "nodebox",
  66. description = S("@1 Half Pillar Top", desc),
  67. tiles = tile,
  68. groups = composition_def.groups,
  69. sounds = composition_def.sounds,
  70. paramtype = "light",
  71. paramtype2 = "facedir",
  72. node_box = {
  73. type = "fixed",
  74. fixed = {
  75. {-0.5, 0.3125, 0, 0.5, 0.5, 0.5},
  76. {-0.375, 0.0625, 0.125, 0.375, 0.3125, 0.5},
  77. {-0.25, -0.5, 0.25, 0.25, 0.0625, 0.5},
  78. },
  79. },
  80. })
  81. minetest.register_node(mod_name..":pillar_"..material.name.."_middle", {
  82. drawtype = "nodebox",
  83. description = S("@1 Pillar Middle", desc),
  84. tiles = tile,
  85. groups = crossbrace_connectable_groups,
  86. sounds = composition_def.sounds,
  87. paramtype = "light",
  88. paramtype2 = "facedir",
  89. node_box = {
  90. type = "fixed",
  91. fixed = {
  92. {-0.25,-0.5,-0.25,0.25,0.5,0.25},
  93. },
  94. },
  95. })
  96. minetest.register_node(mod_name..":pillar_"..material.name.."_middle_half", {
  97. drawtype = "nodebox",
  98. description = S("@1 Half Pillar Middle", desc),
  99. tiles = tile,
  100. groups = composition_def.groups,
  101. sounds = composition_def.sounds,
  102. paramtype = "light",
  103. paramtype2 = "facedir",
  104. node_box = {
  105. type = "fixed",
  106. fixed = {
  107. {-0.25, -0.5, 0.25, 0.25, 0.5, 0.5},
  108. },
  109. },
  110. })
  111. minetest.register_node(mod_name..":pillar_"..material.name.."_crossbrace",
  112. {
  113. drawtype = "nodebox",
  114. description = S("@1 Crossbrace", desc),
  115. tiles = tile,
  116. groups = composition_def.groups,
  117. sounds = composition_def.sounds,
  118. paramtype = "light",
  119. paramtype2 = "facedir",
  120. node_box = {
  121. type = "connected",
  122. fixed = {-0.25,0.25,-0.25,0.25,0.5,0.25},
  123. connect_front = {-0.25,0.25,-0.75,0.25,0.5,-0.25}, -- -Z
  124. connect_left = {-0.25,0.25,-0.25,-0.75,0.5,0.25}, -- -X
  125. connect_back = {-0.25,0.25,0.25,0.25,0.5,0.75}, -- +Z
  126. connect_right = {0.25,0.25,-0.25,0.75,0.5,0.25}, -- +X
  127. },
  128. connects_to = {
  129. mod_name..":pillar_"..material.name.."_crossbrace",
  130. mod_name..":pillar_"..material.name.."_extended_crossbrace",
  131. "group:crossbrace_connectable"},
  132. connect_sides = { "front", "left", "back", "right" },
  133. })
  134. minetest.register_node(mod_name..":pillar_"..material.name.."_extended_crossbrace",
  135. {
  136. drawtype = "nodebox",
  137. description = S("@1 Extended Crossbrace", desc),
  138. tiles = tile,
  139. groups = composition_def.groups,
  140. sounds = composition_def.sounds,
  141. paramtype = "light",
  142. paramtype2 = "facedir",
  143. node_box = {
  144. type = "fixed",
  145. fixed = {-1.25,0.25,-0.25,1.25,0.5,0.25},
  146. },
  147. })
  148. minetest.register_craft({
  149. output = mod_name..":pillar_"..material.name.."_bottom 4",
  150. recipe = {
  151. {"",material.craft_material,""},
  152. {"",material.craft_material,""},
  153. {material.craft_material,material.craft_material,material.craft_material} },
  154. })
  155. minetest.register_craft({
  156. output = mod_name..":pillar_"..material.name.."_top 4",
  157. recipe = {
  158. {material.craft_material,material.craft_material,material.craft_material},
  159. {"",material.craft_material,""},
  160. {"",material.craft_material,""} },
  161. })
  162. minetest.register_craft({
  163. output = mod_name..":pillar_"..material.name.."_middle 2",
  164. recipe = {
  165. {material.craft_material},
  166. {material.craft_material},
  167. {material.craft_material} },
  168. })
  169. minetest.register_craft({
  170. output = mod_name..":pillar_"..material.name.."_crossbrace 10",
  171. recipe = {
  172. {material.craft_material,"",material.craft_material},
  173. {"",material.craft_material,""},
  174. {material.craft_material,"",material.craft_material} },
  175. })
  176. minetest.register_craft({
  177. output = mod_name..":pillar_"..material.name.."_middle_half 2",
  178. type="shapeless",
  179. recipe = {mod_name..":pillar_"..material.name.."_middle"},
  180. })
  181. minetest.register_craft({
  182. output = mod_name..":pillar_"..material.name.."_middle",
  183. type="shapeless",
  184. recipe = {mod_name..":pillar_"..material.name.."_middle_half", mod_name..":pillar_"..material.name.."_middle_half"},
  185. })
  186. minetest.register_craft({
  187. output = mod_name..":pillar_"..material.name.."_top_half 2",
  188. type="shapeless",
  189. recipe = {mod_name..":pillar_"..material.name.."_top"},
  190. })
  191. minetest.register_craft({
  192. output = mod_name..":pillar_"..material.name.."_top",
  193. type="shapeless",
  194. recipe = {mod_name..":pillar_"..material.name.."_top_half", mod_name..":pillar_"..material.name.."_top_half"},
  195. })
  196. minetest.register_craft({
  197. output = mod_name..":pillar_"..material.name.."_bottom_half 2",
  198. type="shapeless",
  199. recipe = {mod_name..":pillar_"..material.name.."_bottom"},
  200. })
  201. minetest.register_craft({
  202. output = mod_name..":pillar_"..material.name.."_bottom",
  203. type="shapeless",
  204. recipe = {mod_name..":pillar_"..material.name.."_bottom_half", mod_name..":pillar_"..material.name.."_bottom_half"},
  205. })
  206. minetest.register_craft({
  207. output = mod_name..":pillar_"..material.name.."_extended_crossbrace",
  208. type="shapeless",
  209. recipe = {mod_name..":pillar_"..material.name.."_crossbrace"},
  210. })
  211. minetest.register_craft({
  212. output = mod_name..":pillar_"..material.name.."_crossbrace",
  213. type="shapeless",
  214. recipe = {mod_name..":pillar_"..material.name.."_extended_crossbrace"},
  215. })
  216. if burn_time > 0 then
  217. minetest.register_craft({
  218. type = "fuel",
  219. recipe = mod_name..":pillar_"..material.name.."_top",
  220. burntime = burn_time*5/4,
  221. })
  222. minetest.register_craft({
  223. type = "fuel",
  224. recipe = mod_name..":pillar_"..material.name.."_top_half",
  225. burntime = burn_time*5/8,
  226. })
  227. minetest.register_craft({
  228. type = "fuel",
  229. recipe = mod_name..":pillar_"..material.name.."_bottom",
  230. burntime = burn_time*5/4,
  231. })
  232. minetest.register_craft({
  233. type = "fuel",
  234. recipe = mod_name..":pillar_"..material.name.."_bottom_half",
  235. burntime = burn_time*5/8,
  236. })
  237. minetest.register_craft({
  238. type = "fuel",
  239. recipe = mod_name..":pillar_"..material.name.."_middle",
  240. burntime = burn_time*6/4,
  241. })
  242. minetest.register_craft({
  243. type = "fuel",
  244. recipe = mod_name..":pillar_"..material.name.."_middle_half",
  245. burntime = burn_time*6/8,
  246. })
  247. minetest.register_craft({
  248. type = "fuel",
  249. recipe = mod_name..":pillar_"..material.name.."_crossbrace",
  250. burntime = burn_time*5/10,
  251. })
  252. minetest.register_craft({
  253. type = "fuel",
  254. recipe = mod_name..":pillar_"..material.name.."_extended_crossbrace",
  255. burntime = burn_time*5/10,
  256. })
  257. end
  258. end
  259. -- The original castle mod had "pillars_", plural, which didn't match the arrowslit and murderhole standard.
  260. castle_masonry.register_pillar_alias = function(old_mod_name, old_material_name, new_mod_name, new_material_name)
  261. minetest.register_alias(old_mod_name..":pillars_"..old_material_name.."_bottom", new_mod_name..":pillar_"..new_material_name.."_bottom")
  262. minetest.register_alias(old_mod_name..":pillars_"..old_material_name.."_bottom_half", new_mod_name..":pillar_"..new_material_name.."_bottom_half")
  263. minetest.register_alias(old_mod_name..":pillars_"..old_material_name.."_crossbrace", new_mod_name..":pillar_"..new_material_name.."_crossbrace")
  264. minetest.register_alias(old_mod_name..":pillars_"..old_material_name.."_middle", new_mod_name..":pillar_"..new_material_name.."_middle")
  265. minetest.register_alias(old_mod_name..":pillars_"..old_material_name.."_middle_half", new_mod_name..":pillar_"..new_material_name.."_middle_half")
  266. minetest.register_alias(old_mod_name..":pillars_"..old_material_name.."_top", new_mod_name..":pillar_"..new_material_name.."_top")
  267. minetest.register_alias(old_mod_name..":pillars_"..old_material_name.."_top_half", new_mod_name..":pillar_"..new_material_name.."_top_half")
  268. minetest.register_alias(old_mod_name..":pillar_"..old_material_name.."_bottom", new_mod_name..":pillar_"..new_material_name.."_bottom")
  269. minetest.register_alias(old_mod_name..":pillar_"..old_material_name.."_bottom_half", new_mod_name..":pillar_"..new_material_name.."_bottom_half")
  270. minetest.register_alias(old_mod_name..":pillar_"..old_material_name.."_crossbrace", new_mod_name..":pillar_"..new_material_name.."_crossbrace")
  271. minetest.register_alias(old_mod_name..":pillar_"..old_material_name.."_middle", new_mod_name..":pillar_"..new_material_name.."_middle")
  272. minetest.register_alias(old_mod_name..":pillar_"..old_material_name.."_middle_half", new_mod_name..":pillar_"..new_material_name.."_middle_half")
  273. minetest.register_alias(old_mod_name..":pillar_"..old_material_name.."_top", new_mod_name..":pillar_"..new_material_name.."_top")
  274. minetest.register_alias(old_mod_name..":pillar_"..old_material_name.."_top_half", new_mod_name..":pillar_"..new_material_name.."_top_half")
  275. end
  276. castle_masonry.register_arrowslit_alias_force = function(old_mod_name, old_material_name, new_mod_name, new_material_name)
  277. minetest.register_alias_force(old_mod_name..":pillars_"..old_material_name.."_bottom", new_mod_name..":pillar_"..new_material_name.."_bottom")
  278. minetest.register_alias_force(old_mod_name..":pillars_"..old_material_name.."_bottom_half", new_mod_name..":pillar_"..new_material_name.."_bottom_half")
  279. minetest.register_alias_force(old_mod_name..":pillars_"..old_material_name.."_crossbrace", new_mod_name..":pillar_"..new_material_name.."_crossbrace")
  280. minetest.register_alias_force(old_mod_name..":pillars_"..old_material_name.."_middle", new_mod_name..":pillar_"..new_material_name.."_middle")
  281. minetest.register_alias_force(old_mod_name..":pillars_"..old_material_name.."_middle_half", new_mod_name..":pillar_"..new_material_name.."_middle_half")
  282. minetest.register_alias_force(old_mod_name..":pillars_"..old_material_name.."_top", new_mod_name..":pillar_"..new_material_name.."_top")
  283. minetest.register_alias_force(old_mod_name..":pillars_"..old_material_name.."_top_half", new_mod_name..":pillar_"..new_material_name.."_top_half")
  284. minetest.register_alias_force(old_mod_name..":pillar_"..old_material_name.."_bottom", new_mod_name..":pillar_"..new_material_name.."_bottom")
  285. minetest.register_alias_force(old_mod_name..":pillar_"..old_material_name.."_bottom_half", new_mod_name..":pillar_"..new_material_name.."_bottom_half")
  286. minetest.register_alias_force(old_mod_name..":pillar_"..old_material_name.."_crossbrace", new_mod_name..":pillar_"..new_material_name.."_crossbrace")
  287. minetest.register_alias_force(old_mod_name..":pillar_"..old_material_name.."_middle", new_mod_name..":pillar_"..new_material_name.."_middle")
  288. minetest.register_alias_force(old_mod_name..":pillar_"..old_material_name.."_middle_half", new_mod_name..":pillar_"..new_material_name.."_middle_half")
  289. minetest.register_alias_force(old_mod_name..":pillar_"..old_material_name.."_top", new_mod_name..":pillar_"..new_material_name.."_top")
  290. minetest.register_alias_force(old_mod_name..":pillar_"..old_material_name.."_top_half", new_mod_name..":pillar_"..new_material_name.."_top_half")
  291. end