init.lua 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. if not minetest.global_exists("lava") then lava = {} end
  2. lava.modpath = minetest.get_modpath("lava")
  3. if not lava.run_once then
  4. dofile(lava.modpath .. "/basalt_and_pumice.lua")
  5. minetest.register_node(":default:lava_source", {
  6. description = "Lava Source",
  7. drawtype = "liquid",
  8. tiles = {
  9. {
  10. name = "default_lava_source_animated.png",
  11. animation = {
  12. type = "vertical_frames",
  13. aspect_w = 16,
  14. aspect_h = 16,
  15. length = 3.0,
  16. },
  17. },
  18. },
  19. special_tiles = {
  20. -- New-style lava source material (mostly unused)
  21. {
  22. name = "default_lava_source_animated.png",
  23. animation = {
  24. type = "vertical_frames",
  25. aspect_w = 16,
  26. aspect_h = 16,
  27. length = 3.0,
  28. },
  29. backface_culling = false,
  30. },
  31. },
  32. paramtype = "light",
  33. light_source = default.LIGHT_MAX - 2,
  34. -- Players can't destroy lava by drowning in it or dropping gravel into it. By MustTest
  35. walkable = true,
  36. pointable = false,
  37. diggable = false,
  38. -- Liquids cannot be floodable.
  39. --floodable = true,
  40. -- Players can't destroy lava by building to it. By MustTest
  41. buildable_to = false,
  42. is_ground_content = false,
  43. drop = "",
  44. drowning = 1,
  45. liquidtype = "source",
  46. liquid_alternative_flowing = "default:lava_flowing",
  47. liquid_alternative_source = "default:lava_source",
  48. liquid_viscosity = 7,
  49. liquid_renewable = false,
  50. damage_per_second = 4 * 2 * 500,
  51. _damage_per_second_type = "lava",
  52. _death_message = default.lava_death_messages(),
  53. post_effect_color = {a = 191, r = 255, g = 64, b = 0},
  54. groups = -- comment
  55. {
  56. lava = 3,
  57. liquid = 2,
  58. igniter = 1,
  59. disable_jump = 1,
  60. melt_around = 3,
  61. },
  62. -- Not called by engine or voxelmanips.
  63. on_construct = function(pos)
  64. if rc.liquid_forbidden_at(pos) then
  65. ambiance.sound_play("default_cool_lava", pos, 2.0, 16)
  66. minetest.add_node(pos, {name="fire:basic_flame"})
  67. end
  68. end,
  69. on_player_walk_over = function(pos, player)
  70. if not gdac.player_is_admin(player) then
  71. local pname = player:get_player_name()
  72. if player:get_hp() > 0 and not heatdamage.is_immune(pname) then
  73. local pa = vector.add(pos, {x=0, y=1, z=0})
  74. if minetest.get_node(pa).name == "air" then
  75. minetest.add_node(pa, {name="fire:basic_flame"})
  76. end
  77. local node = minetest.get_node(pos)
  78. utility.damage_player(player, "lava", 20*500, {
  79. reason = "node_damage",
  80. damage_group = "lava",
  81. source_node = node.name,
  82. node_pos = pos,
  83. })
  84. end
  85. end
  86. end,
  87. on_collapse_to_entity = function(pos, node)
  88. -- Do not allow player to obtain the node itself.
  89. end,
  90. })
  91. minetest.register_node(":default:lava_flowing", {
  92. description = "Flowing Lava",
  93. drawtype = "flowingliquid",
  94. tiles = {"default_lava.png"},
  95. special_tiles = {
  96. {
  97. name = "default_lava_flowing_animated.png",
  98. backface_culling = false,
  99. animation = {
  100. type = "vertical_frames",
  101. aspect_w = 16,
  102. aspect_h = 16,
  103. length = 3.3,
  104. },
  105. },
  106. {
  107. name = "default_lava_flowing_animated.png",
  108. backface_culling = true,
  109. animation = {
  110. type = "vertical_frames",
  111. aspect_w = 16,
  112. aspect_h = 16,
  113. length = 3.3,
  114. },
  115. },
  116. },
  117. paramtype = "light",
  118. paramtype2 = "flowingliquid",
  119. light_source = default.LIGHT_MAX - 2,
  120. -- It is possible to destroy flowing nodes with gravel or by drowning in it. By MustTest
  121. walkable = false,
  122. pointable = false,
  123. diggable = false,
  124. -- Players can't destroy lava by building to it. By MustTest
  125. buildable_to = false,
  126. -- Liquids cannot be floodable.
  127. --floodable = true,
  128. is_ground_content = false,
  129. drop = "",
  130. drowning = 1,
  131. liquidtype = "flowing",
  132. liquid_alternative_flowing = "default:lava_flowing",
  133. liquid_alternative_source = "default:lava_source",
  134. liquid_viscosity = 7,
  135. liquid_renewable = false,
  136. damage_per_second = 4 * 2 * 500,
  137. _damage_per_second_type = "lava",
  138. _death_message = default.lava_death_messages(),
  139. post_effect_color = {a = 191, r = 255, g = 64, b = 0},
  140. groups = -- comment
  141. {
  142. lava = 3,
  143. liquid = 2,
  144. igniter = 1,
  145. not_in_creative_inventory = 1,
  146. disable_jump = 1,
  147. melt_around = 3,
  148. },
  149. on_player_walk_over = function(pos, player)
  150. if not gdac.player_is_admin(player) then
  151. local pname = player:get_player_name()
  152. if player:get_hp() > 0 and not heatdamage.is_immune(pname) then
  153. local pa = vector.add(pos, {x=0, y=1, z=0})
  154. if minetest.get_node(pa).name == "air" then
  155. minetest.add_node(pa, {name="fire:basic_flame"})
  156. end
  157. local node = minetest.get_node(pos)
  158. utility.damage_player(player, "lava", 20*500, {
  159. reason = "node_damage",
  160. damage_group = "lava",
  161. source_node = node.name,
  162. node_pos = pos,
  163. })
  164. end
  165. end
  166. end,
  167. on_collapse_to_entity = function(pos, node)
  168. -- Do not allow player to obtain the node itself.
  169. end,
  170. })
  171. local c = "lava:core"
  172. local f = lava.modpath .. "/init.lua"
  173. reload.register_file(c, f, false)
  174. lava.run_once = true
  175. end