Snark

[1.5] DefaultActionGroups v1.2.4: Part actions automatically in the action group of your choice.

Recommended Posts

What it does

  • Do you have certain "standard" action groups you always use? Such as "I always toggle my solar panels with Custom01"?
  • Do you get tired of having to remember to set that up every single time you build a new ship?
  • Wouldn't it be nice if it just automatically set things up how you like it, every time?

DefaultActionGroups lets you do that. It allows setting up custom config files that will automatically configure action groups for whatever parts you like.

Doing this requires tinkering with ModuleManager config files. If you're comfortable using a text editor and writing ModuleManager syntax, then you can make it do pretty much anything you like.

However, if you're not into tinkering with config... you don't have to. DefaultActionGroups provides several "sample" config files that do various useful things. You can pick the ones you like (e.g. "solar panels in Custom01") and just install those; see installation instructions below. And if you don't mind doing a little bit of tinkering, but don't want to have to learn all the arcane ModuleManager syntax, you can use these sample files as a starting point to work from.


Download from SpaceDock
License: CC-BY-NC-ND 4.0
Source code

Installation

  1. Unzip the contents of "GameData" to your GameData folder, same as with most mods. (Note, includes ModuleManager.)
  2. Choose whichever of the optional configs from the "Optional/GameData/DefaultActionGroups" folder in the zip file (see details below), and copy them into the DefaultActionGroups folder of your game.
  3. Add custom config of your own, if you like.

 

How to customize

By default, this only tweaks cockpit lights, since those were pretty much a no-brainer. However, the mod also includes several "optional" configs that do various interesting things. You can install any of these you like, or use them as examples for making your own configs.

Currently included optional configs:

  • Add all deployable solar panels to Custom01 group.
  • Add all radiators to Custom02 group.  (thanks to @JackDraak for suggesting)
  • Add all deployable antennas to Custom03 group.  (thanks to @Cultist_O and @Jiraiyah for suggesting)
  • Add all science containers' "Collect All" to Custom08 group.
  • Add all switchable-mode engines to Custom10 group.
  • Add all retractable ladders to Gear group.  (thanks to @JackDraak for suggesting)
  • Add thrust reversers to the Brakes group.  (thanks to @ZooNamedGames for suggesting)
  • Add the Launch Escape System to the Abort group.


A note of thanks
Heartfelt gratitude to @Diazo, without whose excellent help I wouldn't have figured out the minutiae of tweaking action groups. Any goodness herein is thanks to his assistance, anything wrong is entirely my own doing. :)

 

  • Like 9

Share this post


Link to post
Share on other sites

This’ll certainly save me the effort of adding the cockpit lights to the Lights action group every time I build a new spaceplane. Thanks, Snark!

As for the solar panels, I already use Solar Panel Action Group! for that, so I probably won’t install the optional bit. But it raises the question of whether you could make it so any keybinding will open the panels. If I could just install this and bind solar panels to ⇧P (or whatever), I’d happily drop Solar Panel Action Group and just run this one.

Edited by meyerweb
Cleaned up forum migration errors (Unicode and hyperlinking were both botched—sigh)

Share this post


Link to post
Share on other sites
[quote name='minepagan']Might I suggest adding Flaps to the Gear AG?[/QUOTE]

Sounds like that may make sense, but I hardly ever fly planes so I don't have enough context: is this a total no-brainer that virtually everyone would want, or is it more of a most-but-not-all kind of thing? Trying to judge whether it would fit better as a thing to install by default (like I've done with cockpit lights), or as an optional extra (like I did with solar panels).

Share this post


Link to post
Share on other sites
[quote name='Snark']Sounds like that may make sense, but I hardly ever fly planes so I don't have enough context: is this a total no-brainer that virtually everyone would want, or is it more of a most-but-not-all kind of thing? Trying to judge whether it would fit better as a thing to install by default (like I've done with cockpit lights), or as an optional extra (like I did with solar panels).[/QUOTE]
Ehh....a most-but-not-all....after all, you can use flaps as spoilers, and those would be better tied to brakes.......

Share this post


Link to post
Share on other sites
[quote name='Snark']Sounds like that may make sense, but I hardly ever fly planes so I don't have enough context: is this a total no-brainer that virtually everyone would want, or is it more of a most-but-not-all kind of thing? Trying to judge whether it would fit better as a thing to install by default (like I've done with cockpit lights), or as an optional extra (like I did with solar panels).[/QUOTE]

No. It isn't because the game doesn't define "Flaps". It defines toggling control surfaces, which may or may not be flaps. There is no way to programmatically determine which set of control surfaces the user wants to be flaps. Not just spoilers either, it would affect ailerons, elevators, elevons, and rudders too since they are all control surfaces and can all optionally be deployed like that. Simply put.. bad idea and even an optional config would do more harm than good.

