File tree Expand file tree Collapse file tree 3 files changed +41
-36
lines changed
Expand file tree Collapse file tree 3 files changed +41
-36
lines changed Original file line number Diff line number Diff line change 1+ using HarmonyLib ;
2+ using System ;
3+
4+ namespace KSPCommunityPartModules . HarmonyPatches
5+ {
6+ [ HarmonyPatch ( typeof ( ModuleParachute ) ) ]
7+ public class ModuleParachuteEvents
8+ {
9+ public static void ModuleManagerPostLoad ( )
10+ {
11+ Harmony harmony = new Harmony ( "KSPCommunityPartModules.ModuleParachutePatch" ) ;
12+ harmony . PatchAll ( ) ;
13+ }
14+
15+ public static event Action < ModuleParachute > OnDeployed ;
16+ public static event Action < ModuleParachute > OnRepacked ;
17+
18+ [ HarmonyPostfix ]
19+ [ HarmonyPatch ( "OnParachuteSemiDeployed" ) ]
20+ static void RaiseEventOnSemiDeployed ( ModuleParachute __instance )
21+ {
22+ OnDeployed ? . Invoke ( __instance ) ;
23+ }
24+
25+ [ HarmonyPostfix ]
26+ [ HarmonyPatch ( "OnParachuteFullyDeployed" ) ]
27+ static void RaiseEventOnFullyDeployed ( ModuleParachute __instance )
28+ {
29+ OnDeployed ? . Invoke ( __instance ) ;
30+ }
31+
32+ [ HarmonyPostfix ]
33+ [ HarmonyPatch ( "Repack" ) ]
34+ static void RaiseEventOnRepack ( ModuleParachute __instance )
35+ {
36+ OnRepacked ? . Invoke ( __instance ) ;
37+ }
38+ }
39+ }
Original file line number Diff line number Diff line change 3434 <PackageReference Include =" KSPBuildTools" Version =" 0.0.2-alpha.7" />
3535 </ItemGroup >
3636 <ItemGroup >
37+ <Compile Include =" HarmonyPatches\ModuleParachutePatch.cs" />
3738 <Compile Include =" Modules\ModuleAutoCutDrogue.cs" />
3839 <Compile Include =" Modules\ModuleCoPFollowTransform.cs" />
3940 <Compile Include =" Properties\AssemblyInfo.cs" />
Original file line number Diff line number Diff line change 44 Originally By: Jsolson
55 Originally For: Bluedog Design Bureau
66*/
7- using HarmonyLib ;
8- using System ;
97using System . Linq ;
108using UnityEngine ;
9+ using KSPCommunityPartModules . HarmonyPatches ;
1110
1211namespace KSPCommunityPartModules . Modules
1312{
@@ -71,38 +70,4 @@ private void OnParachuteRepacked(ModuleParachute pChute)
7170 if ( triggered && pChute == chute ) triggered = false ;
7271 }
7372 }
74-
75- [ HarmonyPatch ( typeof ( ModuleParachute ) ) ]
76- internal class ModuleParachuteEvents
77- {
78- public static void ModuleManagerPostLoad ( )
79- {
80- Harmony harmony = new Harmony ( "KSPCommunityPartModules" ) ;
81- harmony . PatchAll ( ) ;
82- }
83-
84- public static event Action < ModuleParachute > OnDeployed ;
85- public static event Action < ModuleParachute > OnRepacked ;
86-
87- [ HarmonyPostfix ]
88- [ HarmonyPatch ( "OnParachuteSemiDeployed" ) ]
89- static void RaiseEventOnSemiDeployed ( ModuleParachute __instance )
90- {
91- OnDeployed ? . Invoke ( __instance ) ;
92- }
93-
94- [ HarmonyPostfix ]
95- [ HarmonyPatch ( "OnParachuteFullyDeployed" ) ]
96- static void RaiseEventOnFullyDeployed ( ModuleParachute __instance )
97- {
98- OnDeployed ? . Invoke ( __instance ) ;
99- }
100-
101- [ HarmonyPostfix ]
102- [ HarmonyPatch ( "Repack" ) ]
103- static void RaiseEventOnRepack ( ModuleParachute __instance )
104- {
105- OnRepacked ? . Invoke ( __instance ) ;
106- }
107- }
10873}
You can’t perform that action at this time.
0 commit comments