cave_torch.lua 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. --[[
  2. Torch mod - formerly mod "Torches"
  3. ======================
  4. (c) Copyright BlockMen (2013-2015)
  5. (C) Copyright sofar <sofar@foo-projects.org> (2016)
  6. This mod changes the default torch drawtype from "torchlike" to "mesh",
  7. giving the torch a three dimensional appearance. The mesh contains the
  8. proper pixel mapping to make the animation appear as a particle above
  9. the torch, while in fact the animation is just the texture of the mesh.
  10. License:
  11. ~~~~~~~~
  12. (c) Copyright BlockMen (2013-2015)
  13. Textures and Meshes/Models:
  14. CC-BY 3.0 BlockMen
  15. Note that the models were entirely done from scratch by sofar.
  16. Code:
  17. Licensed under the GNU LGPL version 2.1 or higher.
  18. You can redistribute it and/or modify it under
  19. the terms of the GNU Lesser General Public License
  20. as published by the Free Software Foundation;
  21. You should have received a copy of the GNU Lesser General Public
  22. License along with this library; if not, write to the Free Software
  23. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
  25. --]]
  26. minetest.register_node("torches:torch_floor", {
  27. description = "Torch\n\nDon't stand on this, it's hot!\nWill stay lit for several hours.\nCan be relit from various sources.",
  28. drawtype = "mesh",
  29. mesh = "torch_floor.obj",
  30. inventory_image = "default_torch_on_floor.png",
  31. wield_image = "default_torch_on_floor.png",
  32. tiles = {{
  33. name = "default_torch_on_floor_animated.png",
  34. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  35. }},
  36. paramtype = "light",
  37. paramtype2 = "wallmounted",
  38. sunlight_propagates = true,
  39. walkable = false,
  40. liquids_pointable = false,
  41. light_source = 12,
  42. groups = utility.dig_groups("item", {
  43. flammable=1,
  44. attached_node=1,
  45. torch=1,
  46. torch_craftitem=1,
  47. melt_around=2,
  48. notify_construct=1,
  49. want_notify=1,
  50. }),
  51. drop = "torches:torch_floor",
  52. damage_per_second = 1, -- Torches damage if you stand on top of them.
  53. selection_box = {
  54. type = "wallmounted",
  55. wall_bottom = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16},
  56. },
  57. sounds = default.node_sound_wood_defaults(),
  58. _torches_node_floor = "torches:torch_floor",
  59. _torches_node_wall = "torches:torch_wall",
  60. _torches_node_ceiling = "torches:torch_ceiling",
  61. on_place = function(...)
  62. return torches.put_torch(...)
  63. end,
  64. floodable = true,
  65. on_rotate = false,
  66. on_flood = function(pos, oldnode, newnode)
  67. minetest.add_node(pos, {name="air"})
  68. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1})
  69. return true
  70. end,
  71. on_construct = function(pos)
  72. breath.ignite_nearby_gas(pos)
  73. flowers.create_lilyspawner_near(pos)
  74. torchmelt.start_melting(pos)
  75. real_torch.start_timer(pos)
  76. end,
  77. on_notify = function(pos, other)
  78. torchmelt.start_melting(pos)
  79. end,
  80. on_destruct = function(pos)
  81. end,
  82. })
  83. minetest.register_alias("default:torch", "torches:torch_floor")
  84. minetest.register_node("torches:torch_wall", {
  85. drawtype = "mesh",
  86. mesh = "torch_wall.obj",
  87. tiles = {{
  88. name = "default_torch_on_floor_animated.png",
  89. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  90. }},
  91. paramtype = "light",
  92. paramtype2 = "wallmounted",
  93. sunlight_propagates = true,
  94. walkable = false,
  95. light_source = 12,
  96. groups = utility.dig_groups("item", {
  97. flammable=1,
  98. not_in_creative_inventory=1,
  99. attached_node=1,
  100. torch=1,
  101. melt_around=2,
  102. notify_construct=1,
  103. want_notify=1,
  104. }),
  105. drop = "torches:torch_floor",
  106. selection_box = {
  107. type = "wallmounted",
  108. wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1},
  109. },
  110. sounds = default.node_sound_wood_defaults(),
  111. floodable = true,
  112. on_rotate = false,
  113. on_flood = function(pos, oldnode, newnode)
  114. minetest.add_node(pos, {name="air"})
  115. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1})
  116. return true
  117. end,
  118. on_construct = function(pos)
  119. breath.ignite_nearby_gas(pos)
  120. flowers.create_lilyspawner_near(pos)
  121. torchmelt.start_melting(pos)
  122. real_torch.start_timer(pos)
  123. end,
  124. on_notify = function(pos, other)
  125. torchmelt.start_melting(pos)
  126. end,
  127. on_destruct = function(pos)
  128. end,
  129. })
  130. minetest.register_alias("default:torch_wall", "torches:torch_wall")
  131. minetest.register_node("torches:torch_ceiling", {
  132. drawtype = "mesh",
  133. mesh = "torch_ceiling.obj",
  134. tiles = {{
  135. name = "default_torch_on_floor_animated.png",
  136. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  137. }},
  138. paramtype = "light",
  139. paramtype2 = "wallmounted",
  140. sunlight_propagates = true,
  141. walkable = false,
  142. light_source = 12,
  143. groups = utility.dig_groups("item", {
  144. flammable=1,
  145. not_in_creative_inventory=1,
  146. attached_node=1,
  147. torch=1,
  148. melt_around=2,
  149. notify_construct=1,
  150. want_notify=1,
  151. }),
  152. drop = "torches:torch_floor",
  153. selection_box = {
  154. type = "wallmounted",
  155. wall_top = {-0.1, -0.1, -0.25, 0.1, 0.5, 0.1},
  156. },
  157. sounds = default.node_sound_wood_defaults(),
  158. floodable = true,
  159. on_rotate = false,
  160. on_flood = function(pos, oldnode, newnode)
  161. minetest.add_node(pos, {name="air"})
  162. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1})
  163. return true
  164. end,
  165. on_construct = function(pos)
  166. breath.ignite_nearby_gas(pos)
  167. flowers.create_lilyspawner_near(pos)
  168. torchmelt.start_melting(pos)
  169. real_torch.start_timer(pos)
  170. end,
  171. on_notify = function(pos, other)
  172. torchmelt.start_melting(pos)
  173. end,
  174. on_destruct = function(pos)
  175. end,
  176. })
  177. minetest.register_alias("default:torch_ceiling", "torches:torch_ceiling")
  178. minetest.register_craft({
  179. output = 'torches:torch_floor 4',
  180. recipe = {
  181. {'default:coal_lump'},
  182. {'group:stick'},
  183. }
  184. })
  185. minetest.register_craft({
  186. type = "fuel",
  187. recipe = "torches:torch_floor",
  188. burntime = 4,
  189. })