From 826252225c710ec4c1c21efe2aca5171740f087c Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Fri, 7 Apr 2017 12:07:48 -0600 Subject: [PATCH] remove a deprecated API --- init.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index c576d1f..d494fdf 100644 --- a/init.lua +++ b/init.lua @@ -77,17 +77,18 @@ minetest.register_ore({ random_factor = 0, }) +------------------------------------------------------------------------------------------------- +-- Ameliorate lava floods on the surface world by removing lava that's poised to spill local c_air = minetest.get_content_id("air") local c_snowblock = minetest.get_content_id("default:snowblock") local c_obsidian = minetest.get_content_id("default:obsidian") local c_lava = minetest.get_content_id("default:lava_source") -local water_level = minetest.get_mapgen_params().water_level +local water_level = tonumber(minetest.get_mapgen_setting("water_level")) local is_adjacent_to_air = function(area, data, pos) - return pos.y > water_level and - (data[area:index(pos.x+1, pos.y, pos.z)] == c_air + return (data[area:index(pos.x+1, pos.y, pos.z)] == c_air or data[area:index(pos.x-1, pos.y, pos.z)] == c_air or data[area:index(pos.x, pos.y, pos.z+1)] == c_air or data[area:index(pos.x, pos.y, pos.z-1)] == c_air @@ -132,10 +133,12 @@ minetest.register_on_generated(function(minp, maxp, seed) for z = z_min, z_max do -- for each xy plane progressing northwards --structure loop, hollows out the cavern for y = y_min, y_max do -- for each x row progressing upwards - local vi = area:index(x_min, y, z) --current node index - for x = x_min, x_max do -- for each node do - dfcaverns.remove_unsupported_lava(area, data, vi) - vi = vi + 1 + if y > water_level then + local vi = area:index(x_min, y, z) --current node index + for x = x_min, x_max do -- for each node do + dfcaverns.remove_unsupported_lava(area, data, vi) + vi = vi + 1 + end end end end @@ -148,4 +151,4 @@ minetest.register_on_generated(function(minp, maxp, seed) vm:update_liquids() --write it to world vm:write_to_map(data) -end) +end) \ No newline at end of file