fix ADS inicialization

This commit is contained in:
Alexsandro Percy 2023-08-12 15:15:31 -03:00
parent e1e0330f1c
commit 21928c277c

View file

@ -222,8 +222,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
local plane_obj = airutils.getPlaneFromPlayer(player)
if plane_obj == nil then
minetest.close_formspec(name, "lib_planes:adf_main")
minetest.chat_send_player(name, core.colorize('#ff0000', " >>> There is something wrong with the plane..."))
minetest.close_formspec(name, "lib_planes:adf_main")
return
end
local ent = plane_obj:get_luaentity()
@ -238,6 +238,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
if fields.save_adf then
if not ent._adf_destiny then ent._adf_destiny = {x=0,z=0} end
if ent._adf_destiny then
if fields.adf_x and fields.adf_z then
if tonumber(fields.adf_x, 10) ~= nil and tonumber(fields.adf_z, 10) ~= nil then