66namespace Shabby . DynamicProperties ;
77
88[ HarmonyPatch ( typeof ( Part ) ) ]
9- internal static class PartPatch
9+ internal class PartPatch : StockPatchBase < Part >
1010{
11- private static readonly Dictionary < Part , Props > rimHighlightProps = [ ] ;
12-
1311 [ HarmonyPostfix ]
1412 [ HarmonyPatch ( "Awake" ) ]
1513 private static void Awake_Postfix ( Part __instance )
1614 {
17- rimHighlightProps [ __instance ] = new Props ( int . MinValue + 1 ) ;
15+ Props [ __instance ] = new Props ( int . MinValue + 1 ) ;
1816 }
1917
2018 [ HarmonyPostfix ]
2119 [ HarmonyPatch ( "CreateRendererLists" ) ]
2220 private static void CreateRendererLists_Postfix ( Part __instance )
2321 {
24- var props = rimHighlightProps [ __instance ] ;
22+ var props = Props [ __instance ] ;
2523 props . SetFloat ( PropertyIDs . _RimFalloff , 2f ) ;
2624 props . SetColor ( PropertyIDs . _RimColor , Part . defaultHighlightNone ) ;
2725 foreach ( var renderer in __instance . HighlightRenderer ) {
@@ -35,13 +33,13 @@ private static bool SetOpacity_Prefix(Part __instance, float opacity)
3533 {
3634 __instance . CreateRendererLists ( ) ;
3735 __instance . mpb . SetFloat ( PropertyIDs . _Opacity , opacity ) ;
38- rimHighlightProps [ __instance ] . SetFloat ( PropertyIDs . _Opacity , opacity ) ;
36+ Props [ __instance ] . SetFloat ( PropertyIDs . _Opacity , opacity ) ;
3937 return false ;
4038 }
4139
4240 private static void Highlight_SetRimColor ( Part part , Color color )
4341 {
44- rimHighlightProps [ part ] . SetColor ( PropertyIDs . _RimColor , color ) ;
42+ Props [ part ] . SetColor ( PropertyIDs . _RimColor , color ) ;
4543 }
4644
4745 [ HarmonyTranspiler ]
@@ -122,7 +120,7 @@ private static IEnumerable<CodeInstruction> Highlight_Transpiler(
122120 [ HarmonyPatch ( "OnDestroy" ) ]
123121 private static void OnDestroy_Postfix ( Part __instance )
124122 {
125- if ( rimHighlightProps . Remove ( __instance , out var props ) ) {
123+ if ( Props . Remove ( __instance , out var props ) ) {
126124 props . Dispose ( ) ;
127125 }
128126 }
0 commit comments