Skip to content

Commit

Permalink
Cars and cargo trucks despawn despite the Despawning is off
Browse files Browse the repository at this point in the history
  • Loading branch information
krzychu124 committed Oct 13, 2021
1 parent 3d127b9 commit 99b435d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TLM/TLM/Patch/PatchCommons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public static IEnumerable<CodeInstruction> 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;
}
Expand Down

0 comments on commit 99b435d

Please sign in to comment.