Jump to content

Plugin Manipulation of MultiModeEngine - Events are private?


Recommended Posts

Hi all,

I have a concept for a decoupler part that can automatically activate a secondary engine on a part when it decouples.  This would be, for example, for an SRB with integrated jettison motors.  The 'main' engine would be the SRB, using SolidFuel, the 'secondary' engine would be the jettison motors, using a second custom fuel type (JettisonFuel/etc).  The decoupler would trigger upon depletion of the main-engines resource (or whatever is specified in the decoupler config), which would then trigger the activation of the MultiModeEngine and the secondary jettison motors.

Normally when interacting with stock modules in this manner, I would call their publicly exposed GUI interaction methods, to trigger the action as if it was triggered by the player (seems to save a lot of headache / makes sure you are interfacing with the code in the right place/manner).

Now, the problem with this approach with MultiModeEngine is that everything appears to be private?  I was under the impression that things flagged with [KSPEvent] and [KSPAction] had to manditorily be public methods, but apparently this is not the case as I cannot locate any externally accessible methods that correspond with its actions/events.

So, the question is -- how to properly interface with MultiModeEngine module through a secondary module to trigger MultiModeEngine to switch from primary to secondary engine?  Can I get a reference to its Events["eventName"] or Actions["ActionName"] and trigger them from there?

Any other ideas on how to get this working?

 

Solution:

Yes, interacting with the methods through their Events[].Invoke() method works fine.  You just need to know the name of the method to trigger.

Edited by Shadowmage
Link to comment
Share on other sites

A little bit more poking around has revealed that the Events array -is- publicly accessible, and appears that it does have an Invoke() method that can be called on it.  Pretty sure I can interact with it through this method without too much difference from calling the event directly as if it were public.

Will update with info regarding the results as soon as I can test it out.

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