Great mod though. Edited by Alshain

Share this post


Link to post
Share on other sites

Hi all...

As you may have heard, KerbalStuff has gone permanently off the air.  :(

This makes me very sad, because I've absolutely adored it.

I loved it as a user:  I could browse mods, find the ones I want, etc.  And I loved it as a modder:  I can see the traffic history, I can see how many people are actually downloading my mod, which is a huge thrill.  It gives me an endorphin rush to see that this little thing I made has been downloaded thousands of times.  It gives me motivation to keep on modding.  It's why I've chosen KerbalStuff as the download location for all my mods.

And now KerbalStuff is gone, and I don't have that any more.  It's a tragic loss.

You may not realize that KerbalStuff was a thankless, expensive labor of love by one guy, who ran and maintained the site for years, unpaid, in his spare time.

With heavy heart, I have updated the topic post for DefaultActionGroups so that it now gives a direct link to github instead of to KerbalStuff (may it rest in peace).  Therefore, you (and anyone else) can continue to download DefaultActionGroups... it's just that I won't know about it, since I now have no way of seeing how many people have downloaded the thing.

I'll continue to support my mods (and, probably, write new ones).  I'll just have a lot less fun doing it, now that KerbalStuff is gone.

Thank you for your interest in my mod.  And if you enjoyed using KerbalStuff, you might take a moment to go and thank SirCmpwn (sir@cmpwn.com) for what his site has given to this community over the last couple of years.

Share this post


Link to post
Share on other sites

KerbalStuff's replacement, SpaceDock, is now up and running.  (Mostly.  They're still working the kinks out, and it will take a while until all the mod authors have re-uploaded their mods, but it's "up enough" to be able to put mods there.)

I've updated the download link in the OP to point at SpaceDock.

Thanks to the hardworking devs and admins who have gotten SpaceDock up and running so quickly!

Share this post


Link to post
Share on other sites

Hi all,

I have released v1.1 of DefaultActionGroups. This is a compatibility update for KSP v1.1; there are no new features with this release.

  • If you are running KSP 1.1, you must update to this new version; older versions of DefaultActionGroups won't work on KSP 1.1.
  • If you are running KSP 1.0.5 or older, stick with 1.0; the new 1.1 update of DefaultActionGroups requires KSP 1.1 or later to run.

Enjoy!

  • Like 2

Share this post


Link to post
Share on other sites

Thanks a lot for the update and the great mod. I use it for everything I can think of ( solar panels, antennas, radiators, lights..). This saved me countless revert to VAB, or right clicks after I forgot to assign keys.

Share this post


Link to post
Share on other sites
45 minutes ago, Nookos said:

Thanks a lot for the update and the great mod. I use it for everything I can think of ( solar panels, antennas, radiators, lights..). This saved me countless revert to VAB, or right clicks after I forgot to assign keys.

Great, glad to hear it's helpful! :)

But I gotta ask... lights?  The stock game adds those to the "Lights" group by default, right?  (or are you talking about cockpit lights?)

Share this post


Link to post
Share on other sites
38 minutes ago, Snark said:

Great, glad to hear it's helpful! :)

But I gotta ask... lights?  The stock game adds those to the "Lights" group by default, right?  (or are you talking about cockpit lights?)

Yes indeed, lights from cockpits and any other parts with lights as an extra ( like Nertea's station parts for example) Oh and I could have cited cargo doors as well, and shielded docking ports. Very handy stuff, thanks again.

Share this post


Link to post
Share on other sites

Very handy, thanks for your efforts! 

I'm trying to determine how to make a .cfg for giving the ladders a default custom group (and/or assign them to the gear group)... It's not exactly obvious to me what I'd need to put in it though.

 

PS - nice water bear!

Edited by JackDraak

Share this post


Link to post
Share on other sites
1 hour ago, JackDraak said:

Very handy, thanks for your efforts! 

I'm trying to determine how to make a .cfg for giving the ladders a default custom group (and/or assign them to the gear group)... It's not exactly obvious to me what I'd need to put in it though.

 

PS - nice water bear!

Thanks, glad you find it useful!  :)

I'm not in front of my KSP computer right now, but basically it's going to look similar to this optional config for solar panels that's included with DefaultActionGroups.

It'll start with a line that looks something like,

@PART[*]:HAS[@MODULE[RetractableLadder]]

...i.e. "do this to every part that's a retractable ladder".  If you're wondering "how did Snark know that it's 'RetractableLadder'", I went to the config file for the part to find out the module name.

Then you'll give it a ModuleDefaultActionGroup like the example file linked above.  All you need to supply is an appropriate value for actionGuiName (i.e. whatever shows up in the action groups UI for the part in the VAB, probably "Toggle Ladder" or something), and the name of the action group you want to add it to.

At some point, I'm planning on releasing an update to DefaultActionGroups to include a lot more example configs in the "optional" directory (such as I'm currently doing with solar panels), to make it easier for folks like you to find something close to what they need.  :)  "Put extendable ladders in the Gear group" seems like a good candidate, I'll add that to the list!

