mirror of
https://github.com/rmroc451/TweaksAndThings.git
synced 2025-12-18 02:09:37 -06:00
#27 fix issue with last car end gear issue detection
This commit is contained in:
@@ -12,10 +12,14 @@ namespace RMROC451.TweaksAndThings.Extensions;
|
|||||||
|
|
||||||
public static class Car_Extensions
|
public static class Car_Extensions
|
||||||
{
|
{
|
||||||
|
private static bool EndGearIssue(this Car car, Car.LogicalEnd end) =>
|
||||||
|
(!car[end].IsCoupled && car[end].IsAnglecockOpen) ||
|
||||||
|
(car[end].IsCoupled && !car[end].IsAirConnectedAndOpen);
|
||||||
|
|
||||||
public static bool EndAirSystemIssue(this Car car)
|
public static bool EndAirSystemIssue(this Car car)
|
||||||
{
|
{
|
||||||
bool AEndAirSystemIssue = car[Car.LogicalEnd.A].IsCoupled && !car[Car.LogicalEnd.A].IsAirConnectedAndOpen;
|
bool AEndAirSystemIssue = car.EndGearIssue(Car.LogicalEnd.A);
|
||||||
bool BEndAirSystemIssue = car[Car.LogicalEnd.B].IsCoupled && !car[Car.LogicalEnd.B].IsAirConnectedAndOpen;
|
bool BEndAirSystemIssue = car.EndGearIssue(Car.LogicalEnd.B);
|
||||||
bool EndAirSystemIssue = AEndAirSystemIssue || BEndAirSystemIssue;
|
bool EndAirSystemIssue = AEndAirSystemIssue || BEndAirSystemIssue;
|
||||||
return EndAirSystemIssue;
|
return EndAirSystemIssue;
|
||||||
}
|
}
|
||||||
@@ -107,15 +111,15 @@ public static class Car_Extensions
|
|||||||
List<(string carId, float distance)> source =
|
List<(string carId, float distance)> source =
|
||||||
cars
|
cars
|
||||||
.Select(carId =>
|
.Select(carId =>
|
||||||
|
{
|
||||||
|
Car car = tc.CarForId(carId);
|
||||||
|
if (car == null || !car.CabooseWithSufficientCrewHours(timeNeeded, carIdsCheckedAlready))
|
||||||
{
|
{
|
||||||
Car car = tc.CarForId(carId);
|
return (carId: carId, distance: 1000f);
|
||||||
if (car == null || !car.CabooseWithSufficientCrewHours(timeNeeded, carIdsCheckedAlready))
|
}
|
||||||
{
|
Vector3 a = WorldTransformer.WorldToGame(car.GetMotionSnapshot().Position);
|
||||||
return (carId: carId, distance: 1000f);
|
return (carId: carId, distance: Vector3.Distance(a, center));
|
||||||
}
|
}).ToList();
|
||||||
Vector3 a = WorldTransformer.WorldToGame(car.GetMotionSnapshot().Position);
|
|
||||||
return (carId: carId, distance: Vector3.Distance(a, center));
|
|
||||||
}).ToList();
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user