Skip to content

Commit 431da5a

Browse files
committed
Automatic merge of T1.5.1-1846-g8b64986df and 13 pull requests
- Pull request #570 at 362e4e7: glTF 2.0 support with PBR lighting - Pull request #1062 at 9a76b26: Train Forces popup Window. - Pull request #1064 at 1be1fc4: Add Train Info tab to Help window (F1) - Pull request #1074 at e9a66c1: Gradient - commit 2024-16-12 - Pull request #1085 at 37e2817: updates key commands for Train Operations window and also Daylight Offset - Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1087 at 1f64f02: Improve warning message for signal location mismatch. - Pull request #1088 at 4b3fa4c: Preserve previous log file. - Pull request #1089 at d750bd1: Fix Superelevation on Rigid Frame Rolling Stock Again - Pull request #1090 at 33d2582: Add null check to avoid crash on corrupt signal files - Pull request #1092 at 18238f4: Adds $req, depart-early and passing -time to Manual - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification
15 parents f2ced7f + 8b64986 + 362e4e7 + 9a76b26 + 1be1fc4 + e9a66c1 + 37e2817 + e10390b + 1f64f02 + 4b3fa4c + d750bd1 + 33d2582 + 18238f4 + 5845a1a + 689494b commit 431da5a

File tree

15 files changed

+1414
-123
lines changed

15 files changed

+1414
-123
lines changed

Source/Documentation/Manual/timetable.rst

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ final location).
237237
If both arrival and departure time are to be defined, these must be separated by
238238
'-'.
239239

240+
A request stop is set in a timetable by placing a 'x' between hours and minutes, e.g. 13x21, or by just
241+
setting an 'x' in the station departure field.
242+
For a request stop to work properly, details for this stop must be specified using :ref:`the '$req' command <timetable-cmd-request-stop>`.
243+
244+
In a timetable, it is indicated that a :ref:`train is allowed to depart early <timetable-depart-early>` by placing a '*'' between hours and
245+
minutes, e.g. 17*23, or by setting just a '*' in the station departure field.
246+
247+
A :ref:`passing time <timetable-passing-time>` can be defined by placing a 'P' between hours and minutes, e.g. 14P53
248+
240249
Additional :ref:`timing commands <timetable-timing>` can be included. Such
241250
commands can also be set for locations where the train does not stop and
242251
therefore has no timing details, but the train must pass through that location
@@ -1077,6 +1086,172 @@ junction somewhere beyond that station.
10771086
Will activate the train as indicated, either when the train starts, when the
10781087
train is at the indicated stop or when it is terminated.
10791088

