Jump to content

[SOLVED] How to toggle "stagingEnabled" with plugin code? Answer: you don't need to


Recommended Posts

Hi, all, 

Still working on my LES plugin here.  I'd like to give users the option to jettison the LES either with a command from an action group, or by staging the decoupler and jettison engine.

        // is LES jettison action stage-able?
        [KSPField(isPersistant = true, guiActive = false, guiActiveEditor = true, guiName = "Jettison is staged?" ), 
         UI_Toggle(disabledText = "No", enabledText = "Yes")]
        bool isJettisonStageable = false;

and then I have code called in OnStart that goes and finds the relevant ModuleDecouple on the part and calls the following, passing isJettisonStageable to the method:

        internal void SetDecoupleStaged(bool isStaged)
        {
            if (_escapeDecoupler != null)
            {
                _escapeDecoupler.SetStaging(isStaged);
                Debug.Log(string.Format("{0} set Decoupler.IsStageable to {1}", _myModTag, _escapeDecoupler.IsStageable()));
            }
        }

 

However, when I switch it to "Yes" or load a craft that has the part with it set to "Yes"  the decoupler does not appear in the staging menu.

What do I need to do?

Edited by Kurld
solved!
Link to comment
Share on other sites

OK, somehow I just missed that you can do what I want with some simple config file changes.  Inside the ModuleEnginesFx in question just set:

		stagingEnableText = Jettison Engine: Enable Staging
		stagingDisableText = Jettison Engine: Disable Staging
		stagingToggleEnabledEditor = True

There was already, of course already a toggle provided by the game for the ModuleDecoupler.

What this all tells me is that I need to actually play this game every once in a while instead of getting fixated on this mod!

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