init.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. walls = {}
  2. walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wall_sounds)
  3. --make wall_texture_table paramenter backwards compatible for mods passing single texture
  4. if type(wall_texture_table) ~= "table" then
  5. wall_texture_table = { wall_texture_table }
  6. end
  7. -- inventory node, and pole-type wall start item
  8. minetest.register_node(wall_name, {
  9. description = wall_desc,
  10. drawtype = "nodebox",
  11. node_box = {
  12. type = "connected",
  13. fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}},
  14. -- connect_bottom =
  15. connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}},
  16. connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}},
  17. connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}},
  18. connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}},
  19. },
  20. connects_to = { "group:wall", "group:stone", "group:fence" },
  21. paramtype = "light",
  22. is_ground_content = false,
  23. tiles = wall_texture_table,
  24. walkable = true,
  25. groups = { cracky = 3, wall = 1, stone = 2 },
  26. sounds = wall_sounds,
  27. })
  28. -- crafting recipe
  29. minetest.register_craft({
  30. output = wall_name .. " 6",
  31. recipe = {
  32. { '', '', '' },
  33. { wall_mat, wall_mat, wall_mat},
  34. { wall_mat, wall_mat, wall_mat},
  35. }
  36. })
  37. end
  38. walls.register("walls:cobble", "Cobblestone Wall", {"default_cobble.png"},
  39. "default:cobble", default.node_sound_stone_defaults())
  40. walls.register("walls:mossycobble", "Mossy Cobblestone Wall", {"default_mossycobble.png"},
  41. "default:mossycobble", default.node_sound_stone_defaults())
  42. walls.register("walls:desertcobble", "Desert Cobblestone Wall", {"default_desert_cobble.png"},
  43. "default:desert_cobble", default.node_sound_stone_defaults())