Jump to content

[1.12.x] DefaultActionGroups v1.4: Part actions automatically in the action group of your choice.


Snark

Recommended Posts

Hi all,

I've updated DefaultActionGroups to v1.2.1.  (The fact that the current KSP version is also called "1.2.1" is just a coincidence.)

No code changes; this just does two things:

  • Add optional config for putting all deployable antennas in Custom03 by default.  (Thanks to @Cultist_O and @Jiraiyah for suggesting.  Yes, I know you were really suggesting it for RemoteTech, but now that the stock game has deployable antennas, this became such a great idea that I took inspiration from your suggestion.)
  • Update to latest ModuleManager version, while I'm at it.

Note:  The new optional config for antennas works for all the stock deployable antennas.  It will not work with RemoteTech antennas (at least, not as of 1.8.2).  That's because this optional config is designed for antennas that use the new ModuleDeployableAntenna in KSP 1.2, whereas RemoteTech antennas don't do that, yet-- they're still using the old ModuleAnimateGeneric.  If RemoteTech ever updates their antennas to use ModuleDeployableAntenna, then they'll automatically start working with the optional config I've provided here.  Until and unless that happens, though, you'll still need to provide special custom config for RemoteTech, if that's what you want.

 

Link to comment
Share on other sites

Nice :)

I discovered that my attempt wasn't perfect. Although it works, it still adds it to all antennas, whether they have an extend function or not.

Another downer was that I thought I could cheat my way around in Career mode, before you upgrade VAB/SPH. Since Abort, Gear etc. works with the basic VAB/SPH, I thought I could use this mod before I upgraded to level 3. Didn't work :( he he

Edited by Johnny2000
Link to comment
Share on other sites

15 minutes ago, Johnny2000 said:

Another downer was that I thought I could cheat my way around in Career mode, before you upgrade VAB/SPH. Since Abort, Gear etc. works with the basic VAB/SPH, I thought I could use this mod before I upgraded to level 3. Didn't work :( he he

Not sure what your issue was-- but this mod definitely lets you "cheat" in that way, I've been doing it since forever.  (e.g. "Toggle solar panels via Custom01" config allows doing that, even if the VAB isn't upgraded).  It's one of the things I liked about using this mod, because I always thought the game mechanic of "You have to upgrade all the way in order to use action groups" was kind of dumb.

It's moot now, however.  Apparently I'm not the only person who thought this was a silly limitation, because as of 1.2, KSP now has a new career difficulty setting, "Always Allow ActionGroups", that can make it so that you have action groups available from the get-go, without upgrading the VAB.  I'm really happy about that.  When I play career, I normally have the various difficulty settings turned up fairly high (i.e. I turn on communications blackout, and kerbal G-force limits, and no-control-when-no-comms, and so forth), because I like a challenge... but that option, I put on easy-mode (i.e. I turn it on, which is not the default), because "you can't have action groups" isn't a challenge, it's a pointless limitation that seems really arbitrary and unrealistic.  I mean, really.  These little green guys have the engineering know-how to build spaceships that go to other planets... but they can't wire up a simple button for extending/retracting solar panels?  Seriously?

Kudos to Squad for adding that setting.  :)

Link to comment
Share on other sites

17 minutes ago, Snark said:

Not sure what your issue was-- but this mod definitely lets you "cheat" in that way, I've been doing it since forever.

Hmm, I'll have to look into it. Better load a game into Sandbox mode, to see if I have been tinkering too much with the files :wink:

Link to comment
Share on other sites

  • 2 months later...

Perhaps a dumb question, but what's the functionality/compatibility of this mod with ActionGroupsExtended? Does it work properly with AGX and/or support the extra actions group? Stock AGs seems to map one-to-one with AGX for groups 1-10. (Well, last I tried, which was a LONG time ago: 1.0.5-era. Uninstalling AGX still left the proper settings in stock, IIRC.)

I don't touch KSP much lately, but I'm thinking of getting back into it more, especially now that someone picked up Adjustable Landing Gear. (ALG is perhaps the one part mod I refuse to play KSP without.) I dabbled in KSP a bit now and then since 1.2.x came out (I skipped 1.1.x entirely), but haven't done anything extensive since I was waiting for mods to update. I'm considering this mod to make life a bit more convenient in the SPH/VAB/Editor.

Link to comment
Share on other sites

19 minutes ago, StahnAileron said:

