@@ -249,9 +249,15 @@ public static IEnumerable<CodeInstruction> LabComponent_InternalUpdateResearch_T
249249 matcher . MatchForward ( false , new CodeMatch ( OpCodes . Ldarg_0 ) ,
250250 new CodeMatch ( OpCodes . Ldfld , AccessTools . Field ( typeof ( LabComponent ) , nameof ( LabComponent . matrixPoints ) ) ) ) ;
251251
252- matcher . CreateLabel ( out Label label ) ;
252+ CodeMatcher matcher2 = matcher . Clone ( ) ;
253253
254- matcher . InsertAndAdvance ( new CodeInstruction ( OpCodes . Ldarg_0 ) , new CodeInstruction ( OpCodes . Ldloc_0 ) ,
254+ matcher2 . MatchForward ( false , new CodeMatch ( OpCodes . Ldarg_0 ) ,
255+ new CodeMatch ( OpCodes . Ldfld , AccessTools . Field ( typeof ( LabComponent ) , nameof ( LabComponent . matrixPoints ) ) ) ,
256+ new CodeMatch ( OpCodes . Ldc_I4_5 ) ) ;
257+
258+ var label = matcher2 . Advance ( 5 ) . Operand ;
259+
260+ matcher . InsertAndAdvance ( new CodeInstruction ( OpCodes . Ldarg_0 ) ,
255261 new CodeInstruction ( OpCodes . Call ,
256262 AccessTools . Method ( typeof ( ResearchLabPatches ) , nameof ( LabComponent_InternalUpdateResearch_Patch_Method ) ) ) ,
257263 new CodeInstruction ( OpCodes . Dup ) , new CodeInstruction ( OpCodes . Stloc_0 ) , new CodeInstruction ( OpCodes . Brtrue , label ) ,
@@ -307,24 +313,27 @@ public static bool LabComponent_UpdateNeedsResearch_Prefix(ref LabComponent __in
307313 return false ;
308314 }
309315
310- public static int LabComponent_InternalUpdateResearch_Patch_Method ( ref LabComponent labComponent , int num1 )
316+ public static int LabComponent_InternalUpdateResearch_Patch_Method ( ref LabComponent labComponent )
311317 {
312- for ( var i = 6 ; i < LabComponent . matrixIds . Length ; i ++ )
318+ int speed = ( int ) ( GameMain . history . techSpeed + 2.0 ) ;
319+
320+ for ( var i = 0 ; i < LabComponent . matrixIds . Length ; i ++ )
313321 {
314322 if ( labComponent . matrixPoints [ i ] <= 0 ) continue ;
315323
316324 int point = labComponent . matrixServed [ i ] / labComponent . matrixPoints [ i ] ;
317325
318- if ( point >= num1 ) continue ;
326+ if ( point >= speed ) continue ;
327+
328+ speed = point ;
319329
320- num1 = point ;
321- if ( num1 != 0 ) continue ;
330+ if ( speed != 0 ) continue ;
322331
323332 labComponent . replicating = false ;
324333 return 0 ;
325334 }
326335
327- return num1 ;
336+ return speed ;
328337 }
329338
330339 public static void LabMatrixEffect_Patch_Method ( LabMatrixEffect labMatrixEffect , TechProto techProto )
0 commit comments