mirror of
https://github.com/iTracerFacer/DCS_MissionDev.git
synced 2025-12-03 04:14:46 +00:00
The timer error came from _isUnitInAir—when DCS returned a velocity table without x/z, the math tried to square nil. I now defensively treat missing components as zero, so the ground-speed check no longer crashes (Moose_CTLD_Pure/Moose_CTLD.lua).
This commit is contained in:
parent
5e3c9d1517
commit
b5d52d605b
@ -1520,7 +1520,9 @@ local function _isUnitInAir(unit)
|
||||
-- NOTE: AI can hold perfect hover, so only apply this check for player-controlled units
|
||||
local vel = unit:GetVelocity()
|
||||
if vel and unit:GetPlayerName() then
|
||||
local groundSpeed = math.sqrt(vel.x * vel.x + vel.z * vel.z) -- horizontal speed in m/s
|
||||
local vx = vel.x or 0
|
||||
local vz = vel.z or 0
|
||||
local groundSpeed = math.sqrt((vx * vx) + (vz * vz)) -- horizontal speed in m/s
|
||||
if groundSpeed < 0.05 then
|
||||
return false -- stopped on ground
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user