Jump to content

Basic Help: Close / Open all solar panels / Radiators


Recommended Posts

Hi,

I've got this idea to help me start understanding how to mod, can anyone give me any ideas how to open and close all solar panels and radiators?

Thanks

GE

Scenario 1:

GIVEN:

I am on the ground

WHEN:

I am stationary and my solar panels are not open

THEN:

I open all solar panels and radiators

Scenario 2:

GIVEN:

I am on the ground

WHEN:

My speed is > 0 and my solar panels are open

THEN:

I close all solar panels and radiators

Scenario 3:

GIVEN:

I am not on the ground

WHEN:

Atmosphere Pressure > 0 and my solar panels are open

THEN:

I close all solar panels and radiators

Link to comment
Share on other sites

In this case, I will point you to the classic KSP modding trick of looking at another person's code.

One of the biggest benefits of the requirement that all mods post their source, just be aware of the license the mod is released under as you have to respect that when copying code.

In this case, The solar panel action group mod extends and retracts all solar panels with the P key.

Note my comment about the license earlier, this mod is licensed All Rights Reserved so you can't copy it's code. What you can do however is use it to figure out how to interface with the Solar Panels.

As there is no API documentation, looking at other peoples work is one of the few ways we have of figuring out the API and what different commands actually do.

While you want to make conditional triggers, the extending and retracting part should be pretty similar and that should get you going.

D.

Edited by Diazo
Link to comment
Share on other sites

Diazo: Thanks.

Sarbian, that is awesome I've quickly glanced at the code and it seems to be fairly simple.

My idea is for rovers. I'm always ripping the cells off because I forgot to retract them after stopping to recharge! I love mechjeb, it doesn't like retrograde orbits but that's fine :)

Link to comment
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
×
×
  • Create New...