I am designning a range extender which has mainly 2 parts: combustion engine and electric motor. The combustion engine powers up the electric motor, using regen to produce energy. Since BeamNG's powertrain doesn't allow us to connect 2 engine to 1 tree, I am using the rotator in the BeamNG to connect them. The system is working as I expected it is Init. However, once I pressed "R" to reset the vehicle, the power of the system reduces a lot. This won't happen if I use "CTRL+R" to reset. What's wrong with the system? How can I fix it? I would be appreciated to get the answer.
When you press 'R' to reset, this gets called: "onVehicleReset" (lua/vehicle/main.lua:425). This will reset everything, so I suppose that's why it reduces the power. You could maybe copy this file and put it in your mod and modify it a bit, but it could cause issues for you with future updates since you're overriding it. Another idea actually, I'm not exactly sure what's being reset, but in the "if not initCalled" scope, there's a bunch of resets. Figure out which one is causing the issue, and maybe override that specific extension.