Use vectors in `get_next_mob_spawn_pos()`

This commit is contained in:
kabou 2022-12-22 02:38:35 +01:00 committed by Gitea
parent 8279dcb3dd
commit 0c454a34c9
1 changed files with 3 additions and 5 deletions

View File

@ -402,11 +402,9 @@ local two_pi = 2 * math.pi
local function get_next_mob_spawn_pos(pos) local function get_next_mob_spawn_pos(pos)
local distance = math_random(25, 32) local distance = math_random(25, 32)
local angle = math_random() * two_pi local angle = math_random() * two_pi
return { local xoff = math_round(distance * math_cos(angle))
x = math_round(pos.x + distance * math_cos(angle)), local yoff = math_round(distance * math_sin(angle))
y = pos.y, return vector.offset(pos, xoff, 0, yoff)
z = math_round(pos.z + distance * math_sin(angle))
}
end end
local function decypher_limits(posy) local function decypher_limits(posy)