fix server crash

https://github.com/APercy/airutils/issues/10
This commit is contained in:
Alexsandro Percy 2024-01-10 09:20:16 -03:00 committed by GitHub
parent 6f5e670324
commit 30c7525103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -8,6 +8,7 @@ function airutils.move_target(player, pointed_thing)
--minetest.chat_send_all(dump(object))
if object then
local obj_pos = object:get_pos()
if not obj_pos then return end
local hip = math.sqrt(math.pow(obj_pos.x - pos.x,2)+math.pow(obj_pos.z - pos.z,2)) + 1
local pos_x = math.sin(yaw) * -hip
local pos_z = math.cos(yaw) * hip