1089+
.. _timetable-cmd-request-stop:
1090+
1091+
``$req`` Request Stop
1092+
1093+
A request stop is set in a timetable by placing an 'x' between hours and minutes, e.g. 13x21, or by just
1094+
setting an 'x' in the station departure field.
1095+
For a request stop to work properly, details for this stop must be specified using the ``$req`` command.
1096+
This command can be set as command for the station, or as command for each individual train. If set
1097+
for both station and train, the setting for the train will overrule the setting for the station for that
1098+
particular train.
1099+
Also, a special signal is required to set further required details, and also to visualize the requirement
1100+
to stop to pick up passengers for the player train.
1101+
1102+
Definition for ``$req`` command : $req /pu=n /pd=n [/laststop | /approach] [/message | /sound]
1103+
1104+
Details :
1105+
1106+
``/pu=n`` : probability that stop is required to pick up passengers, n is percentage, 0 <= n <= 99.
1107+
1108+
``/pd=n`` : probability that stop is required to set down passengers, n is percentage, 0 <= n <= 99.
1109+
1110+
``/laststop`` : message is displayed at last fixed stop, indicating if stop at request stop is required
1111+
to set down passengers. Note that message is always displayed, indicating that stop is required, or not.
1112+
1113+
``/approach`` : message is displayed, or sound is played, at preset fixed distance from stop if
1114+
request stop is required to set down passengers. Note that no indication if given if stop is not required.
1115+
1116+
``/message`` : message is displayed on approach if stop is required. Only valid if ``/approach`` is set.
1117+
1118+
``/sound`` : sound is played on approach if stop is required. Only valid if ``/approach`` is set.
1119+
1120+
1121+
Definition for special signal
1122+
1123+
Signals must be placed next to the platform. This signal may be any type of signal except NORMAL.
1124+
At least one signal is required for each direction.
1125+
A special function must be used for this signal in the related script :
1126+
1127+
1128+
TRAIN_HAS_REQUEST_STOP()
1129+
1130+
This function will return 'true' if approaching train is to stop at the request stop in order to set down
1131+
passengers, otherwise it returns 'false'.
1132+
Using this function, the state of the signal can be set as required. The signal can be visualized as an
1133+
actual signal, but also, for instance, a passenger figure can be animated to be visual on the plaƞorm
1134+
if the train is to stop, and otherwise not be visual.
1135+
1136+
Apart from this function, the signal must set two variables :
1137+
1138+
``ORTSReqStopVisDistance`` : distance from station at which AI train is assumed to be able to
1139+
'see' if stop is required to pick up passengers.
1140+
1141+
``ORTSReqStopAnnDistance`` : distance from station at which message is displayed or sound is
1142+
played if ``/approach`` is set in ``$req`` command.
1143+
1144+
Functionality
1145+
1146+
Based on the values of ``/pu`` and ``/pd``, it is determined if a request stop is required, either to set down
1147+
or to pick up passengers.
1148+
1149+
If the train is stopped and a departure time is set, the train will depart at the defined departure time
1150+
or after the defined station dwell time has passed, whichever is the latest time.
1151+
1152+
If the train is stopped and no departure time is set, the train will depart after the station dwell time
1153+
has passed.
1154+
1155+
Note that if a stop is not required, the train may pass through the station without stopping even if it
1156+
passes before the defined departure time.
1157+
1158+
Player train
1159+
1160+
Set down.
1161+
1162+
If ``/laststop`` is set, a message is shown at the moment of departure from the last fixed stop before
1163+
one or more request stops, which indicate, per stop, if the stop is required to set down passengers.
1164+
Note that the message is always shown.
1165+
1166+
If ``/approach`` is set, a message is shown or a sound is played when the train has reached the distance
1167+
from the request stop as defined in the signal definition using the ``ORTSReqStopAnnDistance``
1168+
variable. Note that in this situation, the message is displayed or the sound is played only if the
1169+
request stop is required.
1170+
1171+
Pick Up
1172+
1173+
If a stop is required to pick up, this is visualized by the state of the special signal. It is up to the player
1174+
to approach the station at such a speed that a proper stop can be made in time if required. There is
1175+
no other indication of the state of this signal than the visualization, the state is not shown if the Track
1176+
Monitor window or otherwise.
1177+
1178+
Display in Next Station Window
1179+
1180+
A request stop will be shown in the next station window with an 'x' displayed in the arrival and
1181+
departure times. When the stop was required, normal arrival and departure times are shown for
1182+
previous stop. If the stop was not required and the train passed through the station, then when the
1183+
train has indeed cleared the station, that station is shown as previous stop but no arrival time is
1184+
shown, and the departure time is set to 'skipped'.
1185+
1186+
Spoiler
1187+
1188+
A 'spoiler' indication which shows if the stop is required to set down or pick up, can be shown if the
1189+
Next Station Window is displayed (normally using key F10), by pressing keys ALT+F10.
1190+
1191+
When ALT+F10 is pressed, and the next station is a request stop, a line is displayed at the boƩom of
1192+
the window showing if stop is required or not.
1193+
1194+
NOTE : this spoiler function is not yet available and will be included later.
1195+
1196+
Sound
1197+
1198+
When a sound is to be played on approach, as defined in the ``$req`` command, the definition for this
1199+
sound must be included in the .sms sound file for the cab for the locomotive on the player train.
1200+
1201+
The trigger for this sound is trigger 270.
1202+
1203+
AI Train
1204+
1205+
An AI train will approach the station as any normal station. When the stop is required, the train will
1206+
stop as normal. When no stop is required at all, the train will cease to slow down for the approach
1207+
when it has reached the distance from the station as defined in the signal variable
1208+
``ORTSReqStopVisDistance``, and will then start to accelerate again to regain to normal speed.
1209+
1210+
.. _timetable-depart-early:
1211+
1212+
Allow Depart Early
1213+
1214+
In a timetable, it is indicated that a train is allowed to depart early by placing a '*' between hours and
1215+
minutes, e.g. 17*23, or by setting just a '*' in the station departure field.
1216+
1217+
Functionality
1218+
1219+
Player Train
1220+
1221+
When a player train is allowed to depart early, the normal departure indication is given as soon as
1222+
the train has been stopped at the station for the normal required stop time as set for that station,
1223+
and the route ahead is clear.
1224+
1225+
Display in Next Station Window.
1226+
1227+
When “allow depart early” has been set for a station, a '*' is shown in the departure time. When the
1228+
train has departed, the '*' is also shown in the departure time for previous station stop.
1229+
1230+
AI Train
1231+
1232+
When an AI train is allowed to depart early, the train will depart as soon as the train has been
1233+
stopped at the station for the normal required stop time as set for that station, and the route ahead
1234+
is clear.
1235+
1236+
.. _timetable-passing-time:
1237+
1238+
Passing Time
1239+
1240+
Passing time can be defined by placing a 'P' between hours and minutes, e.g. 14P53.
1241+
1242+
Functionality
1243+
1244+
Player Train
1245+
1246+
When a passing time is set, the station will be shown in the NextStationWindow as a normal stop,
1247+
but showing a departure time only. When the station is passed, the actual passing time is also shown
1248+
as normal, but also a departure time only.
1249+
1250+
AI Train
1251+
1252+
There is no processing of passing time for AI trains.
1253+
1254+
10801255
.. _timetable-start:
10811256

