/// <summary> /// Send the updates of our own vessel and the secondary vessels. We only send them after an interval specified. /// If the other player vessels are far we don't send them very often. /// </summary> private IEnumerator SendVesselUpdates() { var seconds = new WaitForSeconds(VesselUpdatesSendSInterval); var secondsFar = new WaitForSeconds(VesselUpdatesSendFarSInterval); while (true) { try { if (!Enabled) { break; } if (UpdateSystemReady && !VesselCommon.IsSpectating) { SendVesselUpdate(FlightGlobals.ActiveVessel); SendSecondaryVesselUpdates(); } } catch (Exception e) { Debug.LogError($"[LMP]: Coroutine error in SendVesselUpdates {e}"); } if (!Enabled || VesselCommon.PlayerVesselsNearby() || VesselCommon.isNearKSC(20000)) { yield return(seconds); } else { yield return(secondsFar); } } }