init.lua 4.5 KB

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