Garek

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?

  • Like 2

Share this post


Link to post
Share on other sites
            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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now