Jump to content

How to change the IVA in the VAB (or at launch)


Recommended Posts

So I'm trying to extend the PartVariant Sytem to IVAs via EXTRA_INFO and my own PartModule.

So far I managed to grab that EXTRA_INFO when changing variants in the editor and persisting it to flight. I also manged to get rid of the regular IVA when spawning in flight by doing:

part.internalModel.gameObject.DestroyGameObject();
part.internalModel = null;

What I'm still stuck on is

  1. how to set the new IVA?
    1. part.internalModelName seems to be ignored, regardless of when I set it
    2. part.AddInternalPart(<ConfigNode>)... even if that were the right option, what kind of ConfigNode would I feed it?
  2. how to make that IVA then appear. I tried some combinations of CreateInternalModel, SpawnIVA and internalModel.Initialize, but that didn't seem to do anything. Might be related to 1., but I don't see KSP complaining about not finding the IVA in the log.

Anyone got any ideas?

Link to post
Share on other sites
  • 5 weeks later...
            if (part.internalModel == null && part.partInfo != null)
            {
                ConfigNode getIVA = (from cfg in GameDatabase.Instance.GetConfigs("PART")
                    where cfg.url == part.partInfo.partUrl
                    select cfg.config.GetNode("INTERNAL")).FirstOrDefault();
                if (getIVA != null)
                    part.internalModel = part.AddInternalPart(getIVA);
            }

 

Edited by DennyTX
Link to post
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...