Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete Bank vans detection #1713

Merged
merged 1 commit into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ private void DetermineVehicleType(ref ExtVehicle extVehicle, ref Vehicle vehicle
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.
krzychu124 marked this conversation as resolved.
Show resolved Hide resolved
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