From c99837fbded5f7f2c3a1afbe5a23aa95fef6c843 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Wed, 16 Feb 2022 09:51:22 +0000 Subject: [PATCH] Fixing max spawn radius to also be spherical, like the spawn cap check --- spawning.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spawning.lua b/spawning.lua index f0ffdfe..f7e3e41 100644 --- a/spawning.lua +++ b/spawning.lua @@ -167,9 +167,11 @@ function execute_spawns(player) y = pos.y, z = pos.z + random(-max_radius, max_radius) } - if vector.distance(pos, spawn_pos_center) < min_radius then + local dist = vector.distance(pos, spawn_pos_center) + if dist < min_radius or dist > max_radius then return end + local index_func if spawn.spawn_in_nodes then index_func = minetest.find_nodes_in_area