From 85ab92f32ddf5d9ae24375985bad2544dc3d56f4 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Mon, 11 Nov 2019 01:53:02 -0700 Subject: [PATCH] use custom is_ground_content method --- df_caverns/level1.lua | 1 + df_caverns/level2.lua | 1 + df_caverns/level3.lua | 1 + df_caverns/primordial.lua | 1 + df_caverns/shared.lua | 30 ++++++++++++++++++++++++++++++ df_caverns/sunless_sea.lua | 1 + 6 files changed, 35 insertions(+) diff --git a/df_caverns/level1.lua b/df_caverns/level1.lua index 8623b04..3c8eab6 100644 --- a/df_caverns/level1.lua +++ b/df_caverns/level1.lua @@ -300,4 +300,5 @@ subterrane.register_layer({ decorate = decorate_level_1, warren_region_variability_threshold = 0.33, double_frequency = true, + is_ground_content = df_caverns.is_ground_content, }) \ No newline at end of file diff --git a/df_caverns/level2.lua b/df_caverns/level2.lua index 6ae6497..a7673bb 100644 --- a/df_caverns/level2.lua +++ b/df_caverns/level2.lua @@ -375,5 +375,6 @@ subterrane.register_layer({ decorate = decorate_level_2, warren_region_variability_threshold = 0.33, double_frequency = true, + is_ground_content = df_caverns.is_ground_content, }) diff --git a/df_caverns/level3.lua b/df_caverns/level3.lua index e402d3b..28b0861 100644 --- a/df_caverns/level3.lua +++ b/df_caverns/level3.lua @@ -527,4 +527,5 @@ subterrane.register_layer({ decorate = decorate_level_3, warren_region_variability_threshold = 0.33, double_frequency = true, + is_ground_content = df_caverns.is_ground_content, }) diff --git a/df_caverns/primordial.lua b/df_caverns/primordial.lua index 65a1b5f..f9081c9 100644 --- a/df_caverns/primordial.lua +++ b/df_caverns/primordial.lua @@ -286,4 +286,5 @@ subterrane.register_layer({ }, decorate = decorate_primordial, double_frequency = true, + is_ground_content = df_caverns.is_ground_content, }) diff --git a/df_caverns/shared.lua b/df_caverns/shared.lua index 208e89b..6ff42b6 100644 --- a/df_caverns/shared.lua +++ b/df_caverns/shared.lua @@ -207,4 +207,34 @@ df_caverns.place_shrub = function(vi, area, data, param2_data, shrub_list) local shrub = shrub_list[math.random(#shrub_list)] shrub(vi, area, data, param2_data) +end + +--------------------------------------------------------------------------------- +-- This method allows subterrane to overgenerate caves without destroying any of the decorations +-- Water is included so that the sunless sea won't have gaps torn in it +local dfcaverns_nodes = nil +local dfcaverns_mods = { + "df_farming:", + "df_mapitems:", + "df_primordial_items:", + "df_trees:", + "df_underworld_items:", + "ice_sprites:", + "mine_gas:", + "default:water", +} +df_caverns.is_ground_content = function(c_node) + if dfcaverns_nodes then + return not dfcaverns_nodes[c_node] + end + dfcaverns_nodes = {} + for k, v in pairs(minetest.registered_nodes) do + for _, prefix in ipairs(dfcaverns_mods) do + if k:sub(1, #prefix) == prefix then + dfcaverns_nodes[minetest.get_content_id(k)] = true + end + end + end + dfcaverns_mods = nil + return not dfcaverns_nodes[c_node] end \ No newline at end of file diff --git a/df_caverns/sunless_sea.lua b/df_caverns/sunless_sea.lua index d4888bb..5dd0162 100644 --- a/df_caverns/sunless_sea.lua +++ b/df_caverns/sunless_sea.lua @@ -401,4 +401,5 @@ subterrane.register_layer({ }, decorate = decorate_sunless_sea, double_frequency = false, + is_ground_content = df_caverns.is_ground_content, })