Jump to content

Removing Action Option From Part


Recommended Posts

I have created a module that acts as a docking node and can dock with another of the same part.

I am trying to remove the option to decouple the two parts after docking through the cfg file but it's not behaving as expected:


MODULE
{
name = ModuleDockingNode
referenceAttachNode = portDock
nodeType = size1
nodeTransformName = portDock

EVENTS
{
Decouple
{
active = false
guiActive = false
guiIcon = Decouple Node
guiName = Decouple Node3
category = Decouple Node
guiActiveUnfocused = false
unfocusedRange = 2
externalToEVAOnly = false
}
}
}

Any ideas what I'm doing wrong? The parts dock just fine, but I am still allowed to undock. My brackets are all in the right place and everything...

Link to comment
Share on other sites

I have created a module that acts as a docking node and can dock with another of the same part.

I am trying to remove the option to decouple the two parts after docking through the cfg file but it's not behaving as expected:


MODULE
{
name = ModuleDockingNode
referenceAttachNode = portDock
nodeType = size1
nodeTransformName = portDock

EVENTS
{
Decouple
{
active = false
guiActive = false
guiIcon = Decouple Node
guiName = Decouple Node3
category = Decouple Node
guiActiveUnfocused = false
unfocusedRange = 2
externalToEVAOnly = false
}
}
}

Any ideas what I'm doing wrong? The parts dock just fine, but I am still allowed to undock. My brackets are all in the right place and everything...

Is your module checking the Module Config node for those values? Because simply sticking this in a part config should not do anything.

Link to comment
Share on other sites

I'm not sure that decouple is the right function. I think that is what is used when a docking port is connected to something other than another docking port. Undock sounds like the function you're looking for, though I'm not sure if changing values for that in the .cfg file will work either.

Link to comment
Share on other sites

I'm not sure that decouple is the right function. I think that is what is used when a docking port is connected to something other than another docking port. Undock sounds like the function you're looking for, though I'm not sure if changing values for that in the .cfg file will work either.

I think you have that reversed, the guiName in the config is "Decouple Node", which matches with the button in game that I'm trying to get rid of.

Undock's guiName is "Undock", and that button is absent already in game.

Link to comment
Share on other sites

I think you have that reversed, the guiName in the config is "Decouple Node", which matches with the button in game that I'm trying to get rid of.

Undock's guiName is "Undock", and that button is absent already in game.

That wasn't clear, it seemed to me you were trying to modify the part from the part config.

Anyway, don't proceed by changing the ship file in the persistence, instead proceed by deactivating the field.

Start by finding the part you want to deactivate. Then just do something like this:

part.Events["Decouple"].guiActive = false;
part.Events["Decouple"].guiActiveEditor = false;

Link to comment
Share on other sites

I had the impression I could deactivate the event in the config file since the field existed in the craft file.

I guess there's no choice but to make a module and do it there, then...

Ended up making a new module which inherits from ModuleDockingNode and then overwriting the events like so:


[KSPEvent(active = false, guiActive = false, guiName = "Decouple Node")]
void Decouple()
{

}

It worked, but it's really inelegant. Getting warnings everywhere as I'm hiding the Decouple and other methods from the inherited class.

Thanks for your solution, I will switch over to that now!

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