cave_torch.lua 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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",
  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*500, -- Torches damage if you stand on top of them.
  53. _damage_per_second_type = "heat",
  54. _death_message = "<player> stepped on a torch.",
  55. selection_box = {
  56. type = "wallmounted",
  57. wall_bottom = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16},
  58. },
  59. sounds = default.node_sound_wood_defaults(),
  60. _torches_node_floor = "torches:torch_floor",
  61. _torches_node_wall = "torches:torch_wall",
  62. _torches_node_ceiling = "torches:torch_ceiling",
  63. on_place = function(...)
  64. return torches.put_torch(...)
  65. end,
  66. --[[
  67. on_use = function(...)
  68. return torches.on_use(...)
  69. end,
  70. --]]
  71. floodable = true,
  72. on_rotate = false,
  73. on_flood = function(pos, oldnode, newnode)
  74. minetest.add_node(pos, {name="air"})
  75. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1}, true)
  76. return true
  77. end,
  78. on_construct = function(pos)
  79. breath.ignite_nearby_gas(pos)
  80. flowers.create_lilyspawner_near(pos)
  81. torchmelt.start_melting(pos)
  82. real_torch.start_timer(pos)
  83. end,
  84. on_notify = function(pos, other)
  85. torchmelt.start_melting(pos)
  86. end,
  87. on_destruct = function(pos)
  88. end,
  89. })
  90. minetest.register_alias("default:torch", "torches:torch_floor")
  91. minetest.register_node("torches:torch_wall", {
  92. drawtype = "mesh",
  93. mesh = "torch_wall.obj",
  94. tiles = {{
  95. name = "default_torch_on_floor_animated.png",
  96. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  97. }},
  98. paramtype = "light",
  99. paramtype2 = "wallmounted",
  100. sunlight_propagates = true,
  101. walkable = false,
  102. light_source = 12,
  103. groups = utility.dig_groups("item", {
  104. flammable=1,
  105. not_in_creative_inventory=1,
  106. attached_node=1,
  107. torch=1,
  108. melt_around=2,
  109. notify_construct=1,
  110. want_notify=1,
  111. }),
  112. drop = "torches:torch_floor",
  113. selection_box = {
  114. type = "wallmounted",
  115. wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1},
  116. },
  117. sounds = default.node_sound_wood_defaults(),
  118. floodable = true,
  119. on_rotate = false,
  120. on_flood = function(pos, oldnode, newnode)
  121. minetest.add_node(pos, {name="air"})
  122. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1}, true)
  123. return true
  124. end,
  125. on_construct = function(pos)
  126. breath.ignite_nearby_gas(pos)
  127. flowers.create_lilyspawner_near(pos)
  128. torchmelt.start_melting(pos)
  129. real_torch.start_timer(pos)
  130. end,
  131. on_notify = function(pos, other)
  132. torchmelt.start_melting(pos)
  133. end,
  134. on_destruct = function(pos)
  135. end,
  136. })
  137. minetest.register_alias("default:torch_wall", "torches:torch_wall")
  138. minetest.register_node("torches:torch_ceiling", {
  139. drawtype = "mesh",
  140. mesh = "torch_ceiling.obj",
  141. tiles = {{
  142. name = "default_torch_on_floor_animated.png",
  143. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  144. }},
  145. paramtype = "light",
  146. paramtype2 = "wallmounted",
  147. sunlight_propagates = true,
  148. walkable = false,
  149. light_source = 12,
  150. groups = utility.dig_groups("item", {
  151. flammable=1,
  152. not_in_creative_inventory=1,
  153. attached_node=1,
  154. torch=1,
  155. melt_around=2,
  156. notify_construct=1,
  157. want_notify=1,
  158. }),
  159. drop = "torches:torch_floor",
  160. selection_box = {
  161. type = "wallmounted",
  162. wall_top = {-0.1, -0.1, -0.25, 0.1, 0.5, 0.1},
  163. },
  164. sounds = default.node_sound_wood_defaults(),
  165. floodable = true,
  166. on_rotate = false,
  167. on_flood = function(pos, oldnode, newnode)
  168. minetest.add_node(pos, {name="air"})
  169. minetest.sound_play("real_torch_extinguish", {pos=pos, max_hear_distance=16, gain=1}, true)
  170. return true
  171. end,
  172. on_construct = function(pos)
  173. breath.ignite_nearby_gas(pos)
  174. flowers.create_lilyspawner_near(pos)
  175. torchmelt.start_melting(pos)
  176. real_torch.start_timer(pos)
  177. end,
  178. on_notify = function(pos, other)
  179. torchmelt.start_melting(pos)
  180. end,
  181. on_destruct = function(pos)
  182. end,
  183. })
  184. minetest.register_alias("default:torch_ceiling", "torches:torch_ceiling")
  185. minetest.register_craft({
  186. output = 'torches:torch_floor 4',
  187. recipe = {
  188. {'default:coal_lump'},
  189. {'group:stick'},
  190. }
  191. })
  192. minetest.register_craft({
  193. type = "fuel",
  194. recipe = "torches:torch_floor",
  195. burntime = 4,
  196. })