Skip to content

Commit 4263b21

Browse files
committed
Add locomotive status to driving info
1 parent b429cf5 commit 4263b21

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSControlTrailerCar.cs

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,45 @@ public override void Update(float elapsedClockSeconds)
218218
public override string GetStatus()
219219
{
220220
var status = new StringBuilder();
221-
if (HasGearController)
222-
status.AppendFormat("{0} = {1}\n", Simulator.Catalog.GetString("Gear"),
223-
ControlGearIndex < 0 ? Simulator.Catalog.GetParticularString("Gear", "N") : (ControlGearIndication).ToString());
224-
status.AppendLine();
225221
status.AppendFormat("{0} = {1}\n",
226222
Simulator.Catalog.GetString("Battery switch"),
227223
LocomotivePowerSupply.BatterySwitch.On ? Simulator.Catalog.GetString("On") : Simulator.Catalog.GetString("Off"));
228224
status.AppendFormat("{0} = {1}\n",
229225
Simulator.Catalog.GetString("Master key"),
230226
LocomotivePowerSupply.MasterKey.On ? Simulator.Catalog.GetString("On") : Simulator.Catalog.GetString("Off"));
227+
if (ControlActiveLocomotive != null)
228+
{
229+
status.AppendLine();
230+
if (ControlActiveLocomotive is MSTSElectricLocomotive electric)
231+
{
232+
status.AppendFormat("{0} = ", Simulator.Catalog.GetString("Pantographs"));
233+
foreach (var pantograph in electric.Pantographs.List)
234+
status.AppendFormat("{0} ", Simulator.Catalog.GetParticularString("Pantograph", GetStringAttribute.GetPrettyName(pantograph.State)));
235+
status.AppendLine();
236+
status.AppendFormat("{0} = {1}\n",
237+
Simulator.Catalog.GetString("Circuit breaker"),
238+
Simulator.Catalog.GetParticularString("CircuitBreaker", GetStringAttribute.GetPrettyName(electric.ElectricPowerSupply.CircuitBreaker.State)));
239+
}
240+
else if (ControlActiveLocomotive is MSTSDieselLocomotive diesel)
241+
{
242+
status.AppendLine();
243+
status.AppendFormat("{0} = {1}\n", Simulator.Catalog.GetString("Engine"),
244+
Simulator.Catalog.GetParticularString("Engine", GetStringAttribute.GetPrettyName(diesel.DieselEngines[0].State)));
245+
if (HasGearController)
246+
status.AppendFormat("{0} = {1}\n", Simulator.Catalog.GetString("Gear"),
247+
ControlGearIndex < 0 ? Simulator.Catalog.GetParticularString("Gear", "N") : (ControlGearIndication).ToString());
248+
status.AppendFormat("{0} = {1}\n",
249+
Simulator.Catalog.GetString("Traction cut-off relay"),
250+
Simulator.Catalog.GetParticularString("TractionCutOffRelay", GetStringAttribute.GetPrettyName(diesel.DieselPowerSupply.TractionCutOffRelay.State)));
251+
}
252+
status.AppendFormat("{0} = {1}\n",
253+
Simulator.Catalog.GetString("Electric train supply"),
254+
ControlActiveLocomotive.LocomotivePowerSupply.ElectricTrainSupplySwitch.On ? Simulator.Catalog.GetString("On") : Simulator.Catalog.GetString("Off"));
255+
status.AppendLine();
256+
status.AppendFormat("{0} = {1}",
257+
Simulator.Catalog.GetParticularString("PowerSupply", "Power"),
258+
Simulator.Catalog.GetParticularString("PowerSupply", GetStringAttribute.GetPrettyName(ControlActiveLocomotive.LocomotivePowerSupply.MainPowerSupplyState)));
259+
}
231260
return status.ToString();
232261
}
233262

0 commit comments

Comments
 (0)