Share this post


Link to post
Share on other sites
16 hours ago, Snark said:

It'll start with a line that looks something like,

@PART[*]:HAS[@MODULE[RetractableLadder]]

...i.e. "do this to every part that's a retractable ladder".  If you're wondering "how did Snark know that it's 'RetractableLadder'", I went to the config file for the part to find out the module name.

Then you'll give it a ModuleDefaultActionGroup like the example file linked above.  All you need to supply is an appropriate value for actionGuiName (i.e. whatever shows up in the action groups UI for the part in the VAB, probably "Toggle Ladder" or something), and the name of the action group you want to add it to.

So I'd started on the right track... Once I managed to create a .cfg that wasn't creating errors in the log (I think) because once I fixed my brackets I had that part working... it's what follows where I don't quite understand how to complete the config... My latest try was this [EDIT: got it working! Thanks!]

Quote

// By default, assign ladders to Custom Group 6
@PART[*]:HAS[@MODULE[RetractableLadder]] {
    MODULE {
        name = ModuleDefaultActionGroup
        moduleSource = RetractableLadder
        actionGuiName = Toggle Ladder
        defaultActionGroup = Custom06
    }
}

 

Edited by JackDraak
fixed - now working config for ladders

Share this post


Link to post
Share on other sites
12 minutes ago, JackDraak said:

So I'd started on the right track... Once I managed to create a .cfg that wasn't creating errors in the log (I think) because once I fixed my brackets I had that part working... it's what follows where I don't quite understand how to complete the config... My latest try was this:

Hmm.  I don't have KSP in front of me right now, but just eyeballing your config, it looks like that ought to work (assuming that "Extend Ladder" actually is the correct action name).  Seems to me that that's all you should need (though personally I would have thought that "toggle" would be a more useful default than "extend").

Does it not work?

One trick I've found that can sometimes be helpful for debugging ModuleManager config is to add something like this to the config, inside the @PART declaration:

@description = Help, help, I've been tweaked!

...that way, when you're in-game and scratching your head wondering "why is it not doing anything?", then you can go to the VAB and look at the part in the parts list, to see whether it has your tweaked description.  This lets you answer the question "is it not working because it's not matching the part, or is it not working because I've somehow messed up what I'm doing to the part?"

  • Like 1

Share this post


Link to post
Share on other sites

Yes it's working now, thanks again.... I just kept looking at the part(s) in an assembled craft, trying different terms, and restarting KSP.... "Toggle Ladder" (unsurprisingly) is what finally worked :)

Share this post


Link to post
Share on other sites
Quote

// By default, assign radiator on/off to Custom Groups 8/9
@PART[*]:HAS[@MODULE[ModuleActiveRadiator]] {
    MODULE {
        name = ModuleDefaultActionGroup
        moduleSource = ModuleActiveRadiator
        actionGuiName = Shutdown Radiator
        defaultActionGroup = Custom09
    }
    MODULE {
        name = ModuleDefaultActionGroup
        moduleSource = ModuleActiveRadiator
        actionGuiName = Activate Radiator
        defaultActionGroup = Custom08
    }
// By default, toggle radiators assigned to Custom Group 7 
    MODULE {
        name = ModuleDefaultActionGroup
        moduleSource = ModuleActiveRadiator
        actionGuiName = Toggle Radiator
        defaultActionGroup = Custom07
    }
}

If anybody wants a starting-point for default radiator action groups, this uses group 7 for deployable radiators and groups 8/9 (on/off) for fixed radiators. [group 9 seems like a good one for setting a "low-power-mode"].

Share this post


Link to post
Share on other sites

A call to action from anybody who enjoys using this mod:  Suggestions for optional config.

I'm preparing to release an update that will include a lot more useful "example" optional configs to go with DefaultActionGroups-- kind of like the one I already have for toggling solar panels.  There's a lot of potentially useful stuff that's already been suggested here... I'd like to build on that.

So I'm currently soliciting suggestions.  Got any great ideas?  Please let me know!

