@@ -14,34 +14,25 @@ public static class MechComponentDefExtensions
1414 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
1515 public static T GetComponent < T > ( this MechComponentDef target )
1616 {
17- return Database . GetCustom < T > ( target . ccCustoms ) ;
17+ return Database . GetCustom < T > ( target ) ;
1818 }
1919
2020 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
2121 public static IEnumerable < T > GetComponents < T > ( this MechComponentDef target )
2222 {
23- return Database . GetCustoms < T > ( target . ccCustoms ) ;
23+ return Database . GetCustoms < T > ( target ) ;
2424 }
2525
2626 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
2727 public static bool Is < T > ( this MechComponentDef target , out T res )
2828 {
29- // strongly used during combat/ai due to ME ignore_damage
30- // TODO migrate combat related flags to dedicated SimpleInjector fields
31- // requires changes in calling mods!
32- if ( typeof ( T ) == typeof ( Flags ) )
33- {
34- res = ( T ) target . ccFlags ;
35- return res != null ;
36- }
37-
38- return Database . Is ( target . ccCustoms , out res ) ;
29+ return Database . Is ( target , out res ) ;
3930 }
4031
4132 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
4233 public static bool Is < T > ( this MechComponentDef target )
4334 {
44- return Database . Is < T > ( target . ccCustoms ) ;
35+ return Database . Is < T > ( target ) ;
4536 }
4637
4738 public static T AddComponent < T > ( this MechComponentDef target , T component ) where T : ICustom
@@ -50,7 +41,7 @@ public static T AddComponent<T>(this MechComponentDef target, T component) where
5041 {
5142 simple . Def = target ;
5243 }
53- Database . AddCustom ( target . Description . Id , ref target . ccCustoms , component ) ;
44+ Database . AddCustom ( target , component ) ;
5445 return component ;
5546 }
5647
@@ -70,25 +61,25 @@ public static class VehicleExtentions
7061 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
7162 public static T GetComponent < T > ( this VehicleChassisDef target )
7263 {
73- return Database . GetCustom < T > ( target . ccCustoms ) ;
64+ return Database . GetCustom < T > ( target ) ;
7465 }
7566
7667 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
7768 public static IEnumerable < T > GetComponents < T > ( this VehicleChassisDef target )
7869 {
79- return Database . GetCustoms < T > ( target . ccCustoms ) ;
70+ return Database . GetCustoms < T > ( target ) ;
8071 }
8172
8273 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
8374 public static bool Is < T > ( this VehicleChassisDef target , out T res )
8475 {
85- return Database . Is ( target . ccCustoms , out res ) ;
76+ return Database . Is ( target , out res ) ;
8677 }
8778
8879 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
8980 public static bool Is < T > ( this VehicleChassisDef target )
9081 {
91- return Database . Is < T > ( target . ccCustoms ) ;
82+ return Database . Is < T > ( target ) ;
9283 }
9384}
9485
@@ -97,25 +88,25 @@ public static class MechDefExtensions
9788 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
9889 public static T GetComponent < T > ( this MechDef target )
9990 {
100- return Database . GetCustom < T > ( target . ccCustoms ) ;
91+ return Database . GetCustom < T > ( target ) ;
10192 }
10293
10394 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
10495 public static IEnumerable < T > GetComponents < T > ( this MechDef target )
10596 {
106- return Database . GetCustoms < T > ( target . ccCustoms ) ;
97+ return Database . GetCustoms < T > ( target ) ;
10798 }
10899
109100 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
110101 public static bool Is < T > ( this MechDef target , out T res )
111102 {
112- return Database . Is ( target . ccCustoms , out res ) ;
103+ return Database . Is ( target , out res ) ;
113104 }
114105
115106 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
116107 public static bool Is < T > ( this MechDef target )
117108 {
118- return Database . Is < T > ( target . ccCustoms ) ;
109+ return Database . Is < T > ( target ) ;
119110 }
120111
121112 public static bool IsBroken ( this MechDef def )
@@ -159,25 +150,25 @@ public static class ChassisDefExtensions
159150 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
160151 public static T GetComponent < T > ( this ChassisDef target )
161152 {
162- return Database . GetCustom < T > ( target . ccCustoms ) ;
153+ return Database . GetCustom < T > ( target ) ;
163154 }
164155
165156 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
166157 public static IEnumerable < T > GetComponents < T > ( this ChassisDef target )
167158 {
168- return Database . GetCustoms < T > ( target . ccCustoms ) ;
159+ return Database . GetCustoms < T > ( target ) ;
169160 }
170161
171162 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
172163 public static bool Is < T > ( this ChassisDef target , out T res )
173164 {
174- return Database . Is ( target . ccCustoms , out res ) ;
165+ return Database . Is ( target , out res ) ;
175166 }
176167
177168 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
178169 public static bool Is < T > ( this ChassisDef target )
179170 {
180- return Database . Is < T > ( target . ccCustoms ) ;
171+ return Database . Is < T > ( target ) ;
181172 }
182173
183174 public static T AddComponent < T > ( this ChassisDef target , T component ) where T : ICustom
@@ -186,7 +177,7 @@ public static T AddComponent<T>(this ChassisDef target, T component) where T : I
186177 {
187178 simple . Def = target ;
188179 }
189- Database . AddCustom ( target . Description . Id , ref target . ccCustoms , component ) ;
180+ Database . AddCustom ( target , component ) ;
190181 return component ;
191182 }
192183
0 commit comments