File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ private void OnDestroy()
4646 PartPatch . ClearOnSceneSwitch ( ) ;
4747 MaterialColorUpdaterPatch . ClearOnSceneSwitch ( ) ;
4848 ModuleColorChangerPatch . ClearOnSceneSwitch ( ) ;
49+ FairingPanelPatch . ClearOnSceneSwitch ( ) ;
4950
5051 this . LogMessage ( "destroyed" ) ;
5152 }
Original file line number Diff line number Diff line change 1+ using HarmonyLib ;
2+ using ProceduralFairings ;
3+
4+ namespace Shabby . DynamicProperties ;
5+
6+ [ HarmonyPatch ( typeof ( FairingPanel ) ) ]
7+ internal class FairingPanelPatch : StockPatchBase < FairingPanel >
8+ {
9+ [ HarmonyPrefix ]
10+ [ HarmonyPatch ( nameof ( FairingPanel . SetOpacity ) ) ]
11+ private static bool SetOpacity_Transpiler ( FairingPanel __instance , float o )
12+ {
13+ __instance . opacity = o ;
14+
15+ if ( ! Props . TryGetValue ( __instance , out var props ) ) {
16+ props = Props [ __instance ] = new Props ( 0 ) ;
17+ MaterialPropertyManager . Instance ? . Set ( __instance . mr , props ) ;
18+ if ( __instance . attachedFlagParts is { Count : > 0 } ) {
19+ foreach ( var flagPart in __instance . attachedFlagParts ) {
20+ foreach ( var flagRenderer in flagPart . flagMeshRenderers ) {
21+ MaterialPropertyManager . Instance ? . Set ( flagRenderer , props ) ;
22+ }
23+ }
24+ }
25+ }
26+
27+ props . SetFloat ( PropertyIDs . _Opacity , o ) ;
28+
29+ return false ;
30+ }
31+
32+ [ HarmonyPostfix ]
33+ [ HarmonyPatch ( nameof ( FairingPanel . Despawn ) ) ]
34+ private static void FairingPanel_Despawn ( FairingPanel __instance )
35+ {
36+ if ( Props . Remove ( __instance , out var props ) ) props . Dispose ( ) ;
37+ }
38+ }
Original file line number Diff line number Diff line change 5151 <Publicize Include =" Assembly-CSharp:Part.highlightRenderer" />
5252 <Publicize Include =" Assembly-CSharp:Part.modelRenderersCache" />
5353 <Publicize Include =" Assembly-CSharp:Part.temperatureRenderer" />
54+ <Publicize Include =" Assembly-CSharp:ProceduralFairings.FairingPanel.mpb" />
55+ <Publicize Include =" Assembly-CSharp:ProceduralFairings.FairingPanel.mr" />
56+ <Publicize Include =" Assembly-CSharp:ProceduralFairings.FairingPanel.opacity" />
5457 </ItemGroup >
5558
5659 <!-- Version Files -->
You can’t perform that action at this time.
0 commit comments