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 34
34
<PackageReference Include =" KSPBuildTools" Version =" 0.0.2-alpha.7" />
35
35
</ItemGroup >
36
36
<ItemGroup >
37
+ <Compile Include =" HarmonyPatches\ModuleParachutePatch.cs" />
37
38
<Compile Include =" Modules\ModuleAutoCutDrogue.cs" />
38
39
<Compile Include =" Modules\ModuleCoPFollowTransform.cs" />
39
40
<Compile Include =" Properties\AssemblyInfo.cs" />
Original file line number Diff line number Diff line change 4
4
Originally By: Jsolson
5
5
Originally For: Bluedog Design Bureau
6
6
*/
7
- using HarmonyLib ;
8
- using System ;
9
7
using System . Linq ;
10
8
using UnityEngine ;
9
+ using KSPCommunityPartModules . HarmonyPatches ;
11
10
12
11
namespace KSPCommunityPartModules . Modules
13
12
{
@@ -71,38 +70,4 @@ private void OnParachuteRepacked(ModuleParachute pChute)
71
70
if ( triggered && pChute == chute ) triggered = false ;
72
71
}
73
72
}
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
- }
108
73
}
You can’t perform that action at this time.
0 commit comments