Jump to content

Help With DockPort Plugin


Recommended Posts

OK, I am a noob to ksp plugin development but not to c# or programming in general. I have read and searched many locations and even looked at other plugin's code. But nothing is clear enough to get me going in the right direction.

Goal: I want to create a new docking port. Why- because I love the game and I love programming. I have tried the plugin from NavyFish but I want something a little different. It is just for my personal enjoyment.

Progress: From what I understand, you can create a new kind of part by inheriting from the Parts class and (I guess) associating the code with a cfg via the module name parameter. I have not done this because I believe I what I need to do is modify the behavior of an existing part by inheriting from the PartModule class and associating that with a docking port cfg (via copy and past into new plugin folder and changing the name). I have tried this and it seems to not complain but the new part does not dock. I am not overriding anything except onAwake but even then I am just logging a string debug console and calling base.onAwake.

Yes, I have followed the tutorial (http://wiki.kerbalspaceprogram.com/wiki/Creating_your_first_module) but these parts mods don't do anything like dock 2 ships together.

Any help will be appreciated as I cannot find any reasonable collection of api documentation.

Mark Owens

Link to comment
Share on other sites

ok, I guess my question then is, how do I dock two ships so they become one in the code like the dockingport module already does. Or even better, how do add the the existing functionality of a dockingport?

That is, if I implement PartModule I have to provide all the code to handle docking to ships together - I do not know the API required for that. Or, maybe I can just implement DockingPort?? But I tried this by associating with a cfg like you would for a PartModule but to now avail. I clearly am stumbling around in the dark.

Link to comment
Share on other sites

I think I got it. I found ModuleDockingNode class! :)

public class mydockingpart : ModuleDockingNode

{

...

}

It works!!! It has all the default features of a docking port plus whatever I add to it!

The following link was the clue for me;

https://github.com/Anatid/XML-Documentation-for-the-KSP-API/blob/master/DockingPort.cs

Link to comment
Share on other sites

  • 2 months later...

Can anybody tell me if it is possible to add functionality to existing stock Docking ports. Like plugin that would extend the built-in parts? Or I have to create parts and add the functionality I wish?

Link to comment
Share on other sites

Can anybody tell me if it is possible to add functionality to existing stock Docking ports. Like plugin that would extend the built-in parts? Or I have to create parts and add the functionality I wish?

Not that I know of. Simply add your own PartModule to the parts by using MM.

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