10821257
Start Commands

Source/Orts.Formats.Msts/SignalConfigurationFile.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,15 @@ public class SignalType
582582
public int NumClearAhead_ORTS { get; private set; }
583583
/// <summary>Number of seconds to spend animating a semaphore signal.</summary>
584584
public float SemaphoreInfo { get; private set; }
585+
586+
/// <summary> approach control details
585587
public ApproachControlLimits ApproachControlDetails;
586588

589+
/// <summary> visibility distance for request stop pick up
590+
public float? ReqStopVisDistance;
591+
/// <summary> announce distance for request stop set down
592+
public float? ReqStopAnnDistance;
593+
587594
/// <summary> Glow value for daytime (optional).</summary>
588595
public float? DayGlow = null;
589596
/// <summary> Glow value for nighttime (optional).</summary>
@@ -640,6 +647,8 @@ public SignalType(STFReader stf, bool ortsMode, IDictionary<string, SignalFuncti
640647
new STFReader.TokenProcessor("signaldrawstates", ()=>{ DrawStates = ReadDrawStates(stf); }),
641648
new STFReader.TokenProcessor("signalaspects", ()=>{ Aspects = ReadAspects(stf); }),
642649
new STFReader.TokenProcessor("approachcontrolsettings", ()=>{ ApproachControlDetails = ReadApproachControlDetails(stf); }),
650+
new STFReader.TokenProcessor("ortsreqstopvisdistance", ()=>{ReqStopVisDistance = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),
651+
new STFReader.TokenProcessor("ortsreqstopanndistance", ()=>{ReqStopAnnDistance = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),
643652
new STFReader.TokenProcessor("signalnumclearahead", ()=>{ numClearAhead = numClearAhead >= -1 ? numClearAhead : stf.ReadIntBlock(null); numdefs++;}),
644653
new STFReader.TokenProcessor("semaphoreinfo", ()=>{ SemaphoreInfo = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),
645654
new STFReader.TokenProcessor("ortsdayglow", ()=>{ DayGlow = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),

Source/Orts.Formats.Msts/SignalScripts.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public enum SCRExternalFunctions
113113
NEXT_SIG_HASNORMALSUBTYPE,
114114
ID_SIG_HASNORMALSUBTYPE,
115115
SWITCHSTAND,
116+
TRAIN_HAS_REQUEST_STOP,
116117
DEBUG_HEADER,
117118
DEBUG_OUT,
118119
RETURN,

Source/Orts.Simulation/Common/Events.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ public enum Event
288288
CruiseControlAlert,
289289
CruiseControlAlert1,
290290

291+
// request stop
292+
RequestStopAnnounce,
293+
291294
MPCChangePosition,
292295

293296
}
@@ -566,6 +569,8 @@ public static Event From(Source source, int eventID)
566569
case 262: return Event.WindowsClosed;
567570
case 263: return Event.WindowsOpen;
568571

572+
case 270: return Event.RequestStopAnnounce;
573+
569574
// Cruise Control
570575
case 298: return Event.LeverFromZero;
571576
case 299: return Event.LeverToZero;

Source/Orts.Simulation/Simulation/AIs/AITrain.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,7 +1994,10 @@ public virtual void UpdateStationState(float elapsedClockSeconds, int presentTim
19941994

19951995
// Depart
19961996
thisStation.Passed = true;
1997-
Delay = TimeSpan.FromSeconds((presentTime - thisStation.DepartTime) % (24 * 3600));
1997+
if (thisStation.ArrivalTime >= 0)
1998+
{
1999+
Delay = TimeSpan.FromSeconds((presentTime - thisStation.DepartTime) % (24 * 3600));
2000+
}
19982001
PreviousStop = thisStation.CreateCopy();
19992002

20002003
if (thisStation.ActualStopType == StationStop.STOPTYPE.STATION_STOP
@@ -2060,7 +2063,6 @@ public virtual void UpdateStationState(float elapsedClockSeconds, int presentTim
20602063
MovementState = AI_MOVEMENT_STATE.STOPPED_EXISTING;
20612064
if (TrainType != TRAINTYPE.AI_PLAYERHOSTING) AtStation = false;
20622065
}
2063-
20642066
Delay = TimeSpan.FromSeconds((presentTime - thisStation.DepartTime) % (24 * 3600));
20652067
}
20662068
if (Cars[0] is MSTSLocomotive) Cars[0].SignalEvent(Event.AITrainLeavingStation);

0 commit comments

Comments
 (0)