Skip to content

Commit 4fd63a3

Browse files
authored
Merge pull request #927 from SteelFill/lights_bugfix
AI Train Power Supply/Lights Fix
2 parents 9cbbd6f + a28da45 commit 4fd63a3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Source/Orts.Simulation/Simulation/AIs/AI.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,12 +926,14 @@ public AITrain CreateAITrainDetail(Service_Definition sd, Traffic_Service_Defini
926926
mstsSteamLocomotive.TenderCoalMassKG = mstsSteamLocomotive.MaxTenderCoalMassKG * Simulator.Activity.Tr_Activity.Tr_Activity_Header.FuelCoal / 100.0f;
927927
}
928928

929-
if (train.InitialSpeed != 0)
930-
car.SignalEvent(PowerSupplyEvent.RaisePantograph, 1);
929+
if (train.InitialSpeed != 0 && car is MSTSLocomotive loco)
930+
loco.SetPower(true);
931931
}
932932
else
933933
{
934-
car.SignalEvent(PowerSupplyEvent.RaisePantograph, 1);
934+
if (car is MSTSLocomotive loco)
935+
loco.SetPower(true);
936+
935937
car.CarID = "AI" + train.Number.ToString() + " - " + (train.Cars.Count - 1).ToString();
936938
}
937939

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ public override void SwitchToPlayerControl()
13921392
public override void SwitchToAutopilotControl()
13931393
{
13941394
SetDirection(Direction.Forward);
1395-
if (!LocomotivePowerSupply.MainPowerSupplyOn)
1395+
if (!LocomotivePowerSupply.MainPowerSupplyOn || !LocomotivePowerSupply.BatteryOn || !LocomotivePowerSupply.MasterKey.On)
13961396
{
13971397
LocomotivePowerSupply.HandleEvent(PowerSupplyEvent.QuickPowerOn);
13981398
}

0 commit comments

Comments
 (0)