@@ -6,28 +6,28 @@ public static class ModuleExtensions
6
6
{
7
7
public static T GetModule < T > ( this object obj ) where T : IModule
8
8
{
9
- return ( T ? ) ModuleSub ? . Invoke ( obj , typeof ( T ) ) ;
9
+ return ( T ? ) ModuleSub . GetFirstModule ? . Invoke ( obj , typeof ( T ) ) ;
10
10
}
11
11
12
- public static bool TryGetModuleNode < T > ( this object obj , out T out_t ) where T : IModule
12
+ public static List < T > GetModules < T > ( this object obj ) where T : IModule
13
+ {
14
+ return ( List < T > ) ModuleSub . GetModuleList ? . Invoke ( obj , typeof ( T ) ) ;
15
+ }
16
+
17
+ public static bool TryGetModule < T > ( this object obj , out T out_t ) where T : IModule
13
18
{
14
19
out_t = default ;
15
- out_t = ( T ) node . GetChildren ( ) . FirstOrDefault ( x => x is T ) ;
20
+ out_t = ( T ? ) ModuleSub . GetFirstModule ? . Invoke ( obj , typeof ( T ) ) ;
16
21
return out_t != null ;
17
22
}
18
23
19
- public static void AddModuleNode < T > ( this object obj , T module ) where T : IModule
24
+ public static void AddModule < T > ( this object obj , T module ) where T : IModule
20
25
{
21
- module . SetMultiplayerAuthority ( node . GetMultiplayerAuthority ( ) ) ;
22
- node . AddChild ( module ) ;
26
+ ModuleSub . AddModule ? . Invoke ( obj , module ) ;
23
27
}
24
28
25
- public static void RemoveModuleNode < T > ( this object obj ) where T : IModule
29
+ public static void RemoveModule < T > ( this object obj ) where T : IModule
26
30
{
27
- var NodeList = node . GetChildren ( ) . Where ( x=> x is T ) . ToList ( ) ;
28
- foreach ( var Node in NodeList )
29
- {
30
- node . RemoveChild ( Node ) ;
31
- }
31
+ ModuleSub . RemoveModule ? . Invoke ( obj , typeof ( T ) ) ;
32
32
}
33
33
}
0 commit comments