From 99b435d9a7c88d685b020ae0a80a297008029297 Mon Sep 17 00:00:00 2001 From: krzychu124 Date: Wed, 13 Oct 2021 21:54:47 +0200 Subject: [PATCH] Cars and cargo trucks despawn despite the Despawning is off --- TLM/TLM/Patch/PatchCommons.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TLM/TLM/Patch/PatchCommons.cs b/TLM/TLM/Patch/PatchCommons.cs index fb6ddb5cb..48d9c3058 100644 --- a/TLM/TLM/Patch/PatchCommons.cs +++ b/TLM/TLM/Patch/PatchCommons.cs @@ -23,13 +23,13 @@ public static IEnumerable ReplaceSimulationStepIsCongestedCheck bool found = false; foreach (CodeInstruction instruction in codes) { - if (!found && instruction.opcode.Equals(OpCodes.Brfalse_S)) { + if (!found && (instruction.opcode.Equals(OpCodes.Brfalse_S) || instruction.opcode.Equals(OpCodes.Brfalse))) { found = true; yield return instruction; // return found instruction yield return new CodeInstruction(OpCodes.Ldsfld, _vehicleBehaviourManagerInstanceField); // loadInstFiled yield return new CodeInstruction(OpCodes.Ldarg_2); // loadVehicleData yield return new CodeInstruction(OpCodes.Callvirt, _mayDespawnMethod); // callMayDespawn - yield return instruction.Clone(); //brfalse_s clone including label! + yield return instruction.Clone(); //brfalse_s || brfalse - clone including label! } else { yield return instruction; }