Perhaps a dumb question, but what's the functionality/compatibility of this mod with ActionGroupsExtended?

There's no code or config whatsoever in DefaultActionGroups for interoperability with ActionGroupsExtended, or vice versa.  The two mods don't know about each other, at all.

DefaultActionGroups works purely with the stock action groups, i.e. putting part actions into the groups automatically.

21 minutes ago, StahnAileron said:

Stock AGs seems to map one-to-one with AGX for groups 1-10.

I don't know anything about how ActionGroupsExtended is implemented, but what you just said there makes sense to me.

One thing to bear in mind about action groups in KSP is that they're not actually moddable, and it's impossible for a mod to extend them.  It is physically impossible to add action groups to KSP with a mod.  (The technical reason, for the curious, is that they're implemented as a C# enum, which is a hard-coded list of constants that's graven in stone and can't be modified.)

So.  There are the special "named" groups like Lights, Gear, etc., and there are the Custom01 through Custom10, and that's it.  That's all you get.

"But Snark," I hear you say, "the whole point of AGX is that it adds all these action groups!  How can it do that if it's impossible?"

Simple:  it's not actually adding action groups.  (I believe that to be the case.  I don't know anything about its implementation, I'm just deducing this from first principles.)  I assume what it's doing is adding code and UI to act like action groups, but technically they're not action groups in the same sense that the stock ones are.

If cleverly enough implemented, I imagine that it could be made so that the difference would be fairly transparent to the user.  However, it would not be transparent to other mods-- they wouldn't be able to "see" those extra action groups unless they were given some sort of interop code to work specifically with AGX.

With that in mind, then... it wouldn't surprise me if AGX were implemented to go ahead and use the stock action groups for those first several ones-- I know that's what I would do if I were implementing it.

So... if that's the case, then I would imagine that DefaultActionGroups and ActionGroupsExtended would work together as follows:

  • For the stock action groups, they'd work just fine together
  • For the extra "action groups" that AGX adds, DAG can't see them and won't work with them at all.

That's just a guess, though.  I haven't actually run AGX myself, so I don't know for sure-- the only way to know would be for you to try it and find out.

Link to comment
Share on other sites

Well, better than nothing. If I decide to try this out in my install, I'll let you know. All my important actions go into groups 1-10 anyway, since those have hotkeys by default. (Lesser used or one-off actions I dump into higher AGX groups for activation via mouse. I'm too lazy to map the extra groups to key combos :P) If AGX and DAG work for groups 1-10, that's enough for me.

Link to comment
Share on other sites

  • 3 months later...

Hi all,

I've released v1.2.2 of DefaultActionGroups..  No new features, this is just an update for KSP 1.3 compatibility.

The main thing that's changed is that it's now bundled with the newest version of ModuleManager, 2.8.0, so that it'll work with KSP 1.3.

One other change is that I've updated it to target .NET framework version 3.5, as a KSP mod is supposed to.  Previously it was targeting 4.5.2.  (This change is of interest only to modders who might be adding assembly references to this mod.  It has basically zero effect on players.)

Enjoy!

Link to comment
Share on other sites

@Snark The optional default actions appear to not be working for me. I'm using v1.2.2 and ksp 1.3. I'm not getting any errors or anything. I did move the optional .cfgs over to the defaultactions folder in my gamedata, but don't seem to be getting any of them automatically assigned. Tried a few different solar panels. 

The LES in abort is working, thrust reverses, and retractable ladders all work. 


EDIT: I just realized the problem is actually Kopernicus. They replaced the solar panel module with their own new module to enable multiple suns. I will look up the new module name and whip up a compatibility patch for you after I go get some pizza.

EDIT2:
 

// The retractable panels get "Toggle" added to group Custom01.
@PART[*]:HAS[@MODULE[ModuleDeployableSolarPanel]:HAS[~retractable[false]]] {
	@description ^= :(.)$:$0 Panels toggle via action group Custom01 by default.:
	MODULE {
		name = ModuleDefaultActionGroup
		moduleSource = KopernicusSolarPanel
		actionGuiName = Toggle Panels
		defaultActionGroup = Custom01
	}
}

