From 693d40b6c40f336d135d8145636bce7543c2c8a4 Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Sat, 18 Feb 2023 13:51:31 +0000 Subject: [PATCH] Fix villages generating with incorrect water This commit fixes an issue where villages would generate with water which wasn't of the correct biome. The new function simply looks for water source nodes around the entire village and replaces any it finds with the same node, except with blank params so that the `on_construct` of the newly placed water source node gets called. --- mods/MAPGEN/mcl_villages/buildings.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_villages/buildings.lua b/mods/MAPGEN/mcl_villages/buildings.lua index 92a53ddaf..1b8ce3cba 100644 --- a/mods/MAPGEN/mcl_villages/buildings.lua +++ b/mods/MAPGEN/mcl_villages/buildings.lua @@ -224,6 +224,14 @@ local function spawn_villagers(minp,maxp) end end +local function fix_village_water(minp,maxp) + local palettenodes = minetest.find_nodes_in_area(vector.offset(minp,-20,-20,-20),vector.offset(maxp,20,20,20), "group:water_palette") + for _, palettenodepos in pairs(palettenodes) do + local palettenode = minetest.get_node(palettenodepos) + minetest.set_node(palettenodepos, {name = palettenode.name}) + end +end + local function init_nodes(p1, p2, size, rotation, pr) construct_node(p1, p2, "mcl_itemframes:item_frame") construct_node(p1, p2, "mcl_furnaces:furnace") @@ -309,7 +317,7 @@ function settlements.place_schematics(settlement_info, pr) -- format schematic string local schematic = loadstring(schem_lua)() - + local is_belltower = building_all_info["name"] == "belltower" -- build foundation for the building an make room above @@ -327,6 +335,7 @@ function settlements.place_schematics(settlement_info, pr) else init_nodes(p1, p2, size, rotation, pr) spawn_villagers(p1,p2) + fix_village_water(p1,p2) end end, pr