doors.lua 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. description = S("Oak Door"),
  14. inventory_image = "castle_oak_door_inv.png",
  15. protected = true,
  16. groups = { choppy = 2, door = 1 },
  17. sounds = default.node_sound_wood_defaults(),
  18. recipe = {
  19. {"default:tree", "default:tree"},
  20. {"default:tree", "default:tree"},
  21. {"default:tree", "default:tree"},
  22. }
  23. })
  24. local door_recipe
  25. if minetest.get_modpath("xpanes") then
  26. door_recipe = {
  27. {"xpanes:jailbars_flat", "xpanes:jailbars_flat"},
  28. {"xpanes:jailbars_flat", "xpanes:jailbars_flat"},
  29. {"xpanes:jailbars_flat", "xpanes:jailbars_flat"},
  30. }
  31. else
  32. door_recipe = {
  33. {"default:steel_ingot", ""},
  34. {"", "default:steel_ingot"},
  35. {"default:steel_ingot", ""},
  36. }
  37. end
  38. doors.register("castle_gates:jail_door", {
  39. tiles = {{ name = "castle_door_jail.png", backface_culling = true }},
  40. description = S("Jail Door"),
  41. inventory_image = "castle_jail_door_inv.png",
  42. protected = true,
  43. groups = { cracky = 2, door = 1, flow_through = 1},
  44. sound_open = "doors_steel_door_open",
  45. sound_close = "doors_steel_door_close",
  46. recipe = door_recipe,
  47. })
  48. minetest.register_alias("castle:oak_door_a", "castle_gates:oak_door_a")
  49. minetest.register_alias("castle:oak_door_b", "castle_gates:oak_door_b")
  50. minetest.register_alias("castle:jail_door_a", "castle_gates:jail_door_a")
  51. minetest.register_alias("castle:jail_door_b", "castle_gates:jail_door_b")
  52. end
  53. if minetest.get_modpath("xpanes") then
  54. xpanes.register_pane("jailbars", {
  55. description = S("Jail Bars"),
  56. tiles = {"castle_jailbars.png"},
  57. drawtype = "airlike",
  58. paramtype = "light",
  59. textures = {"castle_jailbars.png", "castle_jailbars.png", "epic_blank.png"},
  60. inventory_image = "castle_jailbars.png",
  61. wield_image = "castle_jailbars.png",
  62. sounds = default.node_sound_metal_defaults(),
  63. groups = {cracky=1, pane=1, flow_through=1},
  64. recipe = {
  65. {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
  66. {"default:steel_ingot", "", "default:steel_ingot"},
  67. {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}},
  68. })
  69. end
  70. for i = 1, 15 do
  71. minetest.register_alias("castle:jailbars_"..i, "xpanes:jailbars_"..i)
  72. end
  73. minetest.register_alias("castle:jailbars", "xpanes:jailbars")