Releases: KSPModdingLibs/KSPCommunityFixes
FlightSceneLoadKraken
Experimental release with new bugfix, FlightSceneLoadKraken.
Prevent occasional kraken events on flight scene load (see issue #9 )
The bug manifest itself depending on the CPU load.
It is more likely to happen when :
- A large part count vessel is loaded
- Autostruts and docking ports are used
- The player has a slow CPU
- Additional mods are doing initialization-like code in their first FixedUpdate
- The "max physics delta-time per frame" KSP setting has been increased from the default 0.04 value
This bug is due to KSP mixing yield return null
coroutines (depending on the Update
cycle) for initialization code in some components with FixedUpdate
cycle initialization code in other components. Due to the Time.maximumDeltaTime
unity setting being set to a higher value than
Time.fixedDeltaTime
, depending on the CPU load, multiple FixedUpdate
can happen for a single Update
. This will wreck havoc on the intended initialization synchronization between the aforementioned components. I didn't identify the exact code execution path that lead to those kraken events, but I suspect the issue is KSP creating and activating autostruts joints before the regular part connection joints are created.
While the issue can potentially happen any time a part is instantiated in flight, I can only reproduce it somewhat consistently on flight scene load (probably because this is the most CPU-heavy case). The implemented fix works by temporarily setting Time.maximumDeltaTime
to 0.02 for the 50 first frames of a flight scene load, ensuring perfect FixedUpdate
/Update
synchronization. This does not cover all the other potential cases (unloaded vessels becoming loaded, EVA construction...), as setting Time.maximumDeltaTime
must be done a frame in advance to take effect, so when such an event happen, it's already too late. A proper fix would be to identify the exact component using the problematic yield return null
coroutines, and patch those calls to a yield return new WaitForFixedUpdate()
. Unfortunately, the likely culprit is the Part.Start()
method, and altering such a critical component isn't trivial and likely to cause other side effects.
New bugfix : DockingPortDrift
DockingPortDrift : Prevent persistent position drift of docking port connections, as long as the "Rotation locked" advanced tweakables PAW option is enabled (it is by default). Credit to JPLRepo for the fix.
Hotfix release
- Fix persisted altimeter position not being correctly reloaded
- Fix map filters transition coroutine errors by disabling the nested gameobject instead of the top one
1.0.2 : Altimeter position tweaking
1.0.1
- Base infrastructure for patch management and conditional activation based on the KSP version
- Patches can be enabled/disabled in configs
- PAWCollapsedInventories : now show slots/mass information in the group title
- Support for KSP-Recall / Tweakscale
First version
1.0.0 Fix version file