Jump to content

Modify Engine Stats Through C#


Recommended Posts

I'm looking to create something that can change the stats of multiple engines (i.e. ISP, thrust). The way I'm trying to do it right now is to create a PartModule, attach it to all of the parts via a ModuleManager patch, and try to have this PartModule modify the engine stats at load time, but I'm not sure if I am going about it properly. I created an OnLoad override, and I am able to get the Engine module that is attached to the part, and I am iterating through the 'Fields' property of the engine module, but, the atmCurveIsp field has zero points, and useAtmCurveIsp is false. 

I understand I can accomplish this through ModuleManager alone, but I wanted to write some more complicated algorithms to calculate the updated engine stats. If anyone can point me in the correct direction, I would greatly appreciate it!

Link to comment
Share on other sites

On 4/21/2019 at 8:35 PM, zberry7 said:

I understand I can accomplish this through ModuleManager alone, but I wanted to write some more complicated algorithms to calculate the updated engine stats.

Do you absolutely need to run your "more complicated algorithms" at runtime within KSP? If the modifications that you want to make to the engine stats can be effected purely by changing the configs (directly or via MM) and don't need to override any of the methods in ModuleEngines, then one option is to write your algols in a separate program that will generate the required MM patch!

Link to comment
Share on other sites

On 4/21/2019 at 11:35 PM, zberry7 said:

I am able to get the Engine module that is attached to the part, and I am iterating through the 'Fields' property of the engine module, but, the atmCurveIsp field has zero points, and useAtmCurveIsp is false. 

I understand I can accomplish this through ModuleManager alone

If you're looking for Isp changing with atmosphere pressure then target atmosphereCurve{}. That's what everyone uses, and likely nobody uses atmCurveIsp{}.

Link to comment
Share on other sites

On ‎4‎/‎28‎/‎2019 at 1:04 PM, JadeOfMaar said:

If you're looking for Isp changing with atmosphere pressure then target atmosphereCurve{}. That's what everyone uses, and likely nobody uses atmCurveIsp{}.

I ended up finding a (probably worse) way to do it before everyone responded, I basically just subclassed ModuleEngines (and ModuleEngineFX), and overrode OnLoad, then I just modify the config node that's passed in as a parameter, and it works quite well. I used MM to switch all ModuleEngines with the subclassed version. So far its worked with all the mods I have tried it with. I basically just wanted to classify each engine at load time into categories like Upper/Lower/Sustainer/High Efficiency based on the original stats, so I can more accurately buff the stats so I can play RSS without RO

Edited by zberry7
Link to comment
Share on other sites

On 4/28/2019 at 6:04 PM, JadeOfMaar said:

If you're looking for Isp changing with atmosphere pressure then target atmosphereCurve{}. That's what everyone uses, and likely nobody uses atmCurveIsp{}.

Isn't atmCurveIsp for jet engines that vary with height?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...