init.lua 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. on_player_walk_over = function(pos, player)
  63. if not gdac.player_is_admin(player) then
  64. local pname = player:get_player_name()
  65. if player:get_hp() > 0 and not heatdamage.is_immune(pname) then
  66. local pa = vector.add(pos, {x=0, y=1, z=0})
  67. if minetest.get_node(pa).name == "air" then
  68. minetest.add_node(pa, {name="fire:basic_flame"})
  69. end
  70. local node = minetest.get_node(pos)
  71. utility.damage_player(player, "lava", 20*500, {
  72. reason = "node_damage",
  73. damage_group = "lava",
  74. source_node = node.name,
  75. node_pos = pos,
  76. })
  77. end
  78. end
  79. end,
  80. on_collapse_to_entity = function(pos, node)
  81. -- Do not allow player to obtain the node itself.
  82. end,
  83. })
  84. minetest.register_node(":default:lava_flowing", {
  85. description = "Flowing Lava",
  86. drawtype = "flowingliquid",
  87. tiles = {"default_lava.png"},
  88. special_tiles = {
  89. {
  90. name = "default_lava_flowing_animated.png",
  91. backface_culling = false,
  92. animation = {
  93. type = "vertical_frames",
  94. aspect_w = 16,
  95. aspect_h = 16,
  96. length = 3.3,
  97. },
  98. },
  99. {
  100. name = "default_lava_flowing_animated.png",
  101. backface_culling = true,
  102. animation = {
  103. type = "vertical_frames",
  104. aspect_w = 16,
  105. aspect_h = 16,
  106. length = 3.3,
  107. },
  108. },
  109. },
  110. paramtype = "light",
  111. paramtype2 = "flowingliquid",
  112. light_source = default.LIGHT_MAX - 2,
  113. -- It is possible to destroy flowing nodes with gravel or by drowning in it. By MustTest
  114. walkable = false,
  115. pointable = false,
  116. diggable = false,
  117. -- Players can't destroy lava by building to it. By MustTest
  118. buildable_to = false,
  119. -- Liquids cannot be floodable.
  120. --floodable = true,
  121. is_ground_content = false,
  122. drop = "",
  123. drowning = 1,
  124. liquidtype = "flowing",
  125. liquid_alternative_flowing = "default:lava_flowing",
  126. liquid_alternative_source = "default:lava_source",
  127. liquid_viscosity = 7,
  128. liquid_renewable = false,
  129. damage_per_second = 4 * 2 * 500,
  130. _damage_per_second_type = "lava",
  131. _death_message = default.lava_death_messages(),
  132. post_effect_color = {a = 191, r = 255, g = 64, b = 0},
  133. groups = -- comment
  134. {
  135. lava = 3,
  136. liquid = 2,
  137. igniter = 1,
  138. not_in_creative_inventory = 1,
  139. disable_jump = 1,
  140. melt_around = 3,
  141. },
  142. on_player_walk_over = function(pos, player)
  143. if not gdac.player_is_admin(player) then
  144. local pname = player:get_player_name()
  145. if player:get_hp() > 0 and not heatdamage.is_immune(pname) then
  146. local pa = vector.add(pos, {x=0, y=1, z=0})
  147. if minetest.get_node(pa).name == "air" then
  148. minetest.add_node(pa, {name="fire:basic_flame"})
  149. end
  150. local node = minetest.get_node(pos)
  151. utility.damage_player(player, "lava", 20*500, {
  152. reason = "node_damage",
  153. damage_group = "lava",
  154. source_node = node.name,
  155. node_pos = pos,
  156. })
  157. end
  158. end
  159. end,
  160. on_collapse_to_entity = function(pos, node)
  161. -- Do not allow player to obtain the node itself.
  162. end,
  163. })
  164. local c = "lava:core"
  165. local f = lava.modpath .. "/init.lua"
  166. reload.register_file(c, f, false)
  167. lava.run_once = true
  168. end