@@ -45,10 +45,10 @@ private void OnDestroy()
4545 MpbCompilerCache . CheckCleared ( ) ;
4646
4747 // Poor man's GC :'(
48- PartPatch . ClearOnSceneSwitch ( ) ;
49- MaterialColorUpdaterPatch . ClearOnSceneSwitch ( ) ;
50- ModuleColorChangerPatch . ClearOnSceneSwitch ( ) ;
51- FairingPanelPatch . ClearOnSceneSwitch ( ) ;
48+ PartPatch . CheckCleared ( ) ;
49+ MaterialColorUpdaterPatch . CheckCleared ( ) ;
50+ ModuleColorChangerPatch . CheckCleared ( ) ;
51+ FairingPanelPatch . CheckCleared ( ) ;
5252
5353 this . LogMessage ( "destroyed" ) ;
5454 }
@@ -85,10 +85,21 @@ public bool Unregister(Renderer renderer)
8585 }
8686
8787 /// Get a reference to the `Props` instance containing the stock properties of the given
88- /// `part` (namely, `_Opacity`, `_RimFalloff`, `_RimColor`, and `_TemperatureColor` (flight
89- /// only)). The returned instance must not be written to.
88+ /// `part` (namely, `_Opacity`, `_RimFalloff`, and `_RimColor`).
89+ /// The returned instance must not be written to.
9090 public Props ? GetStockPropsForPart ( Part part ) => PartPatch . Props . GetValueOrDefault ( part ) ;
9191
92+ /// Get the part's current `_TemperatureColor` property, if it is set (only in flight).
93+ public Color ? GetStockTemperatureColorForPart ( Part part )
94+ {
95+ if ( ! MaterialColorUpdaterPatch . Props . TryGetValue ( part . temperatureRenderer , out var props ) ) {
96+ return null ;
97+ }
98+
99+ if ( ! props . HasColor ( PhysicsGlobals . temperaturePropertyID ) ) return null ;
100+ return props . GetColorOrDefault ( PhysicsGlobals . temperaturePropertyID ) ;
101+ }
102+
92103 public static void RegisterPropertyNamesForDebugLogging ( params string [ ] properties )
93104 {
94105 foreach ( var property in properties ) PropIdToName . Register ( property ) ;
@@ -137,7 +148,7 @@ internal void Unregister(Props props)
137148 private bool _propsUpdateScheduled = false ;
138149 private static readonly WaitForEndOfFrame WfEoF = new ( ) ;
139150
140- private IEnumerator < YieldInstruction > Co_propsLateUpdate ( )
151+ private IEnumerator < YieldInstruction > Co_PropsLateUpdate ( )
141152 {
142153 yield return WfEoF ;
143154
@@ -160,7 +171,7 @@ internal void ScheduleLateUpdate(Props props)
160171 {
161172 propsLateUpdateQueue . Add ( props ) ;
162173 if ( _propsUpdateScheduled ) return ;
163- StartCoroutine ( Co_propsLateUpdate ( ) ) ;
174+ StartCoroutine ( Co_PropsLateUpdate ( ) ) ;
164175 _propsUpdateScheduled = true ;
165176 }
166177}
0 commit comments