Change y range calculation to use outer zone distance and not middle to let mobs spawn far away from the player

This commit is contained in:
teknomunk 2024-04-14 10:08:49 +00:00
parent 1bc0a0b411
commit 2a014ca79c

@ -648,7 +648,7 @@ local function get_next_mob_spawn_pos(pos)
end end
-- Calculate upper/lower y limits -- Calculate upper/lower y limits
local R1 = MOB_SPAWN_ZONE_MIDDLE local R1 = MOB_SPAWN_ZONE_OUTER
local d = vector_distance( pos, vector.new( goal_pos.x, pos.y, goal_pos.z ) ) -- distance from player to projected point on horizontal plane local d = vector_distance( pos, vector.new( goal_pos.x, pos.y, goal_pos.z ) ) -- distance from player to projected point on horizontal plane
local y1 = math_sqrt( R1*R1 - d*d ) -- absolue value of distance to outer sphere local y1 = math_sqrt( R1*R1 - d*d ) -- absolue value of distance to outer sphere