Skip to content

Commit

Permalink
Provide transitory functionality for existing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarBLG committed Aug 26, 2022
1 parent 4b70d86 commit 757b1be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/Orts.Simulation/Simulation/Physics/Train.cs
Expand Up @@ -348,7 +348,7 @@ public TRAIN_CONTROL ControlMode
/// <summary>
/// Set when the train is out of control
/// </summary>
private TRAIN_CONTROL ControlModeBeforeOutOfControl = TRAIN_CONTROL.UNDEFINED;
public TRAIN_CONTROL ControlModeBeforeOutOfControl = TRAIN_CONTROL.UNDEFINED;

public enum OUTOFCONTROL
{
Expand Down
Expand Up @@ -539,7 +539,15 @@ public void Initialize()
CustomizedCabviewControlNames[id] = value;
}
};
Script.RequestToggleManualMode = () => Locomotive.Train.RequestToggleManualMode();
Script.RequestToggleManualMode = () =>
{
if (Locomotive.Train.ControlMode == Train.TRAIN_CONTROL.OUT_OF_CONTROL && Locomotive.Train.ControlModeBeforeOutOfControl == Train.TRAIN_CONTROL.EXPLORER)
{
Trace.TraceWarning("RequestToggleManualMode() is deprecated for explorer mode. Please use ResetOutOfControlMode() instead");
Locomotive.Train.ManualResetOutOfControlMode();
}
else Locomotive.Train.RequestToggleManualMode();
};
Script.ResetOutOfControlMode = () => Locomotive.Train.ManualResetOutOfControlMode();

// TrainControlSystem INI configuration file
Expand Down

0 comments on commit 757b1be

Please sign in to comment.