mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Optimized the boarding and unboarding of cargo. fixed bug when in defence of APC, cargo would not be loaded. The boarding and unboarding has become much more stable now.
This commit is contained in:
@@ -908,16 +908,23 @@ function UNIT:InAir()
|
||||
-- Implementation of workaround. The original code is below.
|
||||
-- This to simulate the landing on buildings.
|
||||
|
||||
-- local UnitInAir = DCSUnit:inAir()
|
||||
local UnitInAir = true
|
||||
local VelocityVec3 = DCSUnit:getVelocity()
|
||||
local Velocity = ( VelocityVec3.x ^ 2 + VelocityVec3.y ^ 2 + VelocityVec3.z ^ 2 ) ^ 0.5 -- in meters / sec
|
||||
local Coordinate = DCSUnit:getPoint()
|
||||
local LandHeight = land.getHeight( { x = Coordinate.x, y = Coordinate.z } )
|
||||
local Height = Coordinate.y - LandHeight
|
||||
if Velocity < 1 and Height <= 60 then
|
||||
UnitInAir = false
|
||||
|
||||
local UnitCategory = DCSUnit:getDesc().category
|
||||
if UnitCategory == Unit.Category.HELICOPTER then
|
||||
local VelocityVec3 = DCSUnit:getVelocity()
|
||||
local Velocity = ( VelocityVec3.x ^ 2 + VelocityVec3.y ^ 2 + VelocityVec3.z ^ 2 ) ^ 0.5 -- in meters / sec
|
||||
local Coordinate = DCSUnit:getPoint()
|
||||
local LandHeight = land.getHeight( { x = Coordinate.x, y = Coordinate.z } )
|
||||
local Height = Coordinate.y - LandHeight
|
||||
if Velocity < 1 and Height <= 60 then
|
||||
UnitInAir = false
|
||||
end
|
||||
else
|
||||
UnitInAir = DCSUnit:inAir()
|
||||
end
|
||||
|
||||
|
||||
self:T3( UnitInAir )
|
||||
return UnitInAir
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user