|
10 | 10 | using OpenBveApi.Routes;
|
11 | 11 | using OpenBveApi.Runtime;
|
12 | 12 | using OpenBveApi.Trains;
|
| 13 | +using RouteManager2; |
13 | 14 | using RouteManager2.MessageManager;
|
14 | 15 | using RouteManager2.SignalManager;
|
15 | 16 | using RouteManager2.Stations;
|
@@ -1162,5 +1163,30 @@ public override void Couple(AbstractTrain Train, bool Front)
|
1162 | 1163 | string message = Translations.GetInterfaceString(HostApplication.OpenBve, Front ? new[] { "notification", "couple_front" } : new[] { "notification", "couple_rear" }).Replace("[number]", trainBase.Cars.Length.ToString());
|
1163 | 1164 | TrainManagerBase.currentHost.AddMessage(message, MessageDependency.None, GameMode.Normal, MessageColor.White, TrainManagerBase.CurrentRoute.SecondsSinceMidnight + 5.0, null);
|
1164 | 1165 | }
|
| 1166 | + |
| 1167 | + public void ContactSignaller() |
| 1168 | + { |
| 1169 | + Section sct = TrainManagerBase.CurrentRoute.Sections[CurrentSectionIndex].NextSection; |
| 1170 | + if (sct.Type != SectionType.PermissiveValueBased && sct.Type != SectionType.PermissiveIndexBased) |
| 1171 | + { |
| 1172 | + // not a valid section to access |
| 1173 | + string s = Translations.GetInterfaceString(HostApplication.OpenBve, new[] { "message", "signal_access_invalid" }); |
| 1174 | + } |
| 1175 | + else |
| 1176 | + { |
| 1177 | + if (sct.IsFree()) |
| 1178 | + { |
| 1179 | + // section is free of trains, so can be permissively accessed |
| 1180 | + string s = Translations.GetInterfaceString(HostApplication.OpenBve, new[] { "message", "signal_access_granted" }); |
| 1181 | + sct.SignallerPermission = true; |
| 1182 | + } |
| 1183 | + else |
| 1184 | + { |
| 1185 | + // not free, access denied |
| 1186 | + string s = Translations.GetInterfaceString(HostApplication.OpenBve, new[] { "message", "signal_access_denied" }); |
| 1187 | + sct.SignallerPermission = false; |
| 1188 | + } |
| 1189 | + } |
| 1190 | + } |
1165 | 1191 | }
|
1166 | 1192 | }
|
0 commit comments