Jump to content

Adding a PartModule to all Parts


Recommended Posts

Module Manager is a mod built just for that purpose. You write patches in a text document with the .cfg extension and MM applies the changes to all the parts that you specify

@PART[*]:HAS[@MODULE[ModuleEngines*]] // all parts that have a module where the module name field starts with "ModuleEngines"
{
	MODULE
	{
		name = myModule
	}
}

 

Edited by Crzyrndm
Link to comment
Share on other sites

So, if I understand the way Module Manager works, this should give all SRBs a failure rate of 1%, and all non-SRBs a failure rate of 0.1%, unless they already have a failure module.

@PART[*]:HAS[@MODULE[ModuleEngines],@RESOURCE[SolidFuel],!MODULE[ModuleEngineFailure]]:Final
{    
    MODULE
    {
        name = ModuleEngineFailure
        FailChance = 0.01;
    }
}

@PART[*]:HAS[@MODULE[ModuleEngines],!RESOURCE[SolidFuel],!MODULE[ModuleEngineFailure]]:Final
{
    MODULE
    {
        name = ModuleEngineFailure
        FailChance = 0.001;
    }
}

Does this affect derived classes, like ModuleEnginesFX, or would I have to have a seperate definition to affect those as well?

Link to comment
Share on other sites

Note the wildcard (*) after the ModuleEngines in my HAS block. Module manager is working with the text files before KSP compiles them into parts, so you won't catch derived classes unless you specifically allow for that (ModuleEngines catches only ModuleEngines, ModuleEngines* catches any module that has a name starting with ModuleEngines. ie. ModuleEngines and ModuleEnginesFX)

PS

You should direct MM syntax questions to the MM thread, you'll get better answers faster because more people will see it

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