3dk.lua 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. -- unlit floor torch
  2. minetest.register_node("real_torch:kalite_torch", {
  3. description = "Kalite Torch (Unlit)",
  4. drawtype = "mesh",
  5. mesh = "torch_floor.obj",
  6. inventory_image = "real_torch_on_floor.png",
  7. wield_image = "real_torch_on_floor.png",
  8. tiles = {{
  9. name = "real_torch_on_floor.png",
  10. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  11. }},
  12. paramtype = "light",
  13. paramtype2 = "wallmounted",
  14. light_source = 3,
  15. sunlight_propagates = true,
  16. walkable = false,
  17. liquids_pointable = false,
  18. groups = utility.dig_groups("item", {flammable=1, attached_node=1}),
  19. drop = "real_torch:kalite_torch",
  20. selection_box = {
  21. type = "wallmounted",
  22. wall_bottom = {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8},
  23. },
  24. floodable = true,
  25. on_rotate = false,
  26. sounds = default.node_sound_wood_defaults(),
  27. _torches_node_floor = "real_torch:kalite_torch",
  28. _torches_node_wall = "real_torch:kalite_torch_wall",
  29. _torches_node_ceiling = "real_torch:kalite_torch_ceiling",
  30. on_flood = function(pos, oldnode, newnode)
  31. minetest.add_node(pos, {name="air"})
  32. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1})
  33. return true
  34. end,
  35. on_place = function(...)
  36. return torches.put_torch(...)
  37. end,
  38. on_ignite = function(pos, igniter)
  39. local nod = minetest.get_node(pos)
  40. minetest.add_node(pos, {name = "torches:kalite_torch_floor", param2 = nod.param2})
  41. end,
  42. })
  43. -- unlit wall torch
  44. minetest.register_node("real_torch:kalite_torch_wall", {
  45. drawtype = "mesh",
  46. mesh = "torch_wall.obj",
  47. tiles = {{
  48. name = "real_torch_on_floor.png",
  49. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  50. }},
  51. paramtype = "light",
  52. paramtype2 = "wallmounted",
  53. light_source = 3,
  54. sunlight_propagates = true,
  55. walkable = false,
  56. groups = utility.dig_groups("item", {flammable=1, not_in_creative_inventory=1, attached_node=1}),
  57. drop = "real_torch:kalite_torch",
  58. floodable = true,
  59. on_rotate = false,
  60. selection_box = {
  61. type = "wallmounted",
  62. wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
  63. },
  64. sounds = default.node_sound_wood_defaults(),
  65. on_ignite = function(pos, igniter)
  66. local nod = minetest.get_node(pos)
  67. minetest.add_node(pos, {name = "torches:kalite_torch_wall", param2 = nod.param2})
  68. end,
  69. on_flood = function(pos, oldnode, newnode)
  70. minetest.add_node(pos, {name="air"})
  71. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1})
  72. return true
  73. end,
  74. })
  75. -- unlit ceiling torch
  76. minetest.register_node("real_torch:kalite_torch_ceiling", {
  77. drawtype = "mesh",
  78. mesh = "torch_ceiling.obj",
  79. tiles = {{
  80. name = "real_torch_on_floor.png",
  81. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  82. }},
  83. paramtype = "light",
  84. paramtype2 = "wallmounted",
  85. light_source = 3,
  86. sunlight_propagates = true,
  87. walkable = false,
  88. groups = utility.dig_groups("item", {flammable=1, not_in_creative_inventory=1, attached_node=1}),
  89. drop = "real_torch:kalite_torch",
  90. selection_box = {
  91. type = "wallmounted",
  92. wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
  93. },
  94. floodable = true,
  95. on_rotate = false,
  96. sounds = default.node_sound_wood_defaults(),
  97. on_ignite = function(pos, igniter)
  98. local nod = minetest.get_node(pos)
  99. minetest.add_node(pos, {name = "torches:kalite_torch_ceiling", param2 = nod.param2})
  100. end,
  101. on_flood = function(pos, oldnode, newnode)
  102. minetest.add_node(pos, {name="air"})
  103. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1})
  104. return true
  105. end,
  106. })
  107. -- override default torches to burn out after 8-10 minutes
  108. minetest.override_item("torches:kalite_torch_floor", {
  109. on_timer = function(pos, elapsed)
  110. local p2 = minetest.get_node(pos).param2
  111. minetest.add_node(pos, {name = "real_torch:kalite_torch", param2 = p2})
  112. minetest.sound_play({name="real_torch_burnout", gain = 0.1},
  113. {pos = pos, max_hear_distance = 10})
  114. end,
  115. })
  116. minetest.override_item("torches:kalite_torch_wall", {
  117. on_timer = function(pos, elapsed)
  118. local p2 = minetest.get_node(pos).param2
  119. minetest.add_node(pos, {name = "real_torch:kalite_torch_wall", param2 = p2})
  120. minetest.sound_play({name="real_torch_burnout", gain = 0.1},
  121. {pos = pos, max_hear_distance = 10})
  122. end,
  123. })
  124. minetest.override_item("torches:kalite_torch_ceiling", {
  125. on_timer = function(pos, elapsed)
  126. local p2 = minetest.get_node(pos).param2
  127. minetest.add_node(pos, {name = "real_torch:kalite_torch_ceiling", param2 = p2})
  128. minetest.sound_play({name="real_torch_burnout", gain = 0.1},
  129. {pos = pos, max_hear_distance = 10})
  130. end,
  131. })