1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 15:33:31 +08:00

fixed rest issues

This commit is contained in:
2025-09-21 23:57:03 +08:00
parent 6b423225fe
commit 2a4008deac
3 changed files with 120 additions and 103 deletions

View File

@@ -1125,20 +1125,13 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
DeepProfiler.EndSample(DPEntry.Belt);
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.LogicFrame))]
public static IEnumerable<CodeInstruction> GameLogic_LogicFrame_Transpiler(IEnumerable<CodeInstruction> instructions)
[HarmonyPostfix]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.OnFactoryFrameBegin))]
public static void GameLogic_OnFactoryFrameBegin_Postfix()
{
var matcher = new CodeMatcher(instructions);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(DeepProfiler), nameof(DeepProfiler.EndSample), [typeof(int), typeof(long)]))
).Advance(1).Insert(
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(BeltSignalGenerator), nameof(ProcessBeltSignals)))
);
return matcher.InstructionEnumeration();
ProcessBeltSignals();
}
/* BEGIN: Item sources calculation */
private static readonly Dictionary<int, ItemSource> ItemSources = [];
private static bool _itemSourcesInitialized;