Skip to content

Commit

Permalink
Fix #377: fix fatal IVA issue triggered by KPBS
Browse files Browse the repository at this point in the history
-MAS was not properly handling parts that have ModuleWheelDeployment and not ModuleWheelDamage
  • Loading branch information
JonnyOThan committed Nov 9, 2024
1 parent 0ae8425 commit 96244ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions AvionicsSystems.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Publicize Include="Assembly-CSharp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Krafs.Publicizer">
<Version>2.2.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
7 changes: 5 additions & 2 deletions Source/MASVesselComputerModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 96244ef

Please sign in to comment.