doors.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. -- Used for localization, choose either built-in or intllib.
  2. local MP, S, NS = nil
  3. if (minetest.get_modpath("intllib") == nil) then
  4. S = minetest.get_translator("castle_gates")
  5. else
  6. -- internationalization boilerplate
  7. MP = minetest.get_modpath(minetest.get_current_modname())
  8. S, NS = dofile(MP.."/intllib.lua")
  9. end
  10. if minetest.get_modpath("doors") then
  11. doors.register("castle_gates:oak_door", {
  12. tiles = {{ name = "castle_door_oak.png", backface_culling = true }},
  13. use_texture_alpha = "clip",
  14. description = S("Oak Door"),
  15. inventory_image = "castle_oak_door_inv.png",
  16. protected = true,
  17. groups = { choppy = 2, door = 1 },
  18. sounds = default.node_sound_wood_defaults(),
  19. recipe = {
  20. {"default:tree", "default:tree"},
  21. {"default:tree", "default:tree"},
  22. {"default:tree", "default:tree"},
  23. }
  24. })
  25. local door_recipe
  26. if minetest.get_modpath("xpanes") then
  27. door_recipe = {
  28. {"xpanes:jailbars_flat", "xpanes:jailbars_flat"},
  29. {"xpanes:jailbars_flat", "xpanes:jailbars_flat"},
  30. {"xpanes:jailbars_flat", "xpanes:jailbars_flat"},
  31. }
  32. else
  33. door_recipe = {
  34. {"default:steel_ingot", ""},
  35. {"", "default:steel_ingot"},
  36. {"default:steel_ingot", ""},
  37. }
  38. end
  39. doors.register("castle_gates:jail_door", {
  40. tiles = {{ name = "castle_door_jail.png", backface_culling = true }},
  41. use_texture_alpha = "clip",
  42. description = S("Jail Door"),
  43. inventory_image = "castle_jail_door_inv.png",
  44. protected = true,
  45. groups = { cracky = 2, door = 1, flow_through = 1},
  46. sound_open = "doors_steel_door_open",
  47. sound_close = "doors_steel_door_close",
  48. recipe = door_recipe,
  49. })
  50. minetest.register_alias("castle:oak_door_a", "castle_gates:oak_door_a")
  51. minetest.register_alias("castle:oak_door_b", "castle_gates:oak_door_b")
  52. minetest.register_alias("castle:jail_door_a", "castle_gates:jail_door_a")
  53. minetest.register_alias("castle:jail_door_b", "castle_gates:jail_door_b")
  54. end
  55. if minetest.get_modpath("xpanes") then
  56. xpanes.register_pane("jailbars", {
  57. description = S("Jail Bars"),
  58. tiles = {"castle_jailbars.png"},
  59. drawtype = "airlike",
  60. paramtype = "light",
  61. textures = {"castle_jailbars.png", "castle_jailbars.png", "epic_blank.png"},
  62. inventory_image = "castle_jailbars.png",
  63. wield_image = "castle_jailbars.png",
  64. sounds = default.node_sound_metal_defaults(),
  65. groups = {cracky=1, pane=1, flow_through=1},
  66. recipe = {
  67. {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
  68. {"default:steel_ingot", "", "default:steel_ingot"},
  69. {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}},
  70. })
  71. end
  72. for i = 1, 15 do
  73. minetest.register_alias("castle:jailbars_"..i, "xpanes:jailbars_"..i)
  74. end
  75. minetest.register_alias("castle:jailbars", "xpanes:jailbars")