From b5d52d605b43c301743dc17fb350482f98ac5098 Mon Sep 17 00:00:00 2001 From: iTracerFacer <134304944+iTracerFacer@users.noreply.github.com> Date: Mon, 10 Nov 2025 08:58:21 -0600 Subject: [PATCH] =?UTF-8?q?The=20timer=20error=20came=20from=20=5FisUnitIn?= =?UTF-8?q?Air=E2=80=94when=20DCS=20returned=20a=20velocity=20table=20with?= =?UTF-8?q?out=20x/z,=20the=20math=20tried=20to=20square=20nil.=20I=20now?= =?UTF-8?q?=20defensively=20treat=20missing=20components=20as=20zero,=20so?= =?UTF-8?q?=20the=20ground-speed=20check=20no=20longer=20crashes=20(Moose?= =?UTF-8?q?=5FCTLD=5FPure/Moose=5FCTLD.lua).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Moose_CTLD_Pure/Moose_CTLD.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Moose_CTLD_Pure/Moose_CTLD.lua b/Moose_CTLD_Pure/Moose_CTLD.lua index 926da06..986f24a 100644 --- a/Moose_CTLD_Pure/Moose_CTLD.lua +++ b/Moose_CTLD_Pure/Moose_CTLD.lua @@ -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