// The non-retractable panels get "Extend" added to group Custom01.
@PART[*]:HAS[@MODULE[ModuleDeployableSolarPanel]:HAS[#retractable[false]]] {
	@description ^= :(.)$:$0 Panels extend via action group Custom01 by default.:
	MODULE {
		name = ModuleDefaultActionGroup
		moduleSource = KopernicusSolarPanel
		actionGuiName = Extend Panel
		defaultActionGroup = Custom01
	}
}

 

Edited by Errol
Link to comment
Share on other sites

14 hours ago, Errol said:

I just realized the problem is actually Kopernicus. They replaced the solar panel module with their own new module to enable multiple suns. I will look up the new module name and whip up a compatibility patch for you after I go get some pizza.

Excellent, thanks!  :) (Both for the heads-up, and also for taking the trouble to come up with a solution.  And especially for diagnosing the root cause, because that's what would have sucked up most of my time if I'd stumbled into this on my own.  A huge timesaver, major thanks for that.)

Hadn't yet played a 1.3 game with Kopernicus installed.  Once I have a chance to sit down with my KSP 'puter, I'll tinker with this and work it into an update.

Link to comment
Share on other sites

Okay, folks, here's DefaultActionGroups v1.2.3, a.k.a. "The Errol Edition"!

This update addresses a problem with the optional config for solar panels when Kopernicus happens to be installed.  Many thanks to @Errol for noticing the problem, tracking down the root cause, and suggesting a fix.  :)

Enjoy!

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
4 hours ago, linuxgurugamer said:

Does it work with AGX (Action Groups Extended)?

Short answer:  Yes and no.

Slightly longer answer:  DefaultActionGroups is completely unaware of AGX, and vice versa.  The two mods will neither hurt nor help each other.  You can't use DefaultActionGroups with any of the "extra" action groups that AGX adds, but you can use it just fine with the stock action groups even if AGX is installed.

Full answer, with technobabble, in spoiler section.

Spoiler

My understanding is that AGX does a couple of big things:

  • Gives you the ability to edit your action groups in flight.
  • Provides you with scads and scads of additional action groups beyond the basic ones incorporated in stock.

As to the first point (editing action groups in-flight), the two mods should be perfectly compatible and completely unaware of each other.  That's because the only effect of DefaultActionGroups is in the editor; it has no effect at all in flight.

As for the "lots of extra action groups from AGX" thing:  It won't work with AGX's "extra" action groups... but it won't hurt them, either.  That's because it's actually physically impossible to really add action groups into the game; they're immutable and unmoddable, since they're modeled via a C# enum and therefore can't be changed.  AGX presumably works around this impossibility by basically implementing its own "action groups" that work basically the same as the real thing.  That's fine as far as it goes... but it means that any other mods won't be able to "see" all those extra just-like-a-real-action-group things from AGX unless they've been somehow specifically instrumented to do so.  Which DefaultActionGroups has not.

Edited by Snark
Fixed copy-paste error.
Link to comment
Share on other sites

2 hours ago, linuxgurugamer said:

Ummm, no technobabble :D

