JoePatrick1

[1.0.2] Solar Panel Action Group!

Recommended Posts

Press 'P' to toggle all solar panels on the active ship.

Very simple plugin but saves you from having to manually add them all to an action group.

Idea from /u/jansenart on reddit


Download

Source

All rights Reserved

Edited by JoePatrick1

Share this post


Link to post
Share on other sites
Get this to work with the module SSTUSolarPanel and I will download.

SSTU? link me to the mod and I can probably get it working

Share this post


Link to post
Share on other sites
SSTU? link me to the mod and I can probably get it working
It's Bacon Labs, and the plugin isn't available to the public yet. Wait till the next BL update comes out :P

Share this post


Link to post
Share on other sites
It's Bacon Labs, and the plugin isn't available to the public yet. Wait till the next BL update comes out :P

Well hows he supposed to get it to work with a plugin he cant access :P

But awesome little quality of life mod JoePatrick! If i had a nickel for everytime i forgot to put the panels on an action group.....well id be able to at least buy myself a nice steak dinner :P

Share this post


Link to post
Share on other sites
It's Bacon Labs, and the plugin isn't available to the public yet. Wait till the next BL update comes out :P
Well hows he supposed to get it to work with a plugin he cant access

But awesome little quality of life mod JoePatrick! If i had a nickel for everytime i forgot to put the panels on an action group.....well id be able to at least buy myself a nice steak dinner

All I need to get it to work is the name of the module, and the name of the function to extend/retract (assuming it isn't just Extend() and Retract() like in the stock module)

Although I will wait until your mod is released then I will add compatibility - just send me a message or something when it's released.

Thanks for the feedback :)

Share this post


Link to post
Share on other sites

I love this little mod !

I request the same thing for RemoteTech antennas (antennae? I'm french so I don't know if I have to use the american or the british way...), the module name is : ModuleRTAntenna but I think the animation is the stock one (ModuleAnimateGeneric).

Edited by TheGuguz

Share this post


Link to post
Share on other sites

Downloaded, I've suggested something similar in the past here on the forums, glad to finally not have to burn an action group on every vessel for panels.

Share this post


Link to post
Share on other sites

This is one of those tiny mods that's entirely brilliant. Echo the CKAN comment above. Deserves a permanent place on the roster.

Share this post


Link to post
Share on other sites

Please add ModuleCurvedSolarPanel from Near Future Solar. Thank you!

Share this post


Link to post
Share on other sites

What about some kind of check to make sure the panel isn't blocked or would clip when deployed? I like to build satellite buses with multiple satellites side by side, and if all the solar panels deployed they would clip into each other (mechjeb did this to me). No problem while attached, but separate one for its mission and BOOM, there goes half my power for that satellite. An upward check for current stage or a decoupler between parts with panels attached would be good. Perhaps each subsequent press of the hotkey would deploy the next stage's panels. So press 1 is active stage, press 2 is stage above that, etc.

Share this post


Link to post
Share on other sites

This mod is wonderful. Why isn't this in the stock game? This thing is like a windshield on a car - should come on all models :P THANK YOU

Share this post


Link to post
Share on other sites
What about some kind of check to make sure the panel isn't blocked or would clip when deployed? I like to build satellite buses with multiple satellites side by side, and if all the solar panels deployed they would clip into each other (mechjeb did this to me). No problem while attached, but separate one for its mission and BOOM, there goes half my power for that satellite. An upward check for current stage or a decoupler between parts with panels attached would be good. Perhaps each subsequent press of the hotkey would deploy the next stage's panels. So press 1 is active stage, press 2 is stage above that, etc.

Well the whole point of this is to bind all solar panels to one key. If you want them to be activated in stages, well that's what action groups are for. They shouldn't open when in a fairing or cargo bay because stock handles that for me.

Share this post


Link to post
Share on other sites

great mode, my suggestion for improve it:

-compatibilty with AVC-checker and C-KAN

-the plugin is actually a toggle, so it retract manually opened panels,...: maybe change it to switch alternatively to "retract all"/"open all"

-show the state of the switch: opened/closed, maybe a in game button like those for gear or lights/an icon for tool bar mod.

-configurable keybinding (in a settings.cfg) to easily solve conflict with other mod (precise node in map view for example),

-disable the function in map view

maybe you want to keep it simple (as you said there is action group/other mod like ship manifest/action group extended for more complexe operations) but that is what i would like to complete them,

i need your plugin mostly for:

