Jump to content

Code structure of plugin.


Recommended Posts

Hello,

While I have experience coding JAVA, C++, C#, PHP, JS, etc. I have never done a plugin for KSP.

Is the reference for it?

What is the structure for connecting click events from different parts, etc?

For now, all I want to do is bind action groups to cockpit buttons, and as a button is clicked, an output is shown on the screen in the same way as the transmission is done.

Thank you so much, I'm really eager to start modding KSP!

As a reference, I've modded, M&B, OFP, ARMA, and other less known/older games.

Link to comment
Share on other sites

For now, all I want to do is bind action groups to cockpit buttons, and as a button is clicked, an output is shown on the screen in the same way as the transmission is done.

Your description you could be interpreted in a couple of ways but assuming you want to make an IVA control that triggers an action group for the whole rocket then it would be something like the following:

Your basic class would extend InternalModule and be instantiated in the same way as the other IVA components (see the prop.cfg text files in GameData\Squad\Props for the individual IVA components, the spaces folder for placing them in IVA scenes).

Then you'd invoke the desired action group. I haven't done it but the ActionGroups property of the Vessel class looks like a good candiate. You inherit a reference to the current Vessel from InternalModule in the vessel variable.

I'm not sure which class sends that style of message, try ScreenMessages (which has static methods).

Link to comment
Share on other sites

Your description you could be interpreted in a couple of ways but assuming you want to make an IVA control that triggers an action group for the whole rocket then it would be something like the following:

Your basic class would extend InternalModule and be instantiated in the same way as the other IVA components (see the prop.cfg text files in GameData\Squad\Props for the individual IVA components, the spaces folder for placing them in IVA scenes).

Then you'd invoke the desired action group. I haven't done it but the ActionGroups property of the Vessel class looks like a good candiate. You inherit a reference to the current Vessel from InternalModule in the vessel variable.

I'm not sure which class sends that style of message, try ScreenMessages (which has static methods).

Awesome thank you so much!

This makes it waaay easier, I'm glad KSP is OO. Will be doing this over the weekend :D.

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