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()
46
46
PartPatch . ClearOnSceneSwitch ( ) ;
47
47
MaterialColorUpdaterPatch . ClearOnSceneSwitch ( ) ;
48
48
ModuleColorChangerPatch . ClearOnSceneSwitch ( ) ;
49
+ FairingPanelPatch . ClearOnSceneSwitch ( ) ;
49
50
50
51
this . LogMessage ( "destroyed" ) ;
51
52
}
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 51
51
<Publicize Include =" Assembly-CSharp:Part.highlightRenderer" />
52
52
<Publicize Include =" Assembly-CSharp:Part.modelRenderersCache" />
53
53
<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" />
54
57
</ItemGroup >
55
58
56
59
<!-- Version Files -->
You can’t perform that action at this time.
0 commit comments