Jump to content

How can I get a docking port?


Recommended Posts

if I make an add-on "ModuleSnapDock" and use Module Manager to add it to all docking ports, how, in C# would I obtain the DockingPort object from inside the code in order to access and manipulate it's variables, properties and methods?

Edited by Xyphos
Link to comment
Share on other sites

ok, I can't seem to get the code to work?
I've compiled the DLL and copied it to KSP, module manager loads it, but I can't get the KSPField to show in the editor context menu

@PART[*]:HAS[ModuleDockingNode]:AFTER
{
	@MODULE
	{
		name = SnapDock
	}
}

 

namespace SnapDock
{
    public class SnapDock : PartModule
    {
        [KSPField(guiName = "Angle Snap", guiFormat = "N0", guiUnits = "°", isPersistant = true, guiActive = true, guiActiveEditor = true)]
        [UI_FloatEdit(scene = UI_Scene.All, minValue = 0, maxValue = 180, incrementSmall = 1, incrementLarge = 5, incrementSlide = 5)]
        public int AngleSnap = 5;

 

Link to comment
Share on other sites

  1. Remove the '@' in "@MODULE". You're not editing an existing module, you're adding a brand new one so you dont want to use any modifiers
  2. ":AFTER" what? After has a parameter if you need to use it. If this mod doesn't depend on any other mod, you would use FOR[<myModFolderName>] as well (before/after are for compatibility, FOR is to add it to your mods pass. PS dont combine FOR and BEFORE/AFTER in the same definition as that would put it in two different passes at once...)
Edited by Crzyrndm
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...