Make the Hydrogen Engine sound depend on load
Submitted
I find it a bit odd that the hydrogen engine just keeps on going at the same RPM, regardless of whether it's powering a light bulb or a small factory. Sure, it's technically possible, but wouldn't it be much cooler if you could hear if the engine is idling or struggling? Even more so when talking rovers and other vehicles.
I have made a patch that does this. It is done similarly to other blocks that have similar features (MyMotorBase and MyMotorSuspension) and should be possible to integrate without much effort. The patch was made as an extension class and requires some minor adaptions to fit. I can do it upon request, but I will not be able to test it.
Files:
MyHydrogenEngin...
There is something that I have not mentioned: When going out of range of the audio, the block stops updating on tick. Therefore, we must mark it for update, perhaps in UpdateBeforeSimulation100. I did it in UpdateAfterSimulation100 because it was easier to patch but UpdateBeforeSimulation100 would be more consistent with other classes. I'm not sure this is the best way to do it, but it works.
Oh, and don't mind that "true ||" on line 28 in the previously attached file. It's an artifact that slipped through after testing.
There is something that I have not mentioned: When going out of range of the audio, the block stops updating on tick. Therefore, we must mark it for update, perhaps in UpdateBeforeSimulation100. I did it in UpdateAfterSimulation100 because it was easier to patch but UpdateBeforeSimulation100 would be more consistent with other classes. I'm not sure this is the best way to do it, but it works.
Oh, and don't mind that "true ||" on line 28 in the previously attached file. It's an artifact that slipped through after testing.
The hydrogen engines are power generators with a constant output, not motors like a common gasoline engine. They don't struggle or idle, but work in a steady pace all the time.
The hydrogen engines are power generators with a constant output, not motors like a common gasoline engine. They don't struggle or idle, but work in a steady pace all the time.
Replies have been locked on this page!