From 35191a3dc9f3ef6f24bd188615d57571e7e17d4d Mon Sep 17 00:00:00 2001 From: clavinet <17836261+clavinet@users.noreply.github.com> Date: Mon, 26 Aug 2019 20:02:48 +0200 Subject: [PATCH] Actually respect height limits (#1) This patch makes moognu actually appear within the limits set by height_min and height_max. We're now getting the upper and lower possible positions from the y_min and y_max variables calculated before. By doing this, the frequency of spawned moognus will stay the same, while respecing the height limits. --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 4186f60..373d90d 100644 --- a/init.lua +++ b/init.lua @@ -68,7 +68,7 @@ function moognu.generate(minp, maxp, seed) for i = 1, max_num_moognus do if pr:next(0, 1000) == 0 then local x0 = pr:next(minp.x, maxp.x) - local y0 = pr:next(minp.y, maxp.y) + local y0 = pr:next(y_min, y_max) local z0 = pr:next(minp.z, maxp.z) local p0 = {x = x0, y = y0, z = z0} moognu.place(p0, pr:next(0, 3), pr:next(3, 15)) @@ -84,4 +84,4 @@ end) minetest.register_alias("default:nyancat", "moognu:moognu") minetest.register_alias("nyancat:nyancat", "moognu:moognu") minetest.register_alias("default:nyancat_rainbow", "moognu:moognu_rainbow") -minetest.register_alias("nyancat:nyancat_rainbow", "moognu:moognu_rainbow") \ No newline at end of file +minetest.register_alias("nyancat:nyancat_rainbow", "moognu:moognu_rainbow")