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:
iTracerFacer 2025-11-10 08:58:21 -06:00
parent 5e3c9d1517
commit b5d52d605b

View File

@ -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