Here are the guidelines for suggestions:

  • I mainly want suggestions rather than actual ModuleManager config-- I can author the config myself.  (Though if you've figured it out already, feel free to include suggested config!)
  • It should be something that you think a significant number of people might want.
  • It does not have to be something that everybody would want.  That's why these are optional configs.  :)
    • Example:  "thrust reversers in Brakes group."  I can see how that might be useful, but I could also imagine there are folks who wouldn't want it, for various good reasons.
  • Parsimonious use of action groups.  Ideally, only one action group per part would be ideal.
    • Example with radiators:  I plan on just including sample config for "toggle", rather than including "activate" and "deactivate" too.  The idea is that "toggle" is generally the most useful, and if someone wants the others, they can easily use the "toggle" config as a sample to tweak it how they like.
  • Below is a list of ones that I'm already planning to include, so you don't need to suggest those.
  • I reserve the right to include, modify, or regretfully choose not to include any and all suggestions.  But if I decide to use your idea in some form, I'll give you credit in a comment in the config file.

 

Here are the samples I'm already planning on including (some of which I thought up myself, some of which have been suggested by users):

  • Toggle/extend solar panels (this is already included with the mod)
  • Toggle radiators  (credit: @JackDraak)
  • Retractable ladders in "Gear" group  (credit:  @JackDraak)
  • LES in "Abort" group
  • Switch engine mode (e.g. for Rapier, Panther, etc.)
  • Thrust reversers in "Brakes" group  (credit:  @ZooNamedGames)

I'll give it a few™ days, then will package everything up and publish an update.

So... got any other good ideas, anyone?  :)

 

  • Like 1

Share this post


Link to post
Share on other sites

Okay, have received no more suggestions, so I've gone ahead and added the abovementioned optional configs and updated the mod to v1.1.1.

Enjoy!

  • Like 1

Share this post


Link to post
Share on other sites

PSA:

  • The KSP 1.1.2 patch that just came out broke ModuleManager.
  • sarbian has released ModuleManager 2.6.24 for compatibility with 1.1.2.
  • This means that any mods that depend on MM (such as this one) will be broken until you're updated to ModuleManager 2.6.24 or later.
  • For your convenience, I've done just that!  See below.  :)

 

So, I've updated DefaultActionGroups to v1.1.2.  There are no actual code changes, just an update to the latest ModuleManager version for compatibility with KSP 1.1.2.

  • Like 1

Share this post


Link to post
Share on other sites

I'd like to bring this to your attention:

https://spacedock.info/mod/639/MuddrMods%20Stock%20Tweaks

because it's really cool.  Muddr has been stealth mode with it so far; there isn't a forum thread yet, but it's public.  DasValdez has been featuring it on his stream.  It's pretty simple - adds cockpit lights to all crewed parts that don't have stock lights.  What would it look like to make DefaultActionGroups compatible with this mod?  Anything as simple as a MM cfg on the user's end?

Share this post


Link to post
Share on other sites
9 hours ago, fourfa said:

I'd like to bring this to your attention:

https://spacedock.info/mod/639/MuddrMods%20Stock%20Tweaks

because it's really cool.  Muddr has been stealth mode with it so far; there isn't a forum thread yet, but it's public.  DasValdez has been featuring it on his stream.  It's pretty simple - adds cockpit lights to all crewed parts that don't have stock lights.  What would it look like to make DefaultActionGroups compatible with this mod?  Anything as simple as a MM cfg on the user's end?

Impossible to say for sure without actually looking at how it's implemented.  However, assuming that Muddr has done something similar to what the Porkjet light-up command pods do (i.e. he's adding an animation to turn the lights on/off, and there's an action group to let the user adjust the lights), then yes, it should be easily compatible.

In fact, depending on how consistent he's tried to be with Porkjet, it might be compatible already, no action required.  :)  Here's the ModuleManager config that DefaultActionGroups uses to enable cockpit lights in the Light action group.  It basically boils down to "find all parts that have ModuleAnimateGeneric on them, with a GUI action named 'Toggle Lights', and add that action to the Light action group."

So, here are the possible scenarios, in decreasing order of convenience:

  1. Scenario: Muddr has used ModuleAnimateGeneric, and named his action "Toggle Lights" (like the Porkjet parts), and ModuleManager happens to read the DefaultActionGroups config after it processes Muddr's mod.  Action required: None, it works already!  :)
  2. Scenario:  Same as above, but ModuleManager happens to read Muddr's config after DefaultActionGroups has already processed, so Muddr's stuff doesn't get picked up.  Action required:  Copy the existing DAG config (which I link to above) to a new file, and on the first line add an "AFTER" clause to force it to process after Muddr's mod.
  3. Scenario:  Muddr has used ModuleAnimateGeneric, but named his action something other than "Toggle Lights".  Action required:  Copy the existing DAG config (which I link to above) to a new file, and change the references to "Toggle Lights" to whatever name Muddr has used for the animation.
  4. Scenario:  Muddr has used something other than ModuleAnimateGeneric, but is still using some PartModule that has an action on it.  Action required:  Should still be possible with MM config, it'll just take a little more editing (basically, specify which PartModule is being used, and then which action GUI name needs to be processed).

...so the answer to your question is basically, "yes, I expect it could be made to work easily with MM config... and possibly works already."

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now