2
0

liquids.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. -- Add liquids for ranges and viscosity levels 0-8
  2. for d=0, 8 do
  3. local tt_normal
  4. if d == 0 then
  5. tt_normal = "\n".."Swimmable, renewable liquid"
  6. else
  7. tt_normal = "\n".."Swimmable, spreading, renewable liquid"
  8. end
  9. core.register_node("testnodes:rliquid_"..d, {
  10. description = "Test Liquid Source, Range "..d..
  11. tt_normal .. "\n" .. "(falling & floating node)",
  12. drawtype = "liquid",
  13. tiles = {"testnodes_liquidsource_r"..d..".png"},
  14. special_tiles = {
  15. {name = "testnodes_liquidsource_r"..d..".png", backface_culling = false},
  16. {name = "testnodes_liquidsource_r"..d..".png", backface_culling = true},
  17. },
  18. use_texture_alpha = "blend",
  19. paramtype = "light",
  20. walkable = false,
  21. buildable_to = true,
  22. is_ground_content = false,
  23. liquidtype = "source",
  24. liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d,
  25. liquid_alternative_source = "testnodes:rliquid_"..d,
  26. liquid_range = d,
  27. -- Also use these nodes to test falling, floating liquid source nodes
  28. groups = {float = 1, falling_node = 1},
  29. })
  30. core.register_node("testnodes:rliquid_flowing_"..d, {
  31. description = "Flowing Test Liquid, Range "..d..
  32. tt_normal,
  33. drawtype = "flowingliquid",
  34. tiles = {"testnodes_liquidflowing_r"..d..".png"},
  35. special_tiles = {
  36. {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false},
  37. {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false},
  38. },
  39. use_texture_alpha = "blend",
  40. paramtype = "light",
  41. paramtype2 = "flowingliquid",
  42. walkable = false,
  43. buildable_to = true,
  44. is_ground_content = false,
  45. liquidtype = "flowing",
  46. liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d,
  47. liquid_alternative_source = "testnodes:rliquid_"..d,
  48. liquid_range = d,
  49. })
  50. if d <= 7 then
  51. local tt_reduced = ""
  52. if d > 0 then
  53. tt_reduced = "\n".."Reduced swimming/spreading speed"
  54. end
  55. local mod = "^[colorize:#000000:127"
  56. core.register_node("testnodes:vliquid_"..d, {
  57. description = "Test Liquid Source, Viscosity/Resistance "..d.."\n"..
  58. "Swimmable, spreading, renewable liquid"..
  59. tt_reduced,
  60. drawtype = "liquid",
  61. tiles = {"testnodes_liquidsource_r"..d..".png"..mod},
  62. special_tiles = {
  63. {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = false},
  64. {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = true},
  65. },
  66. use_texture_alpha = "blend",
  67. paramtype = "light",
  68. walkable = false,
  69. buildable_to = true,
  70. is_ground_content = false,
  71. liquidtype = "source",
  72. liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d,
  73. liquid_alternative_source = "testnodes:vliquid_"..d,
  74. liquid_viscosity = d,
  75. })
  76. core.register_node("testnodes:vliquid_flowing_"..d, {
  77. description = "Flowing Test Liquid, Viscosity/Resistance "..d.."\n"..
  78. "Swimmable, spreading, renewable liquid"..
  79. tt_reduced,
  80. drawtype = "flowingliquid",
  81. tiles = {"testnodes_liquidflowing_r"..d..".png"..mod},
  82. special_tiles = {
  83. {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false},
  84. {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false},
  85. },
  86. use_texture_alpha = "blend",
  87. paramtype = "light",
  88. paramtype2 = "flowingliquid",
  89. walkable = false,
  90. buildable_to = true,
  91. is_ground_content = false,
  92. liquidtype = "flowing",
  93. liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d,
  94. liquid_alternative_source = "testnodes:vliquid_"..d,
  95. liquid_viscosity = d,
  96. })
  97. mod = "^[colorize:#000000:192"
  98. local v = 4
  99. core.register_node("testnodes:vrliquid_"..d, {
  100. description = "Test Liquid Source, Viscosity "..v..", Resistance "..d.."\n"..
  101. "Swimmable, spreading, renewable liquid"..
  102. tt_reduced,
  103. drawtype = "liquid",
  104. tiles = {"testnodes_liquidsource_r"..d..".png"..mod},
  105. special_tiles = {
  106. {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = false},
  107. {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = true},
  108. },
  109. use_texture_alpha = "blend",
  110. paramtype = "light",
  111. walkable = false,
  112. pointable = false,
  113. diggable = false,
  114. buildable_to = true,
  115. is_ground_content = false,
  116. liquidtype = "source",
  117. liquid_alternative_flowing = "testnodes:vrliquid_flowing_"..d,
  118. liquid_alternative_source = "testnodes:vrliquid_"..d,
  119. liquid_viscosity = v,
  120. move_resistance = d,
  121. })
  122. core.register_node("testnodes:vrliquid_flowing_"..d, {
  123. description = "Flowing Test Liquid, Viscosity "..v..", Resistance "..d.."\n"..
  124. "Swimmable, spreading, renewable liquid"..
  125. tt_reduced,
  126. drawtype = "flowingliquid",
  127. tiles = {"testnodes_liquidflowing_r"..d..".png"..mod},
  128. special_tiles = {
  129. {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false},
  130. {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false},
  131. },
  132. use_texture_alpha = "blend",
  133. paramtype = "light",
  134. paramtype2 = "flowingliquid",
  135. walkable = false,
  136. pointable = false,
  137. diggable = false,
  138. buildable_to = true,
  139. is_ground_content = false,
  140. liquidtype = "flowing",
  141. liquid_alternative_flowing = "testnodes:vrliquid_flowing_"..d,
  142. liquid_alternative_source = "testnodes:vrliquid_"..d,
  143. liquid_viscosity = v,
  144. move_resistance = d,
  145. })
  146. end
  147. end