init.lua 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. -- walls/init.lua
  2. walls = {}
  3. local fence_collision_extra = minetest.settings:get_bool("enable_fence_tall") and 3/8 or 0
  4. -- Load support for MT game translation.
  5. local S = minetest.get_translator("walls")
  6. walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wall_sounds)
  7. --make wall_texture_table paramenter backwards compatible for mods passing single texture
  8. if type(wall_texture_table) ~= "table" then
  9. wall_texture_table = { wall_texture_table }
  10. end
  11. -- inventory node, and pole-type wall start item
  12. minetest.register_node(wall_name, {
  13. description = wall_desc,
  14. drawtype = "nodebox",
  15. node_box = {
  16. type = "connected",
  17. fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
  18. -- connect_bottom =
  19. connect_front = {-3/16, -1/2, -1/2, 3/16, 3/8, -1/4},
  20. connect_left = {-1/2, -1/2, -3/16, -1/4, 3/8, 3/16},
  21. connect_back = {-3/16, -1/2, 1/4, 3/16, 3/8, 1/2},
  22. connect_right = { 1/4, -1/2, -3/16, 1/2, 3/8, 3/16},
  23. },
  24. collision_box = {
  25. type = "connected",
  26. fixed = {-1/4, -1/2, -1/4, 1/4, 1/2 + fence_collision_extra, 1/4},
  27. -- connect_top =
  28. -- connect_bottom =
  29. connect_front = {-1/4,-1/2,-1/2,1/4,1/2 + fence_collision_extra,-1/4},
  30. connect_left = {-1/2,-1/2,-1/4,-1/4,1/2 + fence_collision_extra,1/4},
  31. connect_back = {-1/4,-1/2,1/4,1/4,1/2 + fence_collision_extra,1/2},
  32. connect_right = {1/4,-1/2,-1/4,1/2,1/2 + fence_collision_extra,1/4},
  33. },
  34. connects_to = { "group:wall", "group:stone", "group:fence" },
  35. paramtype = "light",
  36. is_ground_content = false,
  37. tiles = wall_texture_table,
  38. walkable = true,
  39. groups = { cracky = 3, wall = 1, stone = 2 },
  40. sounds = wall_sounds,
  41. })
  42. -- crafting recipe
  43. minetest.register_craft({
  44. output = wall_name .. " 6",
  45. recipe = {
  46. { "", "", "" },
  47. { wall_mat, wall_mat, wall_mat},
  48. { wall_mat, wall_mat, wall_mat},
  49. }
  50. })
  51. end
  52. walls.register("walls:cobble", S("Cobblestone Wall"), {"default_cobble.png"},
  53. "default:cobble", default.node_sound_stone_defaults())
  54. walls.register("walls:mossycobble", S("Mossy Cobblestone Wall"), {"default_mossycobble.png"},
  55. "default:mossycobble", default.node_sound_stone_defaults())
  56. walls.register("walls:desertcobble", S("Desert Cobblestone Wall"), {"default_desert_cobble.png"},
  57. "default:desert_cobble", default.node_sound_stone_defaults())