From 161fd0d558a65403bdd24a6023f0bc1f8e236423 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Sun, 2 Aug 2015 20:37:33 +0200 Subject: [PATCH] Added random lock to divide per 2 pyramids' spawn rate - Solves #187 --- mods/tsm_pyramids/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/tsm_pyramids/init.lua b/mods/tsm_pyramids/init.lua index a692203e..ad9327e0 100755 --- a/mods/tsm_pyramids/init.lua +++ b/mods/tsm_pyramids/init.lua @@ -144,11 +144,11 @@ minetest.register_on_generated(function(minp, maxp, seed) math.randomseed(seed) local cnt = 0 - local perlin1 = minetest.env:get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1) + local perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1) local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z}) - if noise1 > 0.25 or noise1 < -0.26 then - local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)} + if noise1 > 0.25 or noise1 < -0.26 and math.random(1,100) % 2 == 0 then -- Coward attempt to divide per 2 the spawn rate + local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)} local p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"}) while p2 == nil and cnt < 5 do