Jump to content

Can I subscribe to a stock module's KSPEvent?


Recommended Posts

Like it says.  I don't want to inherit the module class, or stop the original function..i want to piggyback it.  I'd like to get a callback event when the Module gets theirs from a right click UI.  Is that possible?

 

I'd like to listen for ModuleScienceContainer::CollectDataExternalEvent, so I get notified when an EVA kerb takes the data from a container.  Afaik no GameEvent goes off during that action.  If I did subclass ModuleScienceContainer, and hid CollectDataExternalEvent with a wrapper implementation...the lack of virtual makes me fear it'll get called wrong from places I don't know about - and it seems like overkill just to observe.

 

If someone knows a game event that _does_ go off during an EVA "take data", I'd love to hear it...

Edited by SixHourDays
Link to comment
Share on other sites

I'm not sure.

This feels like something that should be possible, but looking at the Object Brower, the BaseEvent.onEvent delegate is tagged as 'protected' so I'm not sure how to access it.

The only other option is to directly hook into the button on the GUI somehow, but that would be tricky.

I think RemoteTech's done something similar? But that might have been replacing BaseEvent with their own custom Event class.

D.

Link to comment
Share on other sites

My suggestion would be to try out creating a new method with the KSPEvent attribute set up the same way and remove the other one during OnStart from the EventList. I don't think it is called from anywhere other than when the UI button is clicked.  It'll just require some testing to make sure that it works.

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