Consider mapgen v7. Add max height.

* set a maximun height and use the parameters on mapgen v7 from poikilos,
  seems oldcoder already does that! this was taken from old fork
  from commit e970ff7955
* the commit only takes the max height part.. the node detection
  suggestion was omited (few 3 lines around sand_cnt_max_id check)
  cos is already added on the previous function `select_pyramid_type(min, max)`
main
mckaygerhard 2024-03-21 05:57:23 -04:00
parent 4fc72e39ad
commit ffdc7cd035
1 changed files with 10 additions and 5 deletions

View File

@ -7,7 +7,9 @@ local PYRA_Wm = PYRA_W - 1
-- Half of (Pyramid width minus 1)
local PYRA_Wh = PYRA_Wm / 2
-- Minimum spawn height
local PYRA_MIN_Y = 3
local PYRA_MIN_Y = 1
-- Maximun spawn height
local PYRA_MAX_Y = 1000
tsm_pyramids = {}
@ -240,9 +242,12 @@ local function make(pos, brick, sandstone, stone, sand, ptype, room_id)
return ok, msg
end
local perl1 = {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise.
local perl1
local perlin1 -- perlin noise buffer
-- 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 function hlp_fnct(pos, name)
local n = minetest.get_node_or_nil(pos)
if n and n.name and n.name == name then
@ -314,7 +319,7 @@ end
-- Attempt to generate a pyramid in the generated area.
-- Up to one pyramid per mapchunk.
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y < PYRA_MIN_Y then return end
if maxp.y < PYRA_MIN_Y or maxp.y > PYRA_MAX_Y then return end
-- TODO: Use Minetests pseudo-random tools
math.randomseed(seed)
@ -348,8 +353,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
minetest.log("verbose", "[tsm_pyramids] Pyramid not placed, no suitable surface. minp="..minetest.pos_to_string(minp))
return
end
if p2.y < PYRA_MIN_Y then
minetest.log("info", "[tsm_pyramids] Pyramid not placed, too deep. p2="..minetest.pos_to_string(p2))
if p2.y < PYRA_MIN_Y or p2.y > PYRA_MAX_Y then
minetest.log("info", "[tsm_pyramids] Pyramid not placed, too deep or too high. p2="..minetest.pos_to_string(p2))
return
end
-- Now sink the pyramid until each corner of it is no longer floating in mid-air