From 672f58a1df96df97a1742b83e2f25049fbc9a165 Mon Sep 17 00:00:00 2001 From: siimav Date: Tue, 29 Oct 2024 14:56:16 +0200 Subject: [PATCH] Fix cases where part physicsMass isn't initialized yet --- .../KerbalJointReinforcement/KJRManager.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs b/KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs index 0b971e0..20a510b 100644 --- a/KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs +++ b/KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs @@ -147,6 +147,13 @@ private IEnumerator RunVesselJointUpdateFunctionWhenSafe(Vessel v) yield return new WaitUntil(() => !isEVAConstructionModeActive); } + while (v.rootPart.physicsMass == 0) + { + if (KJRJointUtils.settings.debug) + Debug.Log("[KJR] Waiting for root part to obtain physicsMass"); + yield return new WaitForEndOfFrame(); + } + // Try to update the joints only once on a vessel that has changed multiple times during EVA Construction if (!updatedVessels.Contains(v)) RunVesselJointUpdateFunction(v);