Reviving this thread as I have taken most of the ideas here and implemented them in a new set of lighting enhancements that will show up in unstable soon.
Highlights include:
- Multiple conditions! One light can now have multiple sets of conditions, and if any one condition is true, the light will activate. Very useful for a light that should activate in many contexts, but you don't want to copy-paste everywhere.
Previously you'd have to do something like this:
Light (
comment( Nose light bright )
Conditions (
Headlight ( 3 )
Unit ( 2 )
)
FadeIn ( 0.5 )
FadeOut ( 0.5 )
States ( 1
State (
LightColour ( FFffffe6 )
Radius ( 0.6 )
Position ( 0.0 4.12 6.55 )
)
)
)
Light (
comment( Nose light bright DPU )
Conditions (
Headlight ( 3 )
Unit ( 4 )
)
FadeIn ( 0.5 )
FadeOut ( 0.5 )
States ( 1
State (
LightColour ( FFffffe6 )
Radius ( 0.6 )
Position ( 0.0 4.12 6.55 )
)
)
)
But now, this has the exact same effect while reducing the number of lights the game has to process and saving lines of code:
Light (
comment( Nose light bright )
Conditions (
Headlight ( 3 )
Unit ( 2 )
)
Conditions (
Headlight ( 3 )
Unit ( 4 )
)
FadeIn ( 0.5 )
FadeOut ( 0.5 )
States ( 1
State (
LightColour ( FFffffe6 )
Radius ( 0.6 )
Position ( 0.0 4.12 6.55 )
)
)
)
Hope that will be useful, even though it's a strong deviation from MSTS.
- New light conditions (the topic of this thread, after all)! First one is the Brake condition. Handy for brake indicator lights on coaches. Valid settings are: Brake ( 0 ) -light ignores brakes, the default state Brake ( 1 ) -light will be enabled when the brakes are released Brake ( 2 ) -light will be enabled when the brakes are applied. Note that this is triggered based on the presence of friction brake force, dynamic brakes will not activate this type of light.
- Next is the often-discussed Reverser condition. I've found this one to be very useful, plenty of trains have lights that you'll want to change depending on the direction of travel. Note: for every single one of these conditions, the "0" setting is the "ignore" setting, so I'm not going to mention that every time. If you don't put the condition in (every condition is optional) then the "0" setting will be assumed the default. Settings for the Reverser are: Reverser ( 1 ) -light will be enabled if the direction is set forward Reverser ( 2 ) -light will be enabled if the direction is set reverse Reverser ( 3 ) -light will be enabled if the direction is set neutral Reverser ( 4 ) -light will be enabled in forward or reverse Reverser ( 5 ) -light will be enabled in forward or neutral Reverser ( 6 ) -light will be enabled in reverse or neutral
Note that a flipped loco/wagon will also automatically flip the sensed reverser setting, which is the behavior you'd probably want. Ie: if your locomotive is not flipped, but the locomotive at the end of your train is flipped (HST, Acela, ICE, stuff like that), setting the reverser forwards will cause the flipped locomotive at the other end of the train to detect the reverser is actually in reverse (and vice versa). I'm contemplating changing the name of this condition to "
Direction" as that better describes the behavior of the condition, but everyone here liked the idea of "reverser".
- A lot of passenger trains have lights that respond to the doors, so there's a Doors condition now. Doors ( 1 ) -light will be enabled if all doors are fully closed Doors ( 2 ) -light will be enabled if the left side doors are opening/opened/closing Doors ( 3 ) -light will be enabled if the right side doors are open Doors ( 4 ) -light will be enabled if doors on both sides are open at the same time Doors ( 5 ) -light will be enabled if either the left or the right side doors are open
- Then we have an often requested one, Horn, ideal for flashing ditch lights. When the horn is sounded, this condition will disable or enable lights depending on the setting used, and those lights will remain disabled or enabled for 30 seconds after the horn stops sounding. This 30 second timer can be changed with ORTSHornLightsTimer ( time ) in the engine () section of the .eng file. Unlike what some people have suggested, the timer does NOT go in the Lights () section! That just didn't make sense. Horn ( 1 ) -light will be enabled if the horn has not been sounded recently Horn ( 2 ) -light will be enabled if the horn has been sounded recently (or is sounding right now) Side note: if ORTSHornLightsTimer ( 0s ) is set, lights will activate in response to the horn but only while the horn is continuously sounded. I think some MBTA locomotives do this.
- Horn-enabled lights are somewhat common, but there are edge cases with bell enabled lights, so the Bell condition does the same sort of thing. The timer for the bell can also be set in the .eng file with ORTSBellLightsTimer ( time ), but it defaults to 0 seconds (lights only activated while the bell is currently ringing). Bell ( 1 ) -light will be enabled if the bell has not been rung recently Bell ( 2 ) -light will be enabled if the bell has been rung recently (or is ringing right now)
As a note for flashing ditch lights, the light set to represent the not-flashing state of the ditch light will need to use the Horn ( 1 )/Bell ( 1 ) condition, while the flashing version of the light (obviously) uses the Horn ( 2 )/Bell ( 2 ) condition. The not flashing state needs to use the "1" condition to ensure those lights are turned off when the horn/bell is used, otherwise both lights will overlap eachother. Here's an example configuration of the conditions for a ditch light:
Light (
comment( Right ditch light )
Conditions (
Headlight ( 3 )
Unit ( 2 )
Horn ( 1 )
)
States ( 1
State (
LightColour ( FFFFFFFF )
Radius ( r )
Position ( x y z )
)
)
)
Light (
comment( Right ditch light Flashing )
Conditions (
Headlight ( 3 )
Unit ( 2 )
Horn ( 2 )
)
States ( 2
State (
LightColour ( FFFFFFFF )
Radius ( r )
Transition ( 1 )
Duration ( 0.5 )
Position ( x y z )
)
State (
LightColour ( FFFFFFFF )
Radius ( r )
Transition ( 1 )
Duration ( 0.5 )
Position ( x y z )
)
)
)
- Finally, another odd but useful light condition, MU. I saw various ideas for this type of condition and came up with my own twist. The MU condition can be used to detect if the locomotive the light is attached to is the lead locomotive, is connected to the lead locomotive with no wagons/coaches in between, or is separated from the lead locomotive with wagons/coaches (ie: a distributed power unit). MU ( 1 ) -light will be enabled if attached to the lead locomotive itself MU ( 2 ) -light will be enabled if attached to a locomotive directly MU'd to the lead locomotive (will also activate if attached to the lead locomotive itself) MU ( 3 ) -light will be enabled if attached to a locomotive not directly MU'd to the lead locomotive (MU ( 3 ) will also always activate lights attached to a wagon)
I've found this setting very handy for representing that some lighting signals are sent over MU, and others are not. For example, the USA system does not send ditch light signals over MU, so I have ditch lights set to activate for MU ( 1 ), the lead locomotive. The system also doesn't send light signals over radio to remote locomotives, instead, when a DPU is added to the end of a train its light is manually set to dim, so I have the dim lights set up to remain on all the time for MU ( 3 ).
Now I have not investigated adding a secondary headlights switch as that goes beyond just changing the backend code to scan files for more settings. Maybe that's easy, but with the need to add new keybinds, look for more keyboard inputs, add cab view controls...I'm guessing it won't be a 5 minute coding adventure. Still, these new conditions dramatically increase the flexibility of lighting, even with just the off/dim/bright settings.
Also, a disclaimer if you want to use these conditions: I may need to change the names of these conditions and if that happens things will break. If you don't want things to break wait some weeks until this is 'done' and in the testing version.