/
CustomCarAI.cs
440 lines (399 loc) · 20.1 KB
/
CustomCarAI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
#define DEBUGVx
using System;
using System.Collections.Generic;
using ColossalFramework;
using ColossalFramework.Math;
using TrafficManager.Geometry;
using TrafficManager.TrafficLight;
using UnityEngine;
using Random = UnityEngine.Random;
using TrafficManager.Custom.PathFinding;
using TrafficManager.State;
using TrafficManager.Manager;
using TrafficManager.Traffic;
using CSUtil.Commons;
using TrafficManager.Manager.Impl;
using System.Runtime.CompilerServices;
using TrafficManager.Traffic.Data;
using static TrafficManager.Traffic.Data.ExtCitizenInstance;
using CSUtil.Commons.Benchmark;
using static TrafficManager.Custom.PathFinding.CustomPathManager;
namespace TrafficManager.Custom.AI {
public class CustomCarAI : CarAI { // TODO inherit from VehicleAI (in order to keep the correct references to `base`)
public void Awake() {
}
/// <summary>
/// Lightweight simulation step method.
/// This method is occasionally being called for different cars.
/// </summary>
/// <param name="vehicleId"></param>
/// <param name="vehicleData"></param>
/// <param name="physicsLodRefPos"></param>
public void CustomSimulationStep(ushort vehicleId, ref Vehicle vehicleData, Vector3 physicsLodRefPos) {
#if DEBUG
bool vehDebug = (GlobalConfig.Instance.Debug.VehicleId == 0 || GlobalConfig.Instance.Debug.VehicleId == vehicleId);
bool debug = GlobalConfig.Instance.Debug.Switches[2] && vehDebug;
bool fineDebug = GlobalConfig.Instance.Debug.Switches[4] && vehDebug;
#endif
if ((vehicleData.m_flags & Vehicle.Flags.WaitingPath) != 0) {
PathManager pathManager = Singleton<PathManager>.instance;
byte pathFindFlags = pathManager.m_pathUnits.m_buffer[vehicleData.m_path].m_pathFindFlags;
// NON-STOCK CODE START
ExtPathState mainPathState = ExtPathState.Calculating;
if ((pathFindFlags & PathUnit.FLAG_FAILED) != 0 || vehicleData.m_path == 0) {
mainPathState = ExtPathState.Failed;
} else if ((pathFindFlags & PathUnit.FLAG_READY) != 0) {
mainPathState = ExtPathState.Ready;
}
#if DEBUG
if (debug)
Log._Debug($"CustomCarAI.CustomSimulationStep({vehicleId}): Path: {vehicleData.m_path}, mainPathState={mainPathState}");
#endif
ExtSoftPathState finalPathState = ExtSoftPathState.None;
#if BENCHMARK
using (var bm = new Benchmark(null, "UpdateCarPathState")) {
#endif
finalPathState = ExtCitizenInstance.ConvertPathStateToSoftPathState(mainPathState);
if (Options.prohibitPocketCars && VehicleStateManager.Instance.VehicleStates[vehicleId].vehicleType == ExtVehicleType.PassengerCar) {
ushort driverInstanceId = CustomPassengerCarAI.GetDriverInstanceId(vehicleId, ref vehicleData);
finalPathState = AdvancedParkingManager.Instance.UpdateCarPathState(vehicleId, ref vehicleData, ref Singleton<CitizenManager>.instance.m_instances.m_buffer[driverInstanceId], ref ExtCitizenInstanceManager.Instance.ExtInstances[driverInstanceId], mainPathState);
#if DEBUG
if (debug)
Log._Debug($"CustomCarAI.CustomSimulationStep({vehicleId}): Applied Parking AI logic. Path: {vehicleData.m_path}, mainPathState={mainPathState}, finalPathState={finalPathState}");
#endif
}
#if BENCHMARK
}
#endif
switch (finalPathState) {
case ExtSoftPathState.Ready:
#if DEBUG
if (debug)
Log._Debug($"CustomCarAI.CustomSimulationStep({vehicleId}): Path-finding succeeded for vehicle {vehicleId} (finalPathState={finalPathState}). Path: {vehicleData.m_path} -- calling CarAI.PathfindSuccess");
#endif
vehicleData.m_pathPositionIndex = 255;
vehicleData.m_flags &= ~Vehicle.Flags.WaitingPath;
vehicleData.m_flags &= ~Vehicle.Flags.Arriving;
this.PathfindSuccess(vehicleId, ref vehicleData);
this.TrySpawn(vehicleId, ref vehicleData);
break;
case ExtSoftPathState.Ignore:
#if DEBUG
if (debug)
Log._Debug($"CustomCarAI.CustomSimulationStep({vehicleId}): Path-finding result shall be ignored for vehicle {vehicleId} (finalPathState={finalPathState}). Path: {vehicleData.m_path} -- ignoring");
#endif
return;
case ExtSoftPathState.Calculating:
default:
#if DEBUG
if (debug)
Log._Debug($"CustomCarAI.CustomSimulationStep({vehicleId}): Path-finding result undetermined for vehicle {vehicleId} (finalPathState={finalPathState}). Path: {vehicleData.m_path} -- continue");
#endif
break;
case ExtSoftPathState.FailedHard:
#if DEBUG
if (debug)
Log._Debug($"CustomCarAI.CustomSimulationStep({vehicleId}): HARD path-finding failure for vehicle {vehicleId} (finalPathState={finalPathState}). Path: {vehicleData.m_path} -- calling CarAI.PathfindFailure");
#endif
vehicleData.m_flags &= ~Vehicle.Flags.WaitingPath;
Singleton<PathManager>.instance.ReleasePath(vehicleData.m_path);
vehicleData.m_path = 0u;
this.PathfindFailure(vehicleId, ref vehicleData);
return;
case ExtSoftPathState.FailedSoft:
#if DEBUG
if (debug)
Log._Debug($"CustomCarAI.CustomSimulationStep({vehicleId}): SOFT path-finding failure for vehicle {vehicleId} (finalPathState={finalPathState}). Path: {vehicleData.m_path} -- calling CarAI.InvalidPath");
#endif
// path mode has been updated, repeat path-finding
vehicleData.m_flags &= ~Vehicle.Flags.WaitingPath;
this.InvalidPath(vehicleId, ref vehicleData, vehicleId, ref vehicleData);
break;
}
// NON-STOCK CODE END
} else {
if ((vehicleData.m_flags & Vehicle.Flags.WaitingSpace) != 0) {
this.TrySpawn(vehicleId, ref vehicleData);
}
}
// NON-STOCK CODE START
#if BENCHMARK
using (var bm = new Benchmark(null, "UpdateVehiclePosition")) {
#endif
VehicleStateManager.Instance.UpdateVehiclePosition(vehicleId, ref vehicleData);
#if BENCHMARK
}
#endif
if (!Options.isStockLaneChangerUsed() && (vehicleData.m_flags & Vehicle.Flags.Spawned) != 0) {
#if BENCHMARK
using (var bm = new Benchmark(null, "LogTraffic")) {
#endif
// Advanced AI traffic measurement
VehicleStateManager.Instance.LogTraffic(vehicleId);
#if BENCHMARK
}
#endif
}
// NON-STOCK CODE END
Vector3 lastFramePosition = vehicleData.GetLastFramePosition();
int lodPhysics;
if (Vector3.SqrMagnitude(physicsLodRefPos - lastFramePosition) >= 1210000f) {
lodPhysics = 2;
} else if (Vector3.SqrMagnitude(Singleton<SimulationManager>.instance.m_simulationView.m_position - lastFramePosition) >= 250000f) {
lodPhysics = 1;
} else {
lodPhysics = 0;
}
this.SimulationStep(vehicleId, ref vehicleData, vehicleId, ref vehicleData, lodPhysics);
if (vehicleData.m_leadingVehicle == 0 && vehicleData.m_trailingVehicle != 0) {
VehicleManager vehManager = Singleton<VehicleManager>.instance;
ushort trailerId = vehicleData.m_trailingVehicle;
int numIters = 0;
while (trailerId != 0) {
ushort trailingVehicle = vehManager.m_vehicles.m_buffer[(int)trailerId].m_trailingVehicle;
VehicleInfo info = vehManager.m_vehicles.m_buffer[(int)trailerId].Info;
info.m_vehicleAI.SimulationStep(trailerId, ref vehManager.m_vehicles.m_buffer[(int)trailerId], vehicleId, ref vehicleData, lodPhysics);
trailerId = trailingVehicle;
if (++numIters > 16384) {
CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
break;
}
}
}
int privateServiceIndex = ItemClass.GetPrivateServiceIndex(this.m_info.m_class.m_service);
int maxBlockCounter = (privateServiceIndex == -1) ? 150 : 100;
if ((vehicleData.m_flags & (Vehicle.Flags.Spawned | Vehicle.Flags.WaitingPath | Vehicle.Flags.WaitingSpace)) == 0 && vehicleData.m_cargoParent == 0) {
Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleId);
} else if ((int)vehicleData.m_blockCounter >= maxBlockCounter) {
// NON-STOCK CODE START
bool mayDespawn = true;
#if BENCHMARK
using (var bm = new Benchmark(null, "MayDespawn")) {
#endif
mayDespawn = VehicleBehaviorManager.Instance.MayDespawn(ref vehicleData);
#if BENCHMARK
}
#endif
if (mayDespawn) {
// NON-STOCK CODE END
Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleId);
} // NON-STOCK CODE
}
}
public override bool TrySpawn(ushort vehicleId, ref Vehicle vehicleData) {
if ((vehicleData.m_flags & Vehicle.Flags.Spawned) != (Vehicle.Flags)0) {
return true;
}
if (CustomCarAI.CheckOverlap(vehicleData.m_segment, 0, 1000f)) {
vehicleData.m_flags |= Vehicle.Flags.WaitingSpace;
return false;
}
vehicleData.Spawn(vehicleId);
vehicleData.m_flags &= ~Vehicle.Flags.WaitingSpace;
return true;
}
public void CustomCalculateSegmentPosition(ushort vehicleId, ref Vehicle vehicleData, PathUnit.Position nextPosition,
PathUnit.Position prevPosition, uint prevLaneId, byte prevOffset, PathUnit.Position refPosition, uint refLaneId,
byte refOffset, int index, out Vector3 pos, out Vector3 dir, out float maxSpeed) {
var netManager = Singleton<NetManager>.instance;
ushort prevSourceNodeId;
ushort prevTargetNodeId;
if (prevOffset < prevPosition.m_offset) {
prevSourceNodeId = netManager.m_segments.m_buffer[prevPosition.m_segment].m_startNode;
prevTargetNodeId = netManager.m_segments.m_buffer[prevPosition.m_segment].m_endNode;
} else {
prevSourceNodeId = netManager.m_segments.m_buffer[prevPosition.m_segment].m_endNode;
prevTargetNodeId = netManager.m_segments.m_buffer[prevPosition.m_segment].m_startNode;
}
ushort refTargetNodeId;
if (refOffset == 0) {
refTargetNodeId = netManager.m_segments.m_buffer[(int)refPosition.m_segment].m_startNode;
} else {
refTargetNodeId = netManager.m_segments.m_buffer[(int)refPosition.m_segment].m_endNode;
}
#if DEBUG
bool debug = GlobalConfig.Instance.Debug.Switches[21] && (GlobalConfig.Instance.Debug.NodeId <= 0 || refTargetNodeId == GlobalConfig.Instance.Debug.NodeId) && (GlobalConfig.Instance.Debug.ExtVehicleType == ExtVehicleType.None || GlobalConfig.Instance.Debug.ExtVehicleType == ExtVehicleType.RoadVehicle) && (GlobalConfig.Instance.Debug.VehicleId == 0 || GlobalConfig.Instance.Debug.VehicleId == vehicleId);
if (debug) {
Log._Debug($"CustomCarAI.CustomCalculateSegmentPosition({vehicleId}) called.\n" +
$"\trefPosition.m_segment={refPosition.m_segment}, refPosition.m_offset={refPosition.m_offset}\n" +
$"\tprevPosition.m_segment={prevPosition.m_segment}, prevPosition.m_offset={prevPosition.m_offset}\n" +
$"\tnextPosition.m_segment={nextPosition.m_segment}, nextPosition.m_offset={nextPosition.m_offset}\n" +
$"\trefLaneId={refLaneId}, refOffset={refOffset}\n" +
$"\tprevLaneId={prevLaneId}, prevOffset={prevOffset}\n" +
$"\tprevSourceNodeId={prevSourceNodeId}, prevTargetNodeId={prevTargetNodeId}\n" +
$"\trefTargetNodeId={refTargetNodeId}, refTargetNodeId={refTargetNodeId}\n" +
$"\tindex={index}");
}
#endif
Vehicle.Frame lastFrameData = vehicleData.GetLastFrameData();
Vector3 lastFrameVehiclePos = lastFrameData.m_position;
float sqrVelocity = lastFrameData.m_velocity.sqrMagnitude;
netManager.m_lanes.m_buffer[prevLaneId].CalculatePositionAndDirection(prevOffset * 0.003921569f, out pos, out dir);
float braking = this.m_info.m_braking;
if ((vehicleData.m_flags & Vehicle.Flags.Emergency2) != (Vehicle.Flags)0) {
braking *= 2f;
}
// car position on the Bezier curve of the lane
var refVehiclePosOnBezier = netManager.m_lanes.m_buffer[refLaneId].CalculatePosition(refOffset * 0.003921569f);
//ushort currentSegmentId = netManager.m_lanes.m_buffer[prevLaneID].m_segment;
// this seems to be like the required braking force in order to stop the vehicle within its half length.
var crazyValue = 0.5f * sqrVelocity / braking + m_info.m_generatedInfo.m_size.z * 0.5f;
bool withinBrakingDistance = Vector3.Distance(lastFrameVehiclePos, refVehiclePosOnBezier) >= crazyValue - 1f;
if (prevSourceNodeId == refTargetNodeId && withinBrakingDistance) {
// NON-STOCK CODE START (stock code replaced)
#if BENCHMARK
using (var bm = new Benchmark(null, "MayChangeSegment")) {
#endif
//bool isRecklessDriver = VehicleStateManager.Instance.IsRecklessDriver(vehicleId, ref vehicleData); // NON-STOCK CODE
if (!VehicleBehaviorManager.Instance.MayChangeSegment(vehicleId, ref vehicleData, sqrVelocity, ref refPosition, ref netManager.m_segments.m_buffer[refPosition.m_segment], refTargetNodeId, refLaneId, ref prevPosition, prevSourceNodeId, ref netManager.m_nodes.m_buffer[prevSourceNodeId], prevLaneId, ref nextPosition, prevTargetNodeId, out maxSpeed)) { // NON-STOCK CODE
return;
} else {
#if BENCHMARK
using (var bm = new Benchmark(null, "UpdateVehiclePosition")) {
#endif
VehicleStateManager.Instance.UpdateVehiclePosition(vehicleId, ref vehicleData/*, lastFrameData.m_velocity.magnitude*/);
#if BENCHMARK
}
#endif
}
#if BENCHMARK
}
#endif
// NON-STOCK CODE END
}
var segmentInfo = netManager.m_segments.m_buffer[prevPosition.m_segment].Info;
if (segmentInfo.m_lanes != null && segmentInfo.m_lanes.Length > prevPosition.m_lane) {
// NON-STOCK CODE START
float laneSpeedLimit = 1f;
if (!Options.customSpeedLimitsEnabled) {
laneSpeedLimit = segmentInfo.m_lanes[prevPosition.m_lane].m_speedLimit;
} else {
laneSpeedLimit = Constants.ManagerFactory.SpeedLimitManager.GetLockFreeGameSpeedLimit(prevPosition.m_segment, prevPosition.m_lane, prevLaneId, segmentInfo.m_lanes[prevPosition.m_lane]);
}
// NON-STOCK CODE END
maxSpeed = CalculateTargetSpeed(vehicleId, ref vehicleData, laneSpeedLimit, netManager.m_lanes.m_buffer[prevLaneId].m_curve);
} else {
maxSpeed = CalculateTargetSpeed(vehicleId, ref vehicleData, 1f, 0f);
}
// NON-STOCK CODE START (stock code replaced)
maxSpeed = Constants.ManagerFactory.VehicleBehaviorManager.CalcMaxSpeed(vehicleId, ref VehicleStateManager.Instance.VehicleStates[vehicleId], this.m_info, prevPosition, ref netManager.m_segments.m_buffer[prevPosition.m_segment], pos, maxSpeed);
// NON-STOCK CODE END
}
public void CustomCalculateSegmentPositionPathFinder(ushort vehicleId, ref Vehicle vehicleData, PathUnit.Position position, uint laneId, byte offset, out Vector3 pos, out Vector3 dir, out float maxSpeed) {
var netManager = Singleton<NetManager>.instance;
netManager.m_lanes.m_buffer[laneId].CalculatePositionAndDirection(offset * 0.003921569f, out pos, out dir);
var segmentInfo = netManager.m_segments.m_buffer[position.m_segment].Info;
if (segmentInfo.m_lanes != null && segmentInfo.m_lanes.Length > position.m_lane) {
// NON-STOCK CODE START
float laneSpeedLimit = 1f;
if (!Options.customSpeedLimitsEnabled) {
laneSpeedLimit = segmentInfo.m_lanes[position.m_lane].m_speedLimit;
} else {
laneSpeedLimit = Constants.ManagerFactory.SpeedLimitManager.GetLockFreeGameSpeedLimit(position.m_segment, position.m_lane, laneId, segmentInfo.m_lanes[position.m_lane]);
}
// NON-STOCK CODE END
maxSpeed = CalculateTargetSpeed(vehicleId, ref vehicleData, laneSpeedLimit, netManager.m_lanes.m_buffer[laneId].m_curve);
} else {
maxSpeed = CalculateTargetSpeed(vehicleId, ref vehicleData, 1f, 0f);
}
// NON-STOCK CODE START
maxSpeed = VehicleBehaviorManager.Instance.CalcMaxSpeed(vehicleId, ref VehicleStateManager.Instance.VehicleStates[vehicleId], this.m_info, position, ref netManager.m_segments.m_buffer[position.m_segment], pos, maxSpeed);
// NON-STOCK CODE END
}
public bool CustomStartPathFind(ushort vehicleID, ref Vehicle vehicleData, Vector3 startPos, Vector3 endPos, bool startBothWays, bool endBothWays, bool undergroundTarget) {
#if DEBUG
bool vehDebug = GlobalConfig.Instance.Debug.VehicleId == 0 || GlobalConfig.Instance.Debug.VehicleId == vehicleID;
bool debug = GlobalConfig.Instance.Debug.Switches[2] && vehDebug;
bool fineDebug = GlobalConfig.Instance.Debug.Switches[4] && vehDebug;
if (debug)
Log.Warning($"CustomCarAI.CustomStartPathFind({vehicleID}): called for vehicle {vehicleID}, startPos={startPos}, endPos={endPos}, startBothWays={startBothWays}, endBothWays={endBothWays}, undergroundTarget={undergroundTarget}");
#endif
ExtVehicleType vehicleType = ExtVehicleType.None;
#if BENCHMARK
using (var bm = new Benchmark(null, "OnStartPathFind")) {
#endif
vehicleType = VehicleStateManager.Instance.OnStartPathFind(vehicleID, ref vehicleData, null);
if (vehicleType == ExtVehicleType.None) {
#if DEBUG
Log.Warning($"CustomCarAI.CustomStartPathFind({vehicleID}): Vehicle {vehicleID} does not have a valid vehicle type!");
#endif
vehicleType = ExtVehicleType.RoadVehicle;
}
#if BENCHMARK
}
#endif
VehicleInfo info = this.m_info;
bool allowUnderground = (vehicleData.m_flags & (Vehicle.Flags.Underground | Vehicle.Flags.Transition)) != 0;
PathUnit.Position startPosA;
PathUnit.Position startPosB;
float startDistSqrA;
float startDistSqrB;
PathUnit.Position endPosA;
PathUnit.Position endPosB;
float endDistSqrA;
float endDistSqrB;
if (CustomPathManager.FindPathPosition(startPos, ItemClass.Service.Road, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, allowUnderground, false, 32f, out startPosA, out startPosB, out startDistSqrA, out startDistSqrB) &&
CustomPathManager.FindPathPosition(endPos, ItemClass.Service.Road, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, undergroundTarget, false, 32f, out endPosA, out endPosB, out endDistSqrA, out endDistSqrB)) {
if (!startBothWays || startDistSqrA < 10f) {
startPosB = default(PathUnit.Position);
}
if (!endBothWays || endDistSqrA < 10f) {
endPosB = default(PathUnit.Position);
}
uint path;
// NON-STOCK CODE START
PathCreationArgs args;
args.extPathType = ExtCitizenInstance.ExtPathType.None;
args.extVehicleType = vehicleType;
args.vehicleId = vehicleID;
args.spawned = (vehicleData.m_flags & Vehicle.Flags.Spawned) != 0;
args.buildIndex = Singleton<SimulationManager>.instance.m_currentBuildIndex;
args.startPosA = startPosA;
args.startPosB = startPosB;
args.endPosA = endPosA;
args.endPosB = endPosB;
args.vehiclePosition = default(PathUnit.Position);
args.laneTypes = NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle;
args.vehicleTypes = info.m_vehicleType;
args.maxLength = 20000f;
args.isHeavyVehicle = this.IsHeavyVehicle();
args.hasCombustionEngine = this.CombustionEngine();
args.ignoreBlocked = this.IgnoreBlocked(vehicleID, ref vehicleData);
args.ignoreFlooded = false;
args.ignoreCosts = false;
args.randomParking = false;
args.stablePath = false;
args.skipQueue = (vehicleData.m_flags & Vehicle.Flags.Spawned) != 0;
if (CustomPathManager._instance.CreatePath(out path, ref Singleton<SimulationManager>.instance.m_randomizer, args)) {
#if DEBUG
if (debug)
Log._Debug($"CustomCarAI.CustomStartPathFind({vehicleID}): Path-finding starts for vehicle {vehicleID}, path={path}, extVehicleType={vehicleType}, startPosA.segment={startPosA.m_segment}, startPosA.lane={startPosA.m_lane}, info.m_vehicleType={info.m_vehicleType}, endPosA.segment={endPosA.m_segment}, endPosA.lane={endPosA.m_lane}");
#endif
// NON-STOCK CODE END
if (vehicleData.m_path != 0u) {
Singleton<PathManager>.instance.ReleasePath(vehicleData.m_path);
}
vehicleData.m_path = path;
vehicleData.m_flags |= Vehicle.Flags.WaitingPath;
return true;
}
}
return false;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static bool CheckOverlap(Segment3 segment, ushort ignoreVehicle, float maxVelocity) {
Log.Error("CustomCarAI.CheckOverlap called");
return false;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static ushort CheckOtherVehicle(ushort vehicleID, ref Vehicle vehicleData, ref Vehicle.Frame frameData, ref float maxSpeed, ref bool blocked, ref Vector3 collisionPush, float maxBraking, ushort otherID, ref Vehicle otherData, Vector3 min, Vector3 max, int lodPhysics) {
Log.Error("CustomCarAI.CheckOtherVehicle called");
return 0;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static ushort CheckCitizen(ushort vehicleID, ref Vehicle vehicleData, Segment3 segment, float lastLen, float nextLen, ref float maxSpeed, ref bool blocked, float maxBraking, ushort otherID, ref CitizenInstance otherData, Vector3 min, Vector3 max) {
Log.Error("CustomCarAI.CheckCitizen called");
return 0;
}
}
}