From 9c22df853d163e332e1f3d1f544045c95d5ca47c Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 20 May 2017 07:59:10 +0200 Subject: [PATCH] Generate igloos on snow blocks --- mods/MAPGEN/mcl_mapgen_core/init.lua | 10 ++++++++++ mods/MAPGEN/mcl_structures/init.lua | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index a7c3b55d8..5180688f3 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -891,6 +891,7 @@ local perlin minetest.register_on_generated(function(minp, maxp, seed) local chunk_has_desert_well = false local chunk_has_desert_temple = false + local chunk_has_igloo = false if maxp.y >= 2 and minp.y <= 0 then -- Generate clay -- Assume X and Z lengths are equal @@ -988,6 +989,15 @@ minetest.register_on_generated(function(minp, maxp, seed) end end end + elseif not chunk_has_igloo and nn == "mcl_core:snowblock" then + if math.random(1, 4400) == 1 then + -- Check surface + local surface = minetest.find_nodes_in_area({x=p.x,y=p.y-1,z=p.z}, {x=p.x+9, y=p.y-1, z=p.z+9}, "mcl_core:snowblock") + if #surface >= 63 then + mcl_structures.call_struct(p, "igloo") + chunk_has_igloo = true + end + end end end end diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index bde539db3..2c0b3283f 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -171,7 +171,7 @@ end mcl_structures.generate_igloo_top = function(pos) -- FIXME: This spawns bookshelf instead of furnace. Fix this! -- Furnace does ot work atm because apparently meta is not set. :-( - local newpos = {x=pos.x,y=pos.y-2,z=pos.z} + local newpos = {x=pos.x,y=pos.y-1,z=pos.z} local path = minetest.get_modpath("mcl_structures").."/build/igloo_top.mts" minetest.place_schematic(newpos, path, "random", nil, true) end