init.lua 4.2 KB

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