Skip to content

Commit 4471c71

Browse files
committed
Automatic merge of T1.5.1-919-gf19642ebc and 15 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 1a5693d: Blueprint/train car operations UI window - Pull request #885 at d714b11: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #903 at 29f3d1a: Downloading route content (Github, zip) - Pull request #912 at f7b85e4: New Triple Valve Features Vol. 2 - Pull request #919 at 1a376fa: Added mouse wheel support for controls which can be moved by pressing t… - Pull request #923 at e0f3c55: Add curve squeal to route - Pull request #924 at 6c2c3cd: Default Asset Improvements - Pull request #925 at e3b1688: Fix brakeshoe force bug - Pull request #926 at 729e0b7: Lights Bugfixes
17 parents d699856 + f19642e + 3539862 + d00beb9 + f92de76 + 1a5693d + d714b11 + 6c0785b + 1f5ba4c + 5866028 + 29f3d1a + f7b85e4 + 1a376fa + e0f3c55 + 6c2c3cd + e3b1688 + 729e0b7 commit 4471c71

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/RunActivity/Viewer3D/Lights.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ bool UpdateState()
287287
// Should prevent some unneeded computation, but is a little messy. May revise in the future
288288

289289
// Headlight
290-
int newTrainHeadlight = !Car.Lights.IgnoredConditions[0] ? (Car.Train != null ? Car.Train.TrainType != Train.TRAINTYPE.STATIC ? leadLocomotiveCar.Headlight : 0 : 0) : 0;
290+
int newTrainHeadlight = !Car.Lights.IgnoredConditions[0] ? (Car.Train?.TrainType != Train.TRAINTYPE.STATIC ? (leadLocomotiveCar != null ? leadLocomotiveCar.Headlight : 2) : 0) : 0;
291291
// Unit
292292
bool locomotiveFlipped = leadLocomotiveCar != null && leadLocomotiveCar.Flipped;
293293
bool locomotiveReverseCab = leadLocomotive != null && leadLocomotive.UsingRearCab;
@@ -320,11 +320,11 @@ bool UpdateState()
320320
// Friction brakes, activation force is arbitrary
321321
bool newBrakeOn = !Car.Lights.IgnoredConditions[9] && Car.BrakeForceN > 250.0f;
322322
// Reverser: -1: reverse, 0: within 10% of neutral, 1: forwards. Automatically swaps if this car is reversed
323-
int newReverserState = !Car.Lights.IgnoredConditions[10] ? ((Car.Train.MUDirection == Direction.N || Math.Abs(Car.Train.MUReverserPercent) < 10.0f) ? 0 :
323+
int newReverserState = (!Car.Lights.IgnoredConditions[10] && Car.Train != null) ? ((Car.Train.MUDirection == Direction.N || Math.Abs(Car.Train.MUReverserPercent) < 10.0f) ? 0 :
324324
Car.Train.MUDirection == Direction.Forward ? 1 : -1) * (Car.Flipped ? -1 : 1) : 0;
325325
// Passenger doors
326-
bool newLeftDoorOpen = !Car.Lights.IgnoredConditions[11] && Car.Train.DoorState(DoorSide.Left) != DoorState.Closed;
327-
bool newRightDoorOpen = !Car.Lights.IgnoredConditions[11] && Car.Train.DoorState(DoorSide.Right) != DoorState.Closed;
326+
bool newLeftDoorOpen = !Car.Lights.IgnoredConditions[11] && Car.Train?.DoorState(DoorSide.Left) != DoorState.Closed;
327+
bool newRightDoorOpen = !Car.Lights.IgnoredConditions[11] && Car.Train?.DoorState(DoorSide.Right) != DoorState.Closed;
328328
// Horn and bell (for flashing ditch lights)
329329
bool newHornOn = !Car.Lights.IgnoredConditions[12] && leadLocomotive != null && leadLocomotive.HornRecent;
330330
bool newBellOn = !Car.Lights.IgnoredConditions[13] && leadLocomotive != null && leadLocomotive.BellRecent;

0 commit comments

Comments
 (0)