From 55028bc300cbbacbd36aeeaa475a1f2fdee994be Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Mon, 29 Apr 2024 14:51:31 -0400 Subject: [PATCH] try to sinc by consider mapgen version * This will allow pyramids to find some desert sand, but the astute will notice those are the v7 Heat Noise Parameters, the (5349, 3, 0.7, 500), and the Humidity for those inclined to tinker are (842, 3, 0.55, 500), cos mods that rely on the perlin noise must be in sync. * try to detect the older simplev7 mod and sync with guessed values * also detect the multicraft v7 plus mapgen --- init.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 4e242c3..19fd407 100644 --- a/init.lua +++ b/init.lua @@ -36,6 +36,10 @@ local PYRA_MAX_Y = 1000 local is_50 = minetest.has_feature("object_use_texture_alpha") -- minetest 5.5 check local is_54 = minetest.has_feature("use_texture_alpha_string_modes") or nil +-- get mapgen cos perlin noise must match mapgen choice and nodes +local mgname = minetest.get_mapgen_setting("mg_name") or "v7" +-- also perlin noise must be in sync for simplev7 mod +local mgsimp = minetest.get_modpath("simplev7") or nil tsm_pyramids = {} tsm_pyramids.is_50 = is_50 @@ -283,10 +287,14 @@ local function make(pos, brick, sandstone, stone, sand, ptype, room_id) return ok, msg end -local perl1 --- if mg v6 set this {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise. -perl1 = { SEED1 = 9130, OCTA1 = 1, PERS1 = 0.5, SCAL1 = 25 } -- Values should match minetest mapgen V7 desert noise. +local perl1 -- perlin noise / it depends of the mapgen, upstream do not set property +if mgname == "v6" then perl1 = {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} end -- Values should match minetest mapgen V6 desert noise. +if mgname == "v7p" then perl1 = {SEED1 = 9130, OCTA1 = 1, PERS1 = 0.5, SCAL1 = 25} end -- The multicraft v7plus desert noise are not knowwed. +if mgname == "v7" then perl1 = {SEED1 = 9130, OCTA1 = 1, PERS1 = 0.5, SCAL1 = 25} end -- Values should match minetest mapgen V7 desert noise. +if mgsimp ~= nil then perl1 = {SEED1 = 5349, OCTA1 = 3, PERS1 = 0.7, SCAL1 = 500} end -- must match to find some desert sand + +-- get_perlin can only call it after the environment is created so wrap code for older engines into minetest.after(0, ...) and only call it once if tsm_pyramids.is_50 then tsm_pyramids.perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1) else