init.lua 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. walls = {}
  2. walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds)
  3. local register_node = function(name, def)
  4. local ndef = table.copy(def)
  5. stairs.setup_nodedef_callbacks(name, ndef)
  6. minetest.register_node(name, ndef)
  7. end
  8. -- inventory node, and pole-type wall start item
  9. register_node(":walls:" .. wall_name, {
  10. description = wall_desc .. " Wall",
  11. drawtype = "nodebox",
  12. node_box = {
  13. type = "connected",
  14. fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}},
  15. -- connect_bottom =
  16. connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}},
  17. connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}},
  18. connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}},
  19. connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}},
  20. },
  21. -- Connect to pillars too -- lets players screwdriver a pillar sideways and use it as a wall post, or something.
  22. connects_to = { "group:wall", "group:stone", "group:brick", "group:rackstone", "group:pillar" },
  23. paramtype = "light",
  24. is_ground_content = false,
  25. tiles = { wall_texture },
  26. walkable = true,
  27. -- Must be in group:wall otherwise walls will not connect.
  28. groups = utility.dig_groups("wall", {wall = 1}),
  29. sounds = wall_sounds,
  30. })
  31. register_node(":walls:" .. wall_name .. "_noconnect", {
  32. description = wall_desc .. " Pillar",
  33. drawtype = "nodebox",
  34. node_box = {
  35. type = "fixed",
  36. fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}},
  37. },
  38. paramtype = "light",
  39. is_ground_content = false,
  40. tiles = { wall_texture },
  41. walkable = true,
  42. groups = utility.dig_groups("wall"),
  43. sounds = wall_sounds,
  44. })
  45. minetest.register_craft({
  46. output = "walls:" .. wall_name .. "_noconnect",
  47. recipe = {
  48. {'walls:' .. wall_name},
  49. {'walls:' .. wall_name},
  50. },
  51. })
  52. register_node(":walls:" .. wall_name .. "_half", {
  53. drawtype = "nodebox",
  54. description = wall_desc .. " Half Wall",
  55. tiles = { wall_texture },
  56. groups = utility.dig_groups("wall"),
  57. sounds = wall_sounds,
  58. paramtype = "light",
  59. paramtype2 = "facedir",
  60. node_box = {
  61. type = "fixed",
  62. fixed = {
  63. {-0.25, -0.5, 0.25, 0.25, 0.5, 0.5},
  64. },
  65. },
  66. })
  67. -- crafting recipe
  68. minetest.register_craft({
  69. output = "walls:" .. wall_name .. " 6",
  70. recipe = {
  71. { '', '', '' },
  72. { wall_mat, wall_mat, wall_mat},
  73. { wall_mat, wall_mat, wall_mat},
  74. }
  75. })
  76. minetest.register_craft({
  77. output = "walls:"..wall_name.."_half 2",
  78. type="shapeless",
  79. recipe = {"walls:"..wall_name},
  80. })
  81. minetest.register_craft({
  82. output = "walls:"..wall_name,
  83. type="shapeless",
  84. recipe = {"walls:"..wall_name.."_half", "walls:"..wall_name.."_half"},
  85. })
  86. -- pillars
  87. register_node(":pillars:" .. wall_name .. "_bottom", {
  88. drawtype = "nodebox",
  89. description = wall_desc .. " Pillar Base",
  90. tiles = { wall_texture },
  91. groups = utility.dig_groups("wall", {pillar = 1}),
  92. sounds = wall_sounds,
  93. paramtype = "light",
  94. paramtype2 = "facedir",
  95. node_box = {
  96. type = "fixed",
  97. fixed = {
  98. {-0.5,-0.5,-0.5,0.5,-0.375,0.5},
  99. {-0.375,-0.375,-0.375,0.375,-0.125,0.375},
  100. {-0.25,-0.125,-0.25,0.25,0.5,0.25},
  101. },
  102. },
  103. })
  104. register_node(":pillars:" .. wall_name .. "_bottom_half", {
  105. drawtype = "nodebox",
  106. description = wall_desc .. " Half Pillar Base",
  107. tiles = { wall_texture },
  108. groups = utility.dig_groups("wall"),
  109. sounds = wall_sounds,
  110. paramtype = "light",
  111. paramtype2 = "facedir",
  112. node_box = {
  113. type = "fixed",
  114. fixed = {
  115. {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
  116. {-0.375, -0.375, 0.125, 0.375, -0.125, 0.5},
  117. {-0.25, -0.125, 0.25, 0.25, 0.5, 0.5},
  118. },
  119. },
  120. })
  121. register_node(":pillars:" .. wall_name .. "_top", {
  122. drawtype = "nodebox",
  123. description = wall_desc .. " Pillar Top",
  124. tiles = { wall_texture },
  125. groups = utility.dig_groups("wall", {pillar = 1}),
  126. sounds = wall_sounds,
  127. paramtype = "light",
  128. paramtype2 = "facedir",
  129. node_box = {
  130. type = "fixed",
  131. fixed = {
  132. {-0.5,0.3125,-0.5,0.5,0.5,0.5},
  133. {-0.375,0.0625,-0.375,0.375,0.3125,0.375},
  134. {-0.25,-0.5,-0.25,0.25,0.0625,0.25},
  135. },
  136. },
  137. })
  138. register_node(":pillars:" .. wall_name .. "_top_half", {
  139. drawtype = "nodebox",
  140. description = wall_desc .. " Half Pillar Top",
  141. tiles = { wall_texture },
  142. groups = utility.dig_groups("wall"),
  143. sounds = wall_sounds,
  144. paramtype = "light",
  145. paramtype2 = "facedir",
  146. node_box = {
  147. type = "fixed",
  148. fixed = {
  149. {-0.5, 0.3125, 0, 0.5, 0.5, 0.5},
  150. {-0.375, 0.0625, 0.125, 0.375, 0.3125, 0.5},
  151. {-0.25, -0.5, 0.25, 0.25, 0.0625, 0.5},
  152. },
  153. },
  154. })
  155. minetest.register_craft({
  156. output = "pillars:"..wall_name.."_bottom 4",
  157. recipe = {
  158. {"",wall_mat,""},
  159. {"",wall_mat,""},
  160. {wall_mat,wall_mat,wall_mat},
  161. },
  162. })
  163. minetest.register_craft({
  164. output = "pillars:"..wall_name.."_top 4",
  165. recipe = {
  166. {wall_mat,wall_mat,wall_mat},
  167. {"",wall_mat,""},
  168. {"",wall_mat,""},
  169. },
  170. })
  171. minetest.register_craft({
  172. output = "pillars:"..wall_name.."_top_half 2",
  173. type="shapeless",
  174. recipe = {"pillars:"..wall_name.."_top"},
  175. })
  176. minetest.register_craft({
  177. output = "pillars:"..wall_name.."_top",
  178. type="shapeless",
  179. recipe = {"pillars:"..wall_name.."_top_half", "pillars:"..wall_name.."_top_half"},
  180. })
  181. minetest.register_craft({
  182. output = "pillars:"..wall_name.."_bottom_half 2",
  183. type="shapeless",
  184. recipe = {"pillars:"..wall_name.."_bottom"},
  185. })
  186. minetest.register_craft({
  187. output = "pillars:"..wall_name.."_bottom",
  188. type="shapeless",
  189. recipe = {"pillars:"..wall_name.."_bottom_half", "pillars:"..wall_name.."_bottom_half"},
  190. })
  191. register_node(":murderhole:"..wall_name, {
  192. drawtype = "nodebox",
  193. description = wall_desc .. " Murder Hole",
  194. tiles = { wall_texture },
  195. groups = utility.dig_groups("wall"),
  196. sounds = wall_sounds,
  197. paramtype = "light",
  198. paramtype2 = "facedir",
  199. node_box = {
  200. type = "fixed",
  201. fixed = {
  202. {-8/16,-8/16,-8/16,-4/16,8/16,8/16},
  203. {4/16,-8/16,-8/16,8/16,8/16,8/16},
  204. {-4/16,-8/16,-8/16,4/16,8/16,-4/16},
  205. {-4/16,-8/16,8/16,4/16,8/16,4/16},
  206. },
  207. },
  208. })
  209. register_node(":machicolation:"..wall_name, {
  210. drawtype = "nodebox",
  211. description = wall_desc .. " Machicolation",
  212. tiles = { wall_texture },
  213. groups = utility.dig_groups("wall"),
  214. sounds = wall_sounds,
  215. paramtype = "light",
  216. paramtype2 = "facedir",
  217. node_box = {
  218. type = "fixed",
  219. fixed = {
  220. {-0.5, 0, -0.5, 0.5, 0.5, 0},
  221. {-0.5, -0.5, 0, -0.25, 0.5, 0.5},
  222. {0.25, -0.5, 0, 0.5, 0.5, 0.5},
  223. },
  224. },
  225. })
  226. minetest.register_craft({
  227. output = "murderhole:"..wall_name.." 4",
  228. recipe = {
  229. {"",wall_mat, "" },
  230. {wall_mat,"", wall_mat},
  231. {"",wall_mat, ""}
  232. },
  233. })
  234. minetest.register_craft({
  235. output = "machicolation:"..wall_name,
  236. type="shapeless",
  237. recipe = {"murderhole:"..wall_name},
  238. })
  239. minetest.register_craft({
  240. output = "murderhole:"..wall_name,
  241. type="shapeless",
  242. recipe = {"machicolation:"..wall_name},
  243. })
  244. -- arrow slits
  245. register_node(":arrowslit:"..wall_name, {
  246. drawtype = "nodebox",
  247. description = wall_desc .. " Arrowslit",
  248. tiles = { wall_texture },
  249. groups = utility.dig_groups("wall"),
  250. sounds = wall_sounds,
  251. paramtype = "light",
  252. paramtype2 = "facedir",
  253. node_box = {
  254. type = "fixed",
  255. fixed = {
  256. {-0.5, -0.375, 0.5, -0.0625, 0.375, 0.3125},
  257. {0.0625, -0.375, 0.5, 0.5, 0.375, 0.3125},
  258. {-0.5, 0.375, 0.5, 0.5, 0.5, 0.3125},
  259. {-0.5, -0.5, 0.5, 0.5, -0.375, 0.3125},
  260. {0.25, -0.5, 0.3125, 0.5, 0.5, 0.125},
  261. {-0.5, -0.5, 0.3125, -0.25, 0.5, 0.125},
  262. },
  263. },
  264. })
  265. register_node(":arrowslit:"..wall_name.."_cross", {
  266. drawtype = "nodebox",
  267. description = wall_desc .. " Arrowslit With Cross",
  268. tiles = { wall_texture },
  269. groups = utility.dig_groups("wall"),
  270. sounds = wall_sounds,
  271. paramtype = "light",
  272. paramtype2 = "facedir",
  273. node_box = {
  274. type = "fixed",
  275. fixed = {
  276. {-0.5, -0.125, 0.5, -0.0625, 0.375, 0.3125},
  277. {0.0625, -0.125, 0.5, 0.5, 0.375, 0.3125},
  278. {-0.5, 0.375, 0.5, 0.5, 0.5, 0.3125},
  279. {-0.5, -0.5, 0.5, 0.5, -0.375, 0.3125},
  280. {0.0625, -0.375, 0.5, 0.5, -0.25, 0.3125},
  281. {-0.5, -0.375, 0.5, -0.0625, -0.25, 0.3125},
  282. {-0.5, -0.25, 0.5, -0.1875, -0.125, 0.3125},
  283. {0.1875, -0.25, 0.5, 0.5, -0.125, 0.3125},
  284. {0.25, -0.5, 0.3125, 0.5, 0.5, 0.125},
  285. {-0.5, -0.5, 0.3125, -0.25, 0.5, 0.125},
  286. },
  287. },
  288. })
  289. register_node(":arrowslit:"..wall_name.."_hole", {
  290. drawtype = "nodebox",
  291. description = wall_desc .. " Arrowslit With Hole",
  292. tiles = { wall_texture },
  293. groups = utility.dig_groups("wall"),
  294. sounds = wall_sounds,
  295. paramtype = "light",
  296. paramtype2 = "facedir",
  297. node_box = {
  298. type = "fixed",
  299. fixed = {
  300. {-0.5, -0.375, 0.5, -0.125, 0.375, 0.3125},
  301. {0.125, -0.375, 0.5, 0.5, 0.375, 0.3125},
  302. {-0.5, -0.5, 0.5, 0.5, -0.375, 0.3125},
  303. {0.0625, -0.125, 0.5, 0.125, 0.375, 0.3125},
  304. {-0.125, -0.125, 0.5, -0.0625, 0.375, 0.3125},
  305. {-0.5, 0.375, 0.5, 0.5, 0.5, 0.3125},
  306. {0.25, -0.5, 0.3125, 0.5, 0.5, 0.125},
  307. {-0.5, -0.5, 0.3125, -0.25, 0.5, 0.125},
  308. },
  309. },
  310. })
  311. register_node(":arrowslit:"..wall_name.."_embrasure", {
  312. drawtype = "nodebox",
  313. description = wall_desc .. " Embrasure",
  314. tiles = { wall_texture },
  315. groups = utility.dig_groups("wall"),
  316. sounds = wall_sounds,
  317. paramtype = "light",
  318. paramtype2 = "facedir",
  319. node_box = {
  320. type = "fixed",
  321. fixed = {
  322. {-0.25, -0.5, 0.375, -0.125, 0.5, 0.5},
  323. {0.125, -0.5, 0.375, 0.25, 0.5, 0.5},
  324. {0.25, -0.5, 0.25, 0.5, 0.5, 0.5},
  325. {0.375, -0.5, 0.125, 0.5, 0.5, 0.25},
  326. {-0.5, -0.5, 0.25, -0.25, 0.5, 0.5},
  327. {-0.5, -0.5, 0.125, -0.375, 0.5, 0.25},
  328. },
  329. },
  330. })
  331. minetest.register_craft({
  332. output = "arrowslit:"..wall_name.." 6",
  333. recipe = {
  334. {wall_mat,"",wall_mat},
  335. {wall_mat,"",wall_mat},
  336. {wall_mat,"",wall_mat},
  337. },
  338. })
  339. minetest.register_craft({
  340. output = "arrowslit:"..wall_name.."_cross",
  341. recipe = {
  342. {"arrowslit:"..wall_name} },
  343. })
  344. minetest.register_craft({
  345. output = "arrowslit:"..wall_name.."_hole",
  346. recipe = {
  347. {"arrowslit:"..wall_name.."_cross"} },
  348. })
  349. minetest.register_craft({
  350. output = "arrowslit:"..wall_name.."_embrasure",
  351. recipe = {
  352. {"arrowslit:"..wall_name.."_hole"} },
  353. })
  354. minetest.register_craft({
  355. output = "arrowslit:"..wall_name,
  356. recipe = {
  357. {"arrowslit:"..wall_name.."_embrasure"} },
  358. })
  359. end
  360. walls.register("cobble", "Cobblestone", "default_cobble.png",
  361. "default:cobble", default.node_sound_stone_defaults())
  362. walls.register("copper", "Copper Block", "default_copper_block.png",
  363. "default:copperblock", default.node_sound_metal_defaults())
  364. walls.register("steel", "Steel Block", "default_steel_block.png",
  365. "default:steelblock", default.node_sound_metal_defaults())
  366. walls.register("gold", "Gold Block", "default_gold_block.png",
  367. "default:goldblock", default.node_sound_metal_defaults())
  368. walls.register("bronze", "Bronze Block", "default_bronze_block.png",
  369. "default:bronzeblock", default.node_sound_metal_defaults())
  370. walls.register("tin", "Tin Block", "moreores_tin_block.png",
  371. "moreores:tin_block", default.node_sound_metal_defaults())
  372. walls.register("stone", "Stone", "default_stone.png",
  373. "default:stone", default.node_sound_stone_defaults())
  374. walls.register("stonebrick", "Stone Brick", "default_stone_brick.png",
  375. "default:stonebrick", default.node_sound_stone_defaults())
  376. walls.register("desert_stone", "Redstone", "default_desert_stone.png",
  377. "default:desert_stone", default.node_sound_stone_defaults())
  378. walls.register("sandstonebrick", "Sandstone Brick", "default_sandstone_brick.png",
  379. "default:sandstonebrick", default.node_sound_stone_defaults())
  380. walls.register("desert_stonebrick", "Redstone Brick", "default_desert_stone_brick.png",
  381. "default:desert_stonebrick", default.node_sound_stone_defaults())
  382. walls.register("sandstone", "Sandstone", "default_sandstone.png",
  383. "default:sandstone", default.node_sound_stone_defaults())
  384. walls.register("desert_sandstone", "Desert Sandstone", "default_desert_sandstone.png",
  385. "default:desert_sandstone", default.node_sound_stone_defaults())
  386. walls.register("silver_sandstone", "Silver Sandstone", "default_silver_sandstone.png",
  387. "default:silver_sandstone", default.node_sound_stone_defaults())
  388. walls.register("mossycobble", "Mossy Cobblestone", "default_mossycobble.png",
  389. "default:mossycobble", default.node_sound_stone_defaults())
  390. walls.register("desertcobble", "Chalked Cobble Redstone", "default_desert_cobble.png",
  391. "default:desert_cobble", default.node_sound_stone_defaults())
  392. walls.register("desertcobble2", "Cobble Redstone", "default_desert_cobble2.png",
  393. "default:desert_cobble2", default.node_sound_stone_defaults())
  394. walls.register("redrack", "Netherack", "rackstone_redrack.png",
  395. "rackstone:redrack", default.node_sound_stone_defaults())
  396. walls.register("redrack_cobble", "Cobbled Netherack", "rackstone_redrack_cobble.png",
  397. "rackstone:redrack_cobble", default.node_sound_stone_defaults())
  398. walls.register("redrack_brick", "Netherack Brick", "rackstone_brick.png",
  399. "rackstone:brick", default.node_sound_stone_defaults())
  400. walls.register("blackrack", "Blackrack", "rackstone_blackrack.png",
  401. "rackstone:blackrack", default.node_sound_stone_defaults())
  402. walls.register("bluerack", "Bluerack", "rackstone_bluerack.png",
  403. "rackstone:bluerack", default.node_sound_stone_defaults())
  404. walls.register("bluerack_brick", "Blue Rackstone Brick", "rackstone_bluerack_brick.png",
  405. "rackstone:bluerack_brick", default.node_sound_stone_defaults())
  406. walls.register("blackrack_brick", "Black Rackstone Brick", "rackstone_brick_black.png",
  407. "rackstone:brick_black", default.node_sound_stone_defaults())
  408. walls.register("rackstone_brick", "Rackstone Brick", "rackstone_rackstone_brick.png",
  409. "rackstone:rackstone_brick2", default.node_sound_stone_defaults())
  410. walls.register("rackstone", "Rackstone", "rackstone_rackstone.png",
  411. "rackstone:rackstone", default.node_sound_stone_defaults())
  412. walls.register("whitestone_brick", "Bleached Brick", "whitestone_brick.png",
  413. "whitestone:brick", default.node_sound_stone_defaults())
  414. walls.register("ice", "Ice", "default_ice.png",
  415. "default:ice", default.node_sound_glass_defaults())
  416. walls.register("snow_brick", "Snow Brick", "snow_bricks_snow_brick.png",
  417. "snow_bricks:snow_brick", default.node_sound_glass_defaults())
  418. walls.register("ice_brick", "Ice Brick", "snow_bricks_ice_brick.png",
  419. "snow_bricks:ice_brick", default.node_sound_glass_defaults())
  420. walls.register("lapis_cobble", "Cobbled Lapis", "lapis_cobble.png",
  421. "lapis:lapis_cobble", default.node_sound_stone_defaults())
  422. walls.register("obsidian", "Obsidian", "default_obsidian.png",
  423. "default:obsidian", default.node_sound_stone_defaults())
  424. walls.register("obsidian_brick", "Obsidian Brick", "default_obsidian_brick.png",
  425. "default:obsidianbrick", default.node_sound_stone_defaults())
  426. walls.register("rackstone_cobble", "Rackstone Cobble", "rackstone_rackstone_cobble.png",
  427. "rackstone:cobble", default.node_sound_stone_defaults())