mirror of
https://github.com/APercy/airutils.git
synced 2025-03-21 10:31:22 +00:00
fix passenger collision when jumping from plane
This commit is contained in:
parent
be966a1ed8
commit
eef4715a3a
3 changed files with 15 additions and 3 deletions
|
@ -43,7 +43,7 @@ function airutils.on_activate(self, staticdata, dtime_s)
|
||||||
self.driver_name = data.stored_driver_name
|
self.driver_name = data.stored_driver_name
|
||||||
self._last_accell = data.stored_last_accell
|
self._last_accell = data.stored_last_accell
|
||||||
self._inv_id = data.stored_inv_id
|
self._inv_id = data.stored_inv_id
|
||||||
self._flap = data.stored_flap
|
if self._wing_angle_extra_flaps then self._flap = data.stored_flap end
|
||||||
self._passengers = data.stored_passengers or {}
|
self._passengers = data.stored_passengers or {}
|
||||||
self._adf_destiny = data.stored_adf_destiny or vector.new()
|
self._adf_destiny = data.stored_adf_destiny or vector.new()
|
||||||
self._skin = data.stored_skin
|
self._skin = data.stored_skin
|
||||||
|
|
|
@ -213,7 +213,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local ent = plane_obj:get_luaentity()
|
local ent = plane_obj:get_luaentity()
|
||||||
if ent then
|
if ent then
|
||||||
if fields.yes then
|
if fields.yes then
|
||||||
airutils.dettach_pax(ent, player)
|
airutils.dettach_pax(ent, player, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.close_formspec(name, "lib_planes:go_out_confirmation_form")
|
minetest.close_formspec(name, "lib_planes:go_out_confirmation_form")
|
||||||
|
|
|
@ -195,7 +195,8 @@ function airutils.attach_pax(self, player, is_copilot)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function airutils.dettach_pax(self, player)
|
function airutils.dettach_pax(self, player, is_flying)
|
||||||
|
is_flying = is_flying or false
|
||||||
local name = player:get_player_name() --self._passenger
|
local name = player:get_player_name() --self._passenger
|
||||||
|
|
||||||
-- passenger clicked the object => driver gets off the vehicle
|
-- passenger clicked the object => driver gets off the vehicle
|
||||||
|
@ -215,7 +216,12 @@ function airutils.dettach_pax(self, player)
|
||||||
|
|
||||||
-- detach the player
|
-- detach the player
|
||||||
if player then
|
if player then
|
||||||
|
local pos = player:get_pos()
|
||||||
player:set_detach()
|
player:set_detach()
|
||||||
|
if is_flying then
|
||||||
|
pos.y = pos.y - self.initial_properties.collisionbox[2] - 2
|
||||||
|
player:set_pos(pos)
|
||||||
|
end
|
||||||
|
|
||||||
if airutils.is_minetest then
|
if airutils.is_minetest then
|
||||||
player_api.player_attached[name] = nil
|
player_api.player_attached[name] = nil
|
||||||
|
@ -939,6 +945,12 @@ function airutils.seats_destroy(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function airutils.flap_on(self)
|
function airutils.flap_on(self)
|
||||||
|
if not self._wing_angle_extra_flaps then
|
||||||
|
self._flap = false
|
||||||
|
self._wing_configuration = self._wing_angle_of_attack
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if self._wing_angle_extra_flaps == nil then self._wing_angle_extra_flaps = 0 end --if not, just keep the same as normal angle of attack
|
if self._wing_angle_extra_flaps == nil then self._wing_angle_extra_flaps = 0 end --if not, just keep the same as normal angle of attack
|
||||||
local flap_limit = 15
|
local flap_limit = 15
|
||||||
if self._flap_limit then flap_limit = self._flap_limit end
|
if self._flap_limit then flap_limit = self._flap_limit end
|
||||||
|
|
Loading…
Add table
Reference in a new issue