I'm trying to modify a locomotives behavior but I'm still inexperienced in how the lua-scripts are used by Train Simulator.
Many times a locomotive will have one main script such as "locomotive name script".lua and then in the Simulation folder there will also be a script. Are these divisions completely arbitrary or is there a general method of what will be controlled by the main script and what is controlled by the simulation-script?
I presumed that the main script would call the engine script/simulation script but looking inside the main script I don't see any reference so maybe it is the simulation blueprint that calls it?
Sorry if the question is too vague/general.
EDIT: I had a look around in the main script and the engine script (latter located in Simulation folder) and that answered my first question. The engine blueprint calls the main script and the simulation-blueprint calls the engine script.
Looking inside the main script I see very few references to TrainAirBrakeControl, actually the only reference/call is to set the train air brake to the initial application setting. I have some follow up questions instead:
1. If I want to program the throttle to decrease according to the tractive effort curve rather than the default way of controlling this with the tractiveeffortvsspeed table. For example to also implement a delay and implement field weakening effects. Would this be programmed inside the script file inside the simulation folder or main script, or is it up to my choice?
2. If I want to implement G-brake and P-brake slower application timings, is this something for the main script? I foresee that you could have a check for what the player sets the brake lever to and then call some function that slowly ups the virtual brake handle to this value.