OlPaint wrote:PapaX
I just found MadMike's EMDX GP38-2 GM Demonstrator. It is a JCornell loco design repaint and it has shining loco lights. And MM has adopted the method of using ChildName Objects as the light emitters in the Children section of the ContainerComponent > cEntityContainerBlueprint section of the Engine blueprint code.
Bob Artim suggested that I copy the relevant code for the lights emitters from the source blueprint and paste into the appropriate section in the target blueprint. Could it be that easy? I guess I also need to know how to add the "behind the scenes" stuff that allows me to turn things on and off from the keyboard or HUD and also sense the loco direction, for example.
It is that simple... but you can add "more". You could add additional controls to the inputmapper, and trap the events in the LUA to control the ditch light children/nodes separately (something Mike and I did not do with most of our repaints). You can make it as complex as you want...
OlPaint wrote:I have noticed that each developer's design is a little different as well. Some turn both forward and backward headlights and ditch lights on and off together. Others turn the headlights on an off to match the direction of travel. Still others extinguish just the headlight on the end of the loco facing the consist when coupled up. So, each to his own, I guess. The rules are not evenly applied as I can see it. And there is no common naming convention followed for the light emitter objects in each particular design.
Correct. Everyone has their own style of coding, or adding parts to a model. If you follow along my work you will find that start out clunky and then refine my style as I gained experience. With the LUAs I am writing now for VRC I doubt you could tell they were writen by the same person

You will however find that I use a common convention with the parts I make, so they can be reused elsewhere. This helps so I don't have 50 scripts calling the refactored parts everywhere. I am big with reusing models and code where I can.
OlPaint wrote:When I study someone else's code, I like to look at several examples and try to recognize a common pattern that makes things work. That was how I was able to add Krellnut's Wagon Sounds, GreatNorthener's Couplers and JCornell's Coupler Sounds to all my rolling stock collection. So far the only common thing I have noticed is the adoption of the method for using ChildName light emitters for each of the loco lamps in the most recently released RSC Locomotive Pack's blueprints, particularly the GP38-2BnPack01 DLC.
If you are talking about headlights, then RSC has hard coded the game engine to look for specific child names so they can control them easier. The Fwd and Bwd headlights are an example (but the only example I believe).
OlPaint wrote:I have been looking at the series of Loco Enhancement Packs that Machinist and Krellnut have collaborated on . TandD Forum used to have Loco Enhancement Pack_v1 in their download library but the promised v2 update has become "vaporware". But I did happen to find Loco Enhancement Pack_v2 on NERW Forum, and I stumbled onto SD40-2 Enhancement Pack_v1, SD70 Enhancement_v1 and ES44 Enhancement_v1 in the RWA downloads. The confusing thing about each and every one of the Enhancement Packs' code changes show the "Shining Lights" are handled using a slightly different methodology. Even your UPY-588 shining light enhancement code is slightly different. For example, the "called out" light emitter ChildName objects do not reside at the same reference addresses in the assets directories! So you see, I can't seem to find a common thread to follow.
You will need to make your own path with all the knowledge given to you. I suggest you find someone's style that you are comfortable with, and translate everyone else's work as needed. In my case I already had a style as I am a programer by trade. What I needed to do is get a feel for the RW APIs before I could write my own LUAs from scratch.
OlPaint wrote:Edit:
Krellnut
Thanks for the suggestion to study Jessie's locos. I think I have a great many of his locos already installed. I will load each one up in the Editor on TestTrak and take a look-see.
Edit_2:
PapaX
Usually a loco has a common default blueprint shared by all its repaints for the Engine and CabView, at least. It would be cool if the a single Enhancement Pack could be applied to the Default that would carry over to all the repaints. It is just an addressing thing, correct?
I can dream, can't I???
OlPaint
Dreams are wonderful things... coding dreams can be a nightmare. I recommend you look to simplify your expectations or you will end up being annoyed and end up walking away from railworks. A unified enhancement pack is a pretty tall order.