API:Staging

From Kerbal Space Program Wiki
Revision as of 20:50, 5 October 2012 by N3X15 (talk | contribs) (N3X15 moved page Staging to API:Staging)
Jump to: navigation, search

The Staging class provides some information about the staging of the rocket, and also provides a function that lets you activate the next stage from code as if the user had pressed the space bar.

This class also seems to handle user interaction with the staging icon list (dragging icons around).

Note that in KSP the stages count DOWN as you go through the stages in your rocket, so that the LAST stage is stage zero. The stage a part activates in is given by Part.inverseStage.

Useful members

Note: this is not a complete listing of the class's members. It includes only the members that someone has figured out how to use and written an explanation for. If you figure out what the other members that aren't listed here do, you should add them to the list!

static void ActivateNextStage() Activates the next stage of the rocket just as if the user had pressed space.
static void ActivateStage(int stage) Activates the given stage, even if it's not the next stage.
static int StageCount { get; } The stage number of the initial stage of the rocket. You can test to see if the rocket is still on the pad by testing whether (Staging.CurrentStage == Staging.StageCount)
int CurrentStage { get; } The stage number of the currently active stage of the rocket. This decrements by one every time a new stage is activated, until it reaches zero when the final stage is activated.