diff --git a/Source/Orts.Simulation/Common/Events.cs b/Source/Orts.Simulation/Common/Events.cs index 58243b742..17b42cd4d 100644 --- a/Source/Orts.Simulation/Common/Events.cs +++ b/Source/Orts.Simulation/Common/Events.cs @@ -34,6 +34,7 @@ public enum Event PlayerTrainHelperLoco, PlayerTrainLeadLoco, StaticTrainLoco, + EndAITrainLeadLoco, BatterySwitchOff, BatterySwitchOn, BatterySwitchCommandOff, @@ -576,6 +577,7 @@ public static Event From(Source source, int eventID) case 334: return Event.AITrainApproachingStation; case 335: return Event.AITrainLeavingStation; case 336: return Event.StaticTrainLoco; + case 337: return Event.EndAITrainLeadLoco; default: return 0; } diff --git a/Source/Orts.Simulation/Simulation/Physics/Train.cs b/Source/Orts.Simulation/Simulation/Physics/Train.cs index 714b00bee..4764a5f4a 100644 --- a/Source/Orts.Simulation/Simulation/Physics/Train.cs +++ b/Source/Orts.Simulation/Simulation/Physics/Train.cs @@ -13849,7 +13849,11 @@ public void RedefineAITriggers() car.SignalEvent(Event.AITrainLeadLoco); leadFound = true; } - else car.SignalEvent(Event.AITrainHelperLoco); + else + { + car.SignalEvent(Event.AITrainHelperLoco); + car.SignalEvent(Event.EndAITrainLeadLoco); + } } } } @@ -13863,9 +13867,13 @@ public void RedefinePlayerTrainTriggers() Simulator.PlayerLocomotive.SignalEvent(Event.PlayerTrainLeadLoco); foreach (var car in Cars) { - if (car is MSTSLocomotive && car != Simulator.PlayerLocomotive) + if (car is MSTSLocomotive) { - car.SignalEvent(Event.PlayerTrainHelperLoco); + if (car != Simulator.PlayerLocomotive) + { + car.SignalEvent(Event.PlayerTrainHelperLoco); + } + car.SignalEvent(Event.EndAITrainLeadLoco); } } } @@ -13879,7 +13887,10 @@ public void RedefineStaticTrainTriggers() foreach (var car in Cars) { if (car is MSTSLocomotive) + { car.SignalEvent(Event.StaticTrainLoco); + car.SignalEvent(Event.EndAITrainLeadLoco); + } } }