From 96244ef3fd072b2c780d11a1e3a9d4d12dc5e48f Mon Sep 17 00:00:00 2001 From: JonnyOThan Date: Sat, 9 Nov 2024 16:20:03 -0500 Subject: [PATCH] Fix #377: fix fatal IVA issue triggered by KPBS -MAS was not properly handling parts that have ModuleWheelDeployment and not ModuleWheelDamage --- AvionicsSystems.csproj | 10 ++++++++++ Source/MASVesselComputerModules.cs | 7 +++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/AvionicsSystems.csproj b/AvionicsSystems.csproj index 7a143f9d..a5c09ee0 100644 --- a/AvionicsSystems.csproj +++ b/AvionicsSystems.csproj @@ -150,6 +150,16 @@ + + + + + + 2.2.1 + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + diff --git a/Source/MASVesselComputerModules.cs b/Source/MASVesselComputerModules.cs index f47d7ecf..bd4ebb16 100644 --- a/Source/MASVesselComputerModules.cs +++ b/Source/MASVesselComputerModules.cs @@ -1339,11 +1339,14 @@ private void UpdateGear() float numWheels = 0.0f; for (int i = moduleWheelDeployment.Length - 1; i >= 0; --i) { - if (!moduleWheelDamage[i].isDamaged) + var deploymentModule = moduleWheelDeployment[i]; + var damageModule = deploymentModule.wheelBase?.wheelDamageSubmodule; + + if (damageModule == null || !damageModule.isDamaged) { numWheels += 1.0f; - newPosition += Mathf.InverseLerp(moduleWheelDeployment[i].retractedPosition, moduleWheelDeployment[i].deployedPosition, moduleWheelDeployment[i].position); + newPosition += Mathf.InverseLerp(deploymentModule.retractedPosition, deploymentModule.deployedPosition, deploymentModule.position); } }