-testing ship and dont assign all those news panels each time, i'm lazy ;) , (tweakable everthing is great for this too but need more clicks)

-open them all while in space(exept those covered of course)

-retract them all for reentry/docking/landing/emergency/...,reset the mess when docking a ship with panels opened to an other with them closed

thank you for sharing your work

Edited by Skalou

Share this post


Link to post
Share on other sites

Interesting.

Can I recommend one change though?


foreach (Part shipPart in FlightGlobals.ActiveVessel.parts) //unchanged
{
foreach(PartModule pm in shipPart.Modules) //cycle through all partModules on the part
{
if(typeof(ModuleDeployableSolarPanel).IsAssignableFrom(pm.GetType())) //the trick, see comment below
{
ModuleDeployableSolarPanel panel = (ModuleDeployableSolarPanel)pm; //this is true, the if statement the previous line ensures it
if (panel.status == "Retracted" && panel.sunTracking) {panel.Extend();} //unchanged
else if (panel.sunTracking && panel.retractable){panel.Retract();} //unchanged
}
}
}

The trick is the if(typeof(ModuleDeployableSolarPanel).IsAssignableFrom(pm.GetType())) line. What this does is check if that partmodule is, or inherits, ModuleDeployableSolarPanel.

So a 3rd party mod partModule as follows:

 class 3rdPartySolarPanel : ModuleDeployableSolarPanel
{
//stuff
}

would be caught by the above code without needed to specifically add it. The one catch is that the part has to use the default Extend and Retract events still. If it does not it will need to be added individually, but there is no way around that because you can't get the name of the new extend/retract actions via code, you have to manually add it.

Hope that makes sense.

D.

PS: I release this code into the public domain. It is part of a larger mod I have under development so to avoid any future license issues (I see you licensed as ARR), I am establishing this fact for when I release my mod.

Share this post


Link to post
Share on other sites
great mode, my suggestion for improve it:

-compatibilty with AVC-checker and C-KAN

-the plugin is actually a toggle, so it retract manually opened panels,...: maybe change it to switch alternatively to "retract all"/"open all"

-show the state of the switch: opened/closed, maybe a in game button like those for gear or lights/an icon for tool bar mod.

-configurable keybinding (in a settings.cfg) to easily solve conflict with other mod (precise node in map view for example),

-disable the function in map view

maybe you want to keep it simple (as you said there is action group/other mod like ship manifest/action group extended for more complexe operations) but that is what i would like to complete them,

i need your plugin mostly for:

-testing ship and dont assign all those news panels each time, i'm lazy ;) , (tweakable everthing is great for this too but need more clicks)

-open them all while in space(exept those covered of course)

-retract them all for reentry/docking/landing/emergency/...,reset the mess when docking a ship with panels opened to an other with them closed

thank you for sharing your work

Interesting.

Can I recommend one change though?


foreach (Part shipPart in FlightGlobals.ActiveVessel.parts) //unchanged
{
foreach(PartModule pm in shipPart.Modules) //cycle through all partModules on the part
{
if(typeof(ModuleDeployableSolarPanel).IsAssignableFrom(pm.GetType())) //the trick, see comment below
{
ModuleDeployableSolarPanel panel = (ModuleDeployableSolarPanel)pm; //this is true, the if statement the previous line ensures it
if (panel.status == "Retracted" && panel.sunTracking) {panel.Extend();} //unchanged
else if (panel.sunTracking && panel.retractable){panel.Retract();} //unchanged
}
}
}

The trick is the if(typeof(ModuleDeployableSolarPanel).IsAssignableFrom(pm.GetType())) line. What this does is check if that partmodule is, or inherits, ModuleDeployableSolarPanel.

So a 3rd party mod partModule as follows:

 class 3rdPartySolarPanel : ModuleDeployableSolarPanel
{
//stuff
}

would be caught by the above code without needed to specifically add it. The one catch is that the part has to use the default Extend and Retract events still. If it does not it will need to be added individually, but there is no way around that because you can't get the name of the new extend/retract actions via code, you have to manually add it.

Hope that makes sense.

D.

PS: I release this code into the public domain. It is part of a larger mod I have under development so to avoid any future license issues (I see you licensed as ARR), I am establishing this fact for when I release my mod.

Thanks for all the useful feedback. I should have some free time tomorrow where I can make these changes.

Share this post


Link to post
Share on other sites

This is one of my favorite additions to the game. Any progress on CKAN and other updates?

Share this post


Link to post
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.