init.lua 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. local S = minetest.get_translator("homedecor_clocks")
  2. local clock_sbox = {
  3. type = "fixed",
  4. fixed = { -8/32, -8/32, 14/32, 8/32, 8/32, 16/32 }
  5. }
  6. local clock_materials = {
  7. { "plastic", S("Plastic analog clock"), "homedecor_generic_plastic.png" },
  8. { "wood", S("Wooden analog clock"), "default_wood.png" }
  9. }
  10. for _, mat in ipairs(clock_materials) do
  11. local name, desc, tex = unpack(mat)
  12. homedecor.register("analog_clock_"..name, {
  13. description = desc,
  14. mesh = "homedecor_analog_clock.obj",
  15. tiles = {
  16. "homedecor_analog_clock_face.png",
  17. tex,
  18. "homedecor_analog_clock_back.png"
  19. },
  20. inventory_image = "homedecor_analog_clock_"..name.."_inv.png",
  21. walkable = false,
  22. selection_box = clock_sbox,
  23. groups = {snappy=3},
  24. sounds = default.node_sound_wood_defaults(),
  25. })
  26. end
  27. homedecor.register("digital_clock", {
  28. description = S("Digital clock"),
  29. tiles = {
  30. "homedecor_digital_clock_edges.png",
  31. "homedecor_digital_clock_edges.png",
  32. "homedecor_digital_clock_edges.png",
  33. "homedecor_digital_clock_edges.png",
  34. "homedecor_digital_clock_back.png",
  35. "homedecor_digital_clock_front.png"
  36. },
  37. inventory_image = "homedecor_digital_clock_inv.png",
  38. node_box = {
  39. type = "fixed",
  40. fixed = {
  41. {-0.28125, -0.25, 0.4375, 0.3125, 0.25, 0.5},
  42. }
  43. },
  44. walkable = false,
  45. sounds = default.node_sound_wood_defaults(),
  46. groups = {snappy=3},
  47. })
  48. homedecor.register("alarm_clock", {
  49. description = S("Alarm clock"),
  50. tiles = {
  51. "homedecor_alarm_clock_top.png",
  52. "homedecor_alarm_clock_bottom.png",
  53. "homedecor_alarm_clock_sides.png",
  54. "homedecor_alarm_clock_sides.png^[transformFX",
  55. "homedecor_alarm_clock_back.png",
  56. "homedecor_alarm_clock_front.png"
  57. },
  58. inventory_image = "homedecor_alarm_clock_inv.png",
  59. node_box = {
  60. type = "fixed",
  61. fixed = {
  62. { -9/32, -16/32, 7/32, 10/32, -5/32, 16/32 },
  63. }
  64. },
  65. walkable = false,
  66. sounds = default.node_sound_wood_defaults(),
  67. groups = {snappy=3},
  68. })
  69. local gf_cbox = {
  70. type = "fixed",
  71. fixed = { -7/16, -8/16, -7/16, 7/16, 24/16, 7/16 }
  72. }
  73. homedecor.register("grandfather_clock", {
  74. description = S("Grandfather Clock"),
  75. mesh = "homedecor_grandfather_clock.obj",
  76. tiles = {
  77. "default_glass.png",
  78. "homedecor_grandfather_clock_face.png",
  79. homedecor.lux_wood,
  80. "homedecor_grandfather_clock_face_edge.png",
  81. "homedecor_generic_metal_brass.png"
  82. },
  83. inventory_image = "homedecor_grandfather_clock_inv.png",
  84. groups = { snappy = 3 },
  85. selection_box = gf_cbox,
  86. collision_box = gf_cbox,
  87. sounds = default.node_sound_wood_defaults(),
  88. expand = { top="placeholder" },
  89. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil,
  90. })
  91. -- crafting
  92. minetest.register_craft({
  93. output = "homedecor:analog_clock_plastic 2",
  94. recipe = {
  95. { "basic_materials:plastic_sheet", "dye:black", "basic_materials:plastic_sheet" },
  96. { "basic_materials:plastic_sheet", "basic_materials:ic", "basic_materials:plastic_sheet" },
  97. { "basic_materials:plastic_sheet", "dye:black", "basic_materials:plastic_sheet" },
  98. },
  99. })
  100. minetest.register_craft({
  101. output = "homedecor:analog_clock_wood 2",
  102. recipe = {
  103. { "group:stick", "dye:black", "group:stick" },
  104. { "group:stick", "basic_materials:ic", "group:stick" },
  105. { "group:stick", "dye:black", "group:stick" },
  106. },
  107. })
  108. minetest.register_craft({
  109. output = "homedecor:digital_clock 2",
  110. recipe = {
  111. { "basic_materials:plastic_sheet", "default:paper", "basic_materials:plastic_sheet" },
  112. { "basic_materials:plastic_sheet", "basic_materials:ic", "basic_materials:plastic_sheet" },
  113. { "basic_materials:plastic_sheet", "basic_materials:energy_crystal_simple", "basic_materials:plastic_sheet" },
  114. },
  115. })
  116. minetest.register_craft({
  117. output = "homedecor:alarm_clock",
  118. recipe = {
  119. { "basic_materials:plastic_sheet", "homedecor:speaker_driver", "basic_materials:plastic_sheet" },
  120. { "basic_materials:plastic_sheet", "homedecor:digital_clock", "basic_materials:plastic_sheet" },
  121. { "basic_materials:plastic_sheet", "basic_materials:energy_crystal_simple", "basic_materials:plastic_sheet" },
  122. },
  123. })
  124. minetest.register_craft({
  125. output = "homedecor:grandfather_clock",
  126. recipe = {
  127. { "building_blocks:slab_hardwood","homedecor:analog_clock_wood","building_blocks:slab_hardwood" },
  128. { "building_blocks:slab_hardwood","basic_materials:brass_ingot","building_blocks:slab_hardwood" },
  129. { "building_blocks:slab_hardwood","basic_materials:brass_ingot","building_blocks:slab_hardwood" }
  130. },
  131. })
  132. -- aliases
  133. minetest.register_alias("homedecor:grandfather_clock_bottom", "homedecor:grandfather_clock")
  134. minetest.register_alias("homedecor:grandfather_clock_top", "air")