Skip to content

Commit

Permalink
Add missing AI check
Browse files Browse the repository at this point in the history
(cherry picked from commit 5fe95c0)
  • Loading branch information
krzychu124 committed Dec 23, 2022
1 parent 6287c54 commit 43b0071
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions TLM/TLM/Manager/Impl/ExtVehicleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ public class ExtVehicleManager
case PassengerCarAI _:
return ExtVehicleType.PassengerCar;
case AmbulanceAI _:
case BankVanAI _:
case FireTruckAI _:
case PoliceCarAI _:
case HearseAI _:
Expand Down
29 changes: 29 additions & 0 deletions TLM/TLM/Patch/_VehicleAI/_BankVanAI/StartPathFindPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace TrafficManager.Patch._VehicleAI._BankVanAI {
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
using JetBrains.Annotations;
using TrafficManager.API.Traffic.Enums;
using TrafficManager.Patch._PathManager;

[HarmonyPatch]
public class StartPathFindPatch {

[UsedImplicitly]
public static MethodBase TargetMethod() => StartPathFindCommons.TargetMethod<BankVanAI>();

[UsedImplicitly]
public static void Prefix(ushort vehicleID, ref Vehicle vehicleData) {
CreatePathPatch.ExtPathType = ExtPathType.None;
CreatePathPatch.ExtVehicleType = ExtVehicleType.Service;
CreatePathPatch.VehicleID = vehicleID;
}

[UsedImplicitly]
[HarmonyPriority(Priority.Low)] // so that if this code is redundant, it would result in warning log.
public static IEnumerable<CodeInstruction> Transpiler(ILGenerator il, IEnumerable<CodeInstruction> instructions) {
return StartPathFindCommons.ReplaceMaxPosTranspiler(instructions);
}
}
}
1 change: 1 addition & 0 deletions TLM/TLM/TLM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
<Compile Include="Patch\_NetLane\CalculateStopPositionAndDirection.cs" />
<Compile Include="Patch\_PedestrianZoneRoadAI\BollardSimulationStepPatch.cs" />
<Compile Include="Patch\_VehicleAI\InvalidPathPatch.cs" />
<Compile Include="Patch\_VehicleAI\_BankVanAI\StartPathFindPatch.cs" />
<Compile Include="Patch\_VehicleAI\_BusAI\CalculateSegmentPositionPatch.cs" />
<Compile Include="State\OptionsTabs\GameplayTab_AIGroups.cs" />
<Compile Include="State\OptionsTabs\GeneralTab_CompatibilityGroup.cs" />
Expand Down

0 comments on commit 43b0071

Please sign in to comment.