Jump to content

Referencing another Mod (not part modules)


Recommended Posts

Hello!

I have a question. I'm trying to improve a mod's compatibility with @RoverDude's USI Life Support. Part of this mod will sometimes move kerbals into orbit and back without notifying USI Life Support, which is what I'm trying to address. Some problems with habitation time seem to arise when Kerbals are simply moved onto a vessel in orbit (as the information in USILS isn't updated accordingly), so I was trying to find a way to modify information concerning when kerbals were last at home. 

 

I've stumbled my way through some baby steps and found out how to determine if USI Life Support is loaded:

                    bool USILSActive = false;
                    AssemblyLoader.LoadedAssembly usilsAsm = null;

                    foreach (AssemblyLoader.LoadedAssembly Asm in AssemblyLoader.loadedAssemblies)
                    {
                        if (Asm.dllName == "USILifeSupport")
                        {
                            USILSActive = true;
                            usilsAsm = Asm;
                        }
                    }

This appears to work, but I'm not sure how to proceed from here. I know the config node where the settings are stored in the persistence file, but being unfamiliar with the environment, I'm not sure how to go about modifying and saving that information. Can I access it through Highlogic->currentgame->config->getnode? Or do I need to look elsewhere?

I guess I need to know more about how KSP stores it's information. So once config nodes are loaded into memory, where are they? If I find them, can I simply modify them and expect USI Life Support to pick up the changes? If not, I presume I will have to tell USI Life Support directly about what's happening and alter some of the information held within it's objects, and I'm not sure how to go about that. I've read some posts on working with part modules from other mods, but nothing like this. 

Could anyone provide some input please?

Link to comment
Share on other sites

Modifying a config node of another mod in game will probably have bad results. If the mod is written to protect its data you won't be able to anyway without using dirty reflection.

you would be much better off approaching the mod author to discuss what you are trying to do first.

in this case @RoverDude

Link to comment
Share on other sites

You're right, and I suspected that might be the case. I don't want to go diving into another mod's data if I don't have to. 

In situations where I would like to utilise another mod's capabilities without introducing a hard dependency, how would I go about doing so without going through parts? I've read this thread but it looks like it operates on parts. It's possible I'm just confused after chasing this down all day. 

 

I'll raise an issue with RoverDude on his USI-LS page. Cheers JPLRepo.

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...