Drat. Something went off the rails while copy-pasting (the forum software doesn't handle cut/paste with nested content and spoiler sections very well, and/or there may have been a PIBKAC).

Anyway, tidied up now, thanks.  :blush:

Link to comment
Share on other sites

  • 3 weeks later...

@Snark I found this in MM patch archive thread:
 

// Configure RCS to Translate Only by Default
// Author: Snark
@PART[*]:HAS[@MODULE[ModuleRCSFX]]
{
	@MODULE[ModuleRCSFX]
	{
		%enableYaw = false
		%enablePitch = false
		%enableRoll = false
	}
}

And am wondering, for those of us playing with heavily nerfed reaction wheels, is it possible to set this up as a default action group toggle instead of a global state? That way we can easily use RCS for rotation when we need it.

Link to comment
Share on other sites

2 hours ago, Errol said:

is it possible to set this up as a default action group toggle instead of a global state?

Nope.  RCS thrusters don't have "toggle specific actuators" available as an action group in KSP, as you can see here:

L5Fn6wc.png

See?  The only action-group thing available is "Toggle RCS Thrust".  That's it, that's all you get.

So if you wanted to have DefaultActionGroup config to put "toggle RCS thrust" in an action group by default, you can totally do that... but the stock game already does that (it's the "R" key), so, not exactly a value-added proposition there, as far as I can tell.  :)

Certainly it would be possible for someone to write a mod that does add action-group toggles for the individual RCS actuators.  There's nothing preventing anyone from creating such a mod.  For all I know, it already exists.  And if you had such a mod installed, then you could add DefaultActionGroup config to set up the actuator toggles the way you like in some action group somewhere.

DefaultActionGroups doesn't add any new "actions" to any part, for anything.  That's not what it does.  It simply saves you the step of having to manually assign it when you build a ship.  It doesn't let you do anything that you couldn't do manually.

I'm curious why you'd like to have such a feature, though.  If you've got heavily-nerfed reaction wheels, then you'd use RCS thrusters to do your rotation, right?  So why not just use the global RCS toggle when you want to rotate, and leave it turned off when you don't?  I mean, I set up the abovementioned ModuleManager config because I don't want to use RCS for rotation, and only want to use it for translation, precisely because the existence of (non-nerfed) reaction wheels means that any monoprop expended for rotation is just wasted fuel, to me.  Take away the reaction wheels, and you take away the reason to turn off the rotation ability of RCS, yes?

In other words, how does the stock behavior of RCS thrusters (i.e. without the MM snippet above) not give you exactly what you want?

Link to comment
Share on other sites

The reaction wheel nerf I'm using diminishes reaction wheel torque gradually as you use them. It ends up meaning that reaction wheels can be used to hold attitude as long as there is no outside force on the vessel, and you can do some small turning with them, but not much. 

The use case is in docking. While docking, most of the time I will want my RCS to translate only, but if I end up drifting too far (or I just suck at docking too much) I may need to use RCS to help the wheels re-align me.

I was hoping that you might know of some MM sorcery that would allow action group access to individual actuator toggles, without the need of writing a whole mod for it. 

Link to comment
Share on other sites

4 minutes ago, Errol said:

I was hoping that you might know of some MM sorcery that would allow action group access to individual actuator toggles, without the need of writing a whole mod for it.

Ah, okay.  Nope, not possible.  ModuleManager can't do that.

Anything that can be assigned to an action group is called an "action".  Actions are implemented by PartModules.  ModuleManager can't implement a PartModule, it can just add/remove/configure existing PartModules (either stock, or from a mod) on parts.

The stock PartModule that powers RCS thrusters doesn't have an individual-actuator action, so that's basically the kibosh on that.  There's no "there" there.  To have that, it would require someone to implement a custom mod that adds such an action to them.

Link to comment
Share on other sites

Fair enough, thank you for the detailed answer, as usual. 

EDIT: Ping @Snark, I love this community. I dug around a bit and found a mod that already does the exact thing you described needs to be done;
 

 

Edited by Errol
Link to comment
Share on other sites

55 minutes ago, Errol said:

I dug around a bit and found a mod that already does the exact thing you described needs to be done;

Ha!  Why am I not surprised that it's @Diazo who made it.  :)

(He's the go-to Action Groups Guy of the KSP modding community.  He's the guy who answered all my stupid questions when I was trying to figure out how to make DefaultActionGroups work in the first place.)

Link to comment
Share on other sites

  • 2 months later...

Hi all,

Just a note that I've updated DefaultActionGroups to version 1.2.4.  Changes include:

  • Updated to ModuleManager v3.0.6 for KSP 1.4.1 compatibility.
  • Added a new optional config for science containers, for "Collect All" to be tied to Custom08.

Enjoy!

Link to comment
Share on other sites

  • 3 weeks later...

@Snark question: I'm trying to make a .cfg to get the stock "poodle" engine to toggle via the Abort action group. What moduleSource should I use to simply toggle the engine on and off? 

Thanks!

Edited by Cochise
Link to comment
Share on other sites

8 minutes ago, Cochise said:

I'm trying to make a .cfg to get the stock "poodle" engine to toggle via the Abort action group. What moduleSource should I use to simply toggle the engine on and off?

ModuleEngines.  (Here's the Poodle config, for reference.)

Basically, to make any action on any part work with DefaultActionGroups, you need to know two things about the part:

  • Which module is the one that's implementing the action you want to activate?
  • What's the name of the action? (i.e. what shows up in the menu when you go to the "actions" tab of the vehicle editor)

In the case of toggling an engine, it's the ModuleEngines that implements that, so that's what you'd use for the module name.

And if you're ever tinkering with some random part and you don't know which module implements the action group you want to work with:  typically what you'd do would be to look at the part's config, and eyeball the names of the modules on the part.  It'll usually be pretty obvious which one is the one you want.  If it isn't, then it's time for good ol' trial and error.

Link to comment
Share on other sites

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