XMLDocumentation
The application launcher is the set of buttons that appear in the upper right, including
for example the resource tab. You can add your own buttons to this toolbar.
See http://forum.kerbalspaceprogram.com/threads/86682-Appilcation-Launcher-and-Mods?p=1303921#post1303921
Don't try to add buttons before ApplicationLauncher.Ready is true. If it's currently false, you
can register for the GameEvents.onGUIApplicationLauncherReady event which will fire when the
application launcher becomes ready to have buttons added to it.
Add a MOD(3rd party) application to the Application Launcher. Use ApplicationLauncherButton.VisibleInScenes to set where the button should be displayed.
Note that the application launcher is destroyed when the player exits to the main menu. If the player then
loads up a new save the application launcher will be recreated and you will have to re-add your button.
Register for GameEvents.onGUIApplicationLauncherDestroyed and GameEvents.onGUIApplicationLauncherReady
to detect when the application launcher has been destroyed and when it has been re-created.
Callback for when the button is toggeled on
Callback for when the button is toggeled off
Callback for when the mouse is hovering over the button
Callback for when the mouse hoveris off the button
Callback for when the button is shown or enabled by the application launcher
Callback for when the button is hidden or disabled by the application launcher
The "scenes" this button will be visible in. For example VisibleInScenes = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW;
The 38x38 PackedSprite animation to use for the button icon. Use ApplicationLauncherButton.PlayAnim() to play the animation.
Add a MOD(3rd party) application to the Application Launcher. Use ApplicationLauncherButton.VisibleInScenes to set where the button should be displayed.
Note that the application launcher is destroyed when the player exits to the main menu. If the player then
loads up a new save the application launcher will be recreated and you will have to re-add your button.
Register for GameEvents.onGUIApplicationLauncherDestroyed and GameEvents.onGUIApplicationLauncherReady
to detect when the application launcher has been destroyed and when it has been re-created.
Callback for when the button is toggeled on
Callback for when the button is toggeled off
Callback for when the mouse is hovering over the button
Callback for when the mouse hoveris off the button
Callback for when the button is shown or enabled by the application launcher
Callback for when the button is hidden or disabled by the application launcher
The "scenes" this button will be visible in. For example VisibleInScenes = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW;
The 38x38 Texture to use for the button icon.
Register a method that will be called when the ApplicationLauncher GUI hides itself.
Register a method that will be called when the ApplicationLauncher moves from the top
right to the bottom right, or vice versa.
Register a method that will be called when the ApplicationLauncher GUI shows itself.
Reverses the effect of EnableMutuallyExclusive()
Makes your application hide the stock applications when opened, and makes stock applications hide
your appliction when opened.
Removes your button from the application launcher toolbar.
Un-register a method that will be called when the ApplicationLauncher GUI hides itself.
Un-register a method that will be called when the ApplicationLauncher moves from the top
right to the bottom right, or vice versa.
Un-register a method that will be called when the ApplicationLauncher GUI shows itself.
The single instance of ApplicationLauncher; call all the methods of this class using this instance.
Whether the application launcher toolbar is positioned in the top right or in the bottom right
(it's in the bottom right in the editor).
Or together these flags and pass them to AddModApplication to specify when your button
should appear on the application launcher toolbar.
The old, deprecated class that implemented jet engine parts before PartModules.
Use an appropriately configured ModuleEngines instead of this class.
Each part on a vessel is represented by a Part object. Plugins can add new functionality to parts by defining new
PartModules, which can then be added to Parts. It is also possible to define new subclasses of Part, but this
is deprecated in favor of PartModules.
Whether this part will actually activate if it schedule to be activated in the same stage as it
is decoupled from the rocket. In particular, sepratrons must have ActivatesEvenIfDisconnected set
to true if they are to function properly.
Whether this part is attached to its parent via a stack AttachNode or a surface AttachNode.
An AttachNode represents the link between two attached parts. attachNodes is a list of possible nodes to
which other parts can be attached to this part. You can find the parts that actually are attached using
AttachNode.attachedPart.
The parts that are children of this part in the part tree (parts that were attached to this part in the editor
after this part was already part of the vessel).
How many crew members this part can fit.
Unused?
Unused?
A unique identifider for this part. Note that despite the name, each part on the same vessel will still have a different value in this field.
This value is persistent and not affected by game load or docking/undocking or similar.
This is the 'uid' value at the PART level of the persistent.sfs file.
Whether this part allows fuel crossfeed.
In the flight scene, fuelLookupTargets is the list of fuel lines through
which this part can draw fuel. Also if this part is a docking node docked
to a another docking node through which it can draw fuel, then the attached
docking node will also be in fuelLookupTargets.
The stage in which this part will activate, as shown in the staging display. (Possibly called inverseStage
because the stages in KSP count down instead of up).
The DRY mass of this part, not including the mass of any resources it contains
The drag coefficient of this part is equal to (total mass) * (maximum_drag)
The temperature at which this part will explode.
Unused.
A unique identifier assigned to the part when the vessel it is a part of is created.
All parts on the vessel get the same missionID and it does not change.
Splitting a vessel with a decoupler will result with two vessels whose parts have the same missionID.
When two vessels spawned seperately dock, each part keeps its original missionID, undocking does not change this field either.
Specifies the name of a node through which this part will NOT draw resources. See the part.cfg of the
stock tricoupler for an example of using this to prevent fuel from flowing backwards.
Add a function to this callback and it will be called when your part is attached to another part in the editor.
Add a function to this callback and it will be called when your part is deleted in the editor.
Add a function to this callback and it will be called when your part is detached, or is part of a set of parts
that are detached, in the editor.
Add a function to this callback and it will be called when your part is about to be destroyed during flight.
The parent of this part in the part tree: the part to which this part was attached in the editor.
Some of the part info that is displayed about this part in the editor.
If physicalSignificance == Part.PhysicalSignificance.NONE, then this part doesn't actually
have any physics. In particular, it has no mass, regardless of what its "mass" field is set to, and no drag.
Unused?
IF this part is surface-attached to its parent, srfAttachNode is the attach node describing this connection.
The sicon shown for this part in the staging display.
The temperature of this part, in some arbitrary units.
The purpose of uid is unknown. It changes everytime a vessel is swithched to, even within the same flight scene.
Swith to a nearby vessel and back with [ and ] and the uid of the parts on a vessel will change.
This value does not save to persistent.sfs, the uid value at the PART level is the part.flightID value instead.
The vessel to which this part belongs. Beware that vessel == null in the editor.
Add a PartModule to this part. PartModules that are dynamically added to parts and don't exist in the original
part.cfg will not be properly restored from persistence.
The class name of the PartModule to add, as a string
The added PartModule
Deprecated.
Calling this causes the part to explode. But you guessed that, didn't you?
Find an AttachNode by its name, as a string.
The name of the node to search for. The names of nodes are found in the part.cfg. For instance,
node_stack_top describes a node with name "stack_top."
The AttachNode of the given name.
Given a child part of this part, find the AttachNode representing the connection between this
part and that child.
A child part of this part.
The AttachNode connecting this part to the given child.
Activates the part now, regardless of when it was scheduled to be activated in the staging order.
The total mass of the resources held by the part. The total mass of the part is mass + GetResourceMass()
Total resource mass, in tonnes
Deprecated.
Deprecated.
Don't use this; use Vessel.orbit instead.
A list of the resources contained by this part. You can loop over them with
foreach(PartResource resource in part.Resources) { ... }
The rigidbody of this part. See the Unity documentation on rigidbodies for more information.
Represents whether a part has physics.
Part is a normal, physics-enabled part.
Part has no physics, and in particular no mass or drag.
An AttachNode represents the physical connection between a Part and its parent Part.
The part attached to this node. Null if no part is attached.
Whether this node is a surface-attach node, a stack node, or a docking node.
Wether or not resource cross feed can pass through this node.
A stack node, like the connections between stacked fuel tanks
A surface node, like the connection between a radial decoupler and its parent.
The type of node that connects two docking ports?
An AvailablePart object contains the summary information about a single type of part
which is shown in the editor.
Which tab this part shows up in in the editor.
The cost of this part, as displayed in the editor.
The description of this part, as displayed in the editor?
Does this include the GetInfo() of the part's PartModules?
The name of this kind of part, as specified in the "name =" line of its part.cfg.
The object that gets cloned when you create a new instance of this part in the editor?
A BaseAction object is the basic action object.
There is one of these automatically created for each 'KSPAction' field in a partModule
Unconfirmed: The action groups this action is currently assigned to.
Is this action available? Setting this false disables the action so it will not show in the available actions list.
Unconfirmed: Assign this action to action groups upon creation ('Gear' group for landing legs)
Name shown in editor action groups panel
Information about what the action is attached to.
listParent.module = partModule this action is a memeber of
listParent.part = part this action is a member of
Name of the action group as seen in code where the KSPAction field exists
Activate this action. Note that there is no toggle activation, you must check state yourself in code
and activate or deactivate as appropriate
**Example code start to activate an action: KSP version 0.24.2**
KSPActionParam actParam = new KSPActionParam(KSPActionGroup.None, KSPActionType.Activate); //okay to create this new just before invoking
exampleAction.Invoke(actParam); //action defined as a KSPAction in a partModule
**Example code start to deactivate an action: KSP version 0.24.2**
KSPActionParam actParam = new KSPActionParam(KSPActionGroup.None, KSPActionType.Deactivate); //okay to create this new just before invoking
exampleAction.Invoke(actParam); //action defined as a KSPAction in a partModule
A BaseActionList is an object to manipulate actions.
The partModule this list of actions belongs to
The Part this list of actions belongs to
Identical to System.IO.BinaryReader, but with added IDisposable methods (for use in using structures), and a factory method instead of constructors.
Create a binary reader with the desired filename.
Close the stream and any resources (e.g. files) it has open.
Read a block of bytes from the stream.
Read a block of chars from the stream.
Identical to System.IO.BinaryWriter, but with added IDisposable methods (for use in using structures), and a factory method instead of constructors.
Create a binary file writer.
The Sun, the planets, and the moons are all CelestialBodies.
The magnitude of the angular velocity of the body's rotation, in radians per second.
The body's angular velocity vector, in rotations per second. This points along the axis of
rotation and its magnitude is the rotation rate in radians per second.
Whether this body has an atmosphere
Presumably, whether jet engines will work in this body's atmosphere
Seems to be the pressure of the body's atmosphere at sea level, in units of Kerbin atmospheres at sea level.
Appears to only have an effect when useLegacyAtmosphere is toggled on
The atmosphere's scale height, in KILOMETERS (not meters). The atmospheric pressure at a given altitude
above sea level is proportional to Math.Exp(-altitude / atmosphereScaleHeight).
The name of the body, as a string.
The gravitational acceleration of the body at sea level, in units of gees (1 gee = 9.81 m/s^2)
The gravitational acceleration (in m/s^2) at a radius r (in m) from the body's center is gMagnitudeAtCenter / r^2
The gravitational parameter GM is the universal gravitational constant G times the mass M of the body.
In KSP the gravitational constant G is exactly 6.673 m^3 / (kg s^2), and the body mass is measured in
kilograms.
Unused?
The mass of the body in kilograms. Computed
The height of the upper edge of the body's atmosphere, in meters above sea level. Except,
not really. The atmosphere really cuts off at an altitude (in meters) of
body.atmosphereScaleHeight * 1000 * Math.Log(1e6)
Whether this planet has an ocean at "sea level"
this is what gives the celestial body its orbit and makes it go along the orbit as well
A list of this body's moons (or, in the case of the Sun, a list of the planets).
The pqsController computes the terrain of the planet. Note that for the Sun, pqsController = null.
The radius of the planet in meters. Note that this is only the radius of "sea level"; the actual terrain may be higher.
The time, in seconds, for the body to complete one rotation around its axis
The radius of this body's sphere of influence (measured from the center of the body), in meters.
Presumably, whether this body is tidally locked to the body around with it orbits.
Presumably, this gives the minimum altitude you must have in order to be allowed to use each
warp rate when in this body's sphere of influence.
It appears that this setting toggles between old and new atmosphere system
Gets the height of a given position above this body's sea level, in meters.
A position in world coordinates
Altitude in meters
The velocity of the CelestialBody, {AliceWorld, Sun}. (See Orbit.cs for
the reference frame definitions).
Gets the latitude of a given position, in degrees.
A position in world coordinates
Latitude in degrees
Gets the longitude of a given position, in degrees. Note that you CANNOT count on this value being in any particular range.
This function may for example return 420, meaning 60 degrees east. You would be well advised to coerce it into a standard
range like -180 to 180 before using it.
A position in world coordinates
Longitude in degrees
Returns a vector pointing from the center of the body to the given latitude, longitude, and altitude.
Latitude in degrees
Longitude in degrees
Altitude above sea level in meters
A position vector relative to the center of the body
Returns the velocity at a given position of the frame of reference that rotates with the planet.
This velocity is the difference between the "orbit" and "surface" velocities.
A position in world coordinates
Velocity of the rotating reference frame
Returns a unit vector perpendicular to the surface of the body at the given latitude and
longitude (pretending for the moment that the body is a perfect sphere).
Latitude in degrees
Longitude in degrees
A unit normal vector to the surface
Returns the position, in world coordinates, of a given latitude, longitude, and altitude
Latitude in degrees
Longitude in degrees
Altitude above sea level in meters
Position in world coordinates
Returns the body's altitude above the reference sphere of its primary
Implements IDiscoverable
Returns the body's mass, in kg
Implements IDiscoverable
Returns the body's tracking station name
Implements IDiscoverable
Describes the state of the body
A string containing the sphere of influence and trajectory of the object
"Orbiting the Sun"
Implements IDiscoverable
Returns the body's speed
Implements IDiscoverable
Returns the type of the body
One of "Sun", "Planet", or "Moon"
Implements IDiscoverable
Describes to what extent this body has been explored
Describes the orbit of this body around its primary.
The position of the center of the body, in world coordinates.
Presumably, the body this body orbits around
A ConfigNode represents a collection of data that can be serialized to or deserialized from a file.
A ConfigNode contains a set of values, and optionally
one or more ConfigNodes, so they can be used recursively.
Add a sub-ConfigNode with a given name to this node.
The name of the new node
The newly created sub-ConfigNode
Add a new piece of data to this ConfigNode. Values show up in serialized ConfigNodes as lines of the form
name = value
The name of the new value.
The data to store.
Add a new piece of data to this ConfigNode. Values show up in serialized ConfigNodes as lines of the form
name = value
The name of the new value.
The data to store.
Remove all nodes and values?
Remove all sub-ConfigNodes from this ConfigNode?
Remove all values from this ConfigNode?
Copies the contents of this node into a different ConfigNode
The ConfigNode to copy this one into.
Create a ConfigNode from a given object. This function will use reflection to scan the given object
looking for fields with the [Persistent] attribute. When it finds such a field
it adds it as a name-value pair to the returned ConfigNode. The name wil be the name
of the field, and the value will the the serialized version of the field's data.
The object to scan to create a ConfigNode
A ConfigNode containing the persistent fields of the object.
Like CreateConfigFromObject, but only pays attention to fields with the "pass"
field of the [Persistent] attribute set to pass.
The object to scan to create a ConfigNode.
A flag indicate which fields to serialize.
A ConfigNode containing the desired persistent fields of the object.
Initialize an existing object using data from the ConfigNode. This method
will scan the object looking for fields with the [Persistent] attribute. When it
finds such a field, it looks in the ConfigNode for a matching name-value pair, and then
parses the value and sets the field to the result.
The object to initialize
The ConfigNode used to initialize the object.
Like LoadObjectFromConfig, but only pays attention to fields for which the "pass"
field of the [Persistent] attribute is equal to pass.
The object to initialize
The ConfigNode used to initialize the object.
A flag indicating which fields to initialize.
Seralize this ConfigNode to a file.
A filename (absolute path?)
?
Seralizes this ConfigNode to a string.
A serialized version of this ConfigNode
The different controls that it is possible to lock the player out of
using InputLockManager. You can OR them together to lock the player
out of multiple controls at once.
TaranisElsu compiled this list of the binary values of the enum members as of KSP 0.24.2, which makes
it clearer which controls are locked in each case:
None 0
PITCH 1
ROLL 100
YAW 1000
THROTTLE 10000
SAS 100000
PAUSE 1000000
STAGING 10000000
CAMERAMODES 1 00000000
MISC 10 00000000
CAMERACONTROLS 100 00000000
TIMEWARP 1000 00000000
MAP 10000 00000000
LINEAR 100000 00000000
QUICKSAVE 1000000 00000000
QUICKLOAD 10000000 00000000
VESSEL_SWITCHING 1 00000000 00000000
CUSTOM_ACTION_GROUPS 10 00000000 00000000
GROUP_ABORT 100 00000000 00000000
GROUP_GEARS 1000 00000000 00000000
GROUP_LIGHTS 10000 00000000 00000000
GROUP_BRAKES 100000 00000000 00000000
GROUP_STAGE 1000000 00000000 00000000
GROUPS_ALL 1111110 00000000 00000000
ACTIONS_SHIP 10000000 00000000 00000000
ACTIONS_EXTERNAL 1 00000000 00000000 00000000
ACTIONS_ALL 1 10000000 00000000 00000000
RCS 10 00000000 00000000 00000000
WHEEL_STEER 100 00000000 00000000 00000000
WHEEL_THROTTLE 1000 00000000 00000000 00000000
EVA_INPUT 10000 00000000 00000000 00000000
EDITOR_ICON_HOVER 100000 00000000 00000000 00000000
EDITOR_ICON_PICK 1000000 00000000 00000000 00000000
EDITOR_TAB_SWITCH 10000000 00000000 00000000 00000000
EDITOR_SAVE 1 00000000 00000000 00000000 00000000
EDITOR_LOAD 10 00000000 00000000 00000000 00000000
EDITOR_EXIT 100 00000000 00000000 00000000 00000000
EDITOR_NEW 1000 00000000 00000000 00000000 00000000
EDITOR_LAUNCH 10000 00000000 00000000 00000000 00000000
EDITOR_UI_TOPRIGHT 11111 00000000 00000000 00000000 00000000
EDITOR_PAD_PICK_PLACE 100000 00000000 00000000 00000000 00000000
EDITOR_PAD_PICK_COPY 1000000 00000000 00000000 00000000 00000000
EDITOR_EDIT_STAGES 10000000 00000000 00000000 00000000 00000000
EDITOR_EDIT_NAME_FIELDS 1 00000000 00000000 00000000 00000000 00000000
EDITOR_ROTATE_PARTS 10 00000000 00000000 00000000 00000000 00000000
EDITOR_UNDO_REDO 100 00000000 00000000 00000000 00000000 00000000
EDITOR_SYM_SNAP 1000 00000000 00000000 00000000 00000000 00000000
EDITOR_OVERLAYS 10000 00000000 00000000 00000000 00000000 00000000
EDITOR_MODE_SWITCH 100000 00000000 00000000 00000000 00000000 00000000
EDITOR_UI_TOPBAR 100001 00011111 00000000 00000000 00000000 00000000
EDITOR_UI 101101 10011111 00000000 00000000 00000000 00000000
EDITOR_SOFT_LOCK 111110 01100000 11100000 00000000 00000000 00000000
EDITOR_LOCK 111110 01100000 11100000 00000000 00000100 00000000
TRACKINGSTATION_UI 1000000 00000000 00000000 00000000 00000000 00000000
TRACKINGSTATION_ALL 1000000 00000000 00000000 00000000 00001100 00000000
KSC_FACILITIES 10000000 00000000 00000000 00000000 00000000 00000000
KSC_UI 1 00000000 00000000 00000000 00000000 00000000 00000000
KSC_ALL 1 10000000 00000000 00000000 00000000 00001100 00000000
APPLAUNCHER_BUTTONS 10 00000000 00000000 00000000 00000000 00000000 00000000
ALL_SHIP_CONTROLS 11111111 11111111 11111111 11111111 11111111 11111110 00100010 10111111
All 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
The old, deprecated class that used to be used to implement decouplers before PartModules.
Use ModuleDecouple or ModuleAnchoredDecoupler instead.
An old, deprecated class that used to be used to implement decouplers before PartModules.
Use ModuleDecouple or ModuleAnchoredDecoupler instead.
Static methods used by asteroids
Generates an suitably science-y asteroid name
A random string of the form "XXX-###".
Represents the "remote sensing" information available for an IDiscoverable
this.fadeUT = this.lastObservedTime + this.unobservedLifetime
Tracking station wrapper for IDiscoverable.RevealAltitude()
Requires DiscoveryLevels.StateVectors
Tracking station wrapper for IDiscoverable.RevealSituationString()
Requires DiscoveryLevels.StateVectors
Tracking station wrapper for IDiscoverable.RevealSpeed()
Requires DiscoveryLevels.StateVectors
Tracking station wrapper for IDiscoverable.RevealMass()
Requires DiscoveryLevels.Appearance
Tracking station wrapper for IDiscoverable.RevealType()
Requires DiscoveryLevels.Appearance
Tracking station wrapper for this.objectSize
Always visible
Tracking station wrapper for Level?
Always visible
Tracking station wrapper for GetSignalStrength()
Rounded to the nearest 0.1%.
Always visible
Tracking station wrapper for IDiscoverable.RevealName()
Requires DiscoveryLevels.Name
Tracking station wrapper for GetSignalStrengthCaption()
Always visible
Initializes a Class C asteroid
The vessel or celestial body to which this DiscoveryInfo applies
The amount of knowledge for the asteroid
The amount of time the asteroid can remain untracked
before disappearing
Initializes a Class C asteroid, and assumes all properties are already known.
The vessel or celestial body to which this DiscoveryInfo applies
The amount of time the asteroid can remain untracked
before disappearing
Initializes a Class C asteroid, and assumes all properties are already known.
The vessel or celestial body to which this DiscoveryInfo applies
Returns a text description of the signal strength
If is in [0.0, 0.2), returns "Very Weak"
If is in [0.2, 0.4), returns "Weak"
If is in [0.4, 0.6), returns "Average"
If is in [0.6, 0.8), returns "Good"
If is in [0.8, 1.0], returns "Strong"
Returns long description of asteroid type
The asteroid type to label
The asteroid class explanation printed on the tracking station's info panel.
"Class C Objects are about average-sized..."
If not a valid value of UntrackedObjectClass, returns "This seems to be a non-standard size class. Who knows what it'll look like?"
Returns asteroid size displayed in map view
The asteroid type to label
The asteroid class printed beneath an untracked asteroid.
"C (Medium)"
If not a valid value of UntrackedObjectClass, returns "???"
Returns the fraction of the asteroid's unobservedLifetime that remains
The time at which the signal life is measured
GetSignalLife(t_discover) == 1.0
GetSignalLife(fadeUT) == 0.0
Returns amount of time remaining until the asteroid is lost, in units of referenceLifetime
The time at which the signal strength is measured
GetSignalStrength(t_discover) == unobservedLifetime / referenceLifetime
GetSignalStrength(fadeUT) == 0.0
Function testing if an asteroid has a particular discovery level
The flag(s) whose presence must be tested.
True if at least one of the flags in is in
this object, false otherwise
Logs an asteroid observation
The new time of last observation
Sets the level of knowledge the player has for the asteroid
The flags representing the asteroid's exploration state
Updates the reference lifetime
Changes the scaling of signal strength.
Updates the time for which the asteroid can go untracked, preserving class invariants
The maximum time to track the asteroid
Updates the asteroid size
The asteroid class (A-E)
The time at which the asteroid is scheduled to be deleted
The time at which the asteroid was last tracked
Stored in persistence file
The asteroid's tracking state
Stored in persistence file as state
The size class (A-E) of the asteroid
Stored in persistence file as size
The time for which an asteroid can go untracked if it starts at full signal strength
Alternate definition: the time needed for the signal strength to fall by 1 unit.
Always equals 86400 × ScenarioDiscoverableObjects.maxUntrackedLifetime.
For the default spawn settings, this is 1728000 seconds, or 20 Earth days.
Stored in persistence file as refTime
The time for which the asteroid can go untracked before it is deleted
Stored in persistence file as lifetime
Describes an IDiscoverable object's state regarding tracking and exploration
Object has been detected in tracking station
Object has been tracked
Object is currently tracked
Unlocks mass and type fields; intended for discoverable CelestialBodies?
Alias for "all flags"
Set for docked asteroids and all normal ship parts.
An unused class; use ModuleDockingNode instead.
This class has information about what is going on in the editor. In particular see SortedShipList.
EditorLogic.fetch.ship.parts is a list of the parts in the ship currently under construction,
ordered by the order in which they were added to the ship.
A list of all parts in the vessel that is being edited.
A type used to generate GameEvents
Use this type with one accompanying type;
GameEvents.FromToAction,
GameEvents.HostedFromToAction,
GameEvents.HostTargetAction
are commonly used
See EventVoid for events that require no parameters
or EventReport for a different style
The type to be passed through on EventData.Fire()
Generate debug logs if true
The constructor used to create a new EventData
EventData<Vessel> myNewEvent = new EventData<Vessel>("myNewEvent");
Give the event a string name,
generally the same as the declared name
Add a method to be run when the EventData is fired.
This is generally done in an object's Start or Awake method, or a class' constructor.
Can be setup like:
GameEvents.someEventDataEvent.Add(yourMethod);
or
GameEvents.someEventDataEvent.Add(new EventVoid.OnEvent(yourMethod));
The method you want to add; must contain a single parameter
of the type matching that in the host EventData
Triggers the EventData
All of the methods added using Add are run after this.
Single parameter matching the type of the host EventData
Use this to give information relevant to the event
Remove a method from the list of methods to be run when the EventData is fired.
This is generally done in an object's OnDestroy method.
The method you want to remove; must contain a single parameter
of a type matching that in the host EventData
Any methods added to the event must match the delegate's parameters;
one parameter of the given type in this case.
A type used to generate GameEvents
Use this type with two accompanying parameters
The first type to be passed through on EventData.Fire()
The second type to be passed through on EventData.Fire()
Generate debug logs if true
The constructor used to create a new EventData
EventData<Vessel, CelestialBody> myNewEvent = new EventData<Vessel, CelestialBody>("myNewEvent");
Give the event a string name,
generally the same as the declared name
Add a method to be run when the EventData is fired.
This is generally done in an object's Start or Awake method, or a class' constructor.
Can be setup like:
GameEvents.someEventDataEvent.Add(yourMethod);
or
GameEvents.someEventDataEvent.Add(new EventVoid.OnEvent(yourMethod));
The method you want to add; must contain two parameters
of types matching those in the host EventData
Triggers the EventData
All of the methods added using Add are run after this.
A parameter matching the first type of the host EventData
Use this to give information relevant to the event
The second type of the host EventData
Remove a method from the list of methods to be run when the EventData is fired.
This is generally done in an object's OnDestroy method.
The method you want to remove; must contain two parameters
of types matching those in the host EventData
Any methods added to the event must match the delegate's parameters;
two parameters of the given types in this case.
A type used to generate GameEvents
Use this type with three accompanying parameters
The first type to be passed through on EventData.Fire()
The second type to be passed through on EventData.Fire()
The third type to be passed through on EventData.Fire()
Generate debug logs if true
The constructor used to create a new EventData
EventData<Vessel, CelestialBody, String> myNewEvent = new EventData<Vessel, CelestialBody, String>("myNewEvent");
Give the event a string name,
generally the same as the declared name
Add a method to be run when the EventData is fired.
This is generally done in an object's Start or Awake method, or a class' constructor.
Can be setup like:
GameEvents.someEventDataEvent.Add(yourMethod);
or
GameEvents.someEventDataEvent.Add(new EventVoid.OnEvent(yourMethod));
The method you want to add; must contain three parameters
matching the types of in the host EventData
Triggers the EventData
All of the methods added using Add are run after this.
A parameter matching the first type of the host EventData
Use this to give information relevant to the event
The second type of the host EventData
The third type of the host EventData
Remove a method from the list of methods to be run when the EventData is fired.
This is generally done in an object's OnDestroy method.
The method you want to remove; must contain three parameters
matching the types of in the host EventData
Any methods added to the event must match the delegate's parameters;
three parameters of the given types in this case.
A type frequently used as a parameter in GameEvents
An enum used to specify the type of EventReport;
see FlightEvents for the available types
A string message that can accompany the EventReport
The Part responsible for generating the EventReport
Usually the originating part name
The target of the event;
another part's name, the surface, blank, etc...
The active stage number when the EventReport is generated;
can be set to any integer; 0 by default
The EventReport constructor, generally used when firing an EventData event
that calls for an EventReport parameter
someEvent.Fire(new EventReport(...));
A type used to generate GameEvents
Use this type when there is no need to accompany the event with any parameters,
ie relevant Part, Vessel, CelestialBody, etc...
See EventData for events that require such extra information
Generate debug logs if true
The constructor used to create a new EventVoid
EventVoid myNewEvent = new EventVoid("myNewEvent");
Give the event a string name,
generally the same as the declared name
Add a method to be run when the EventVoid is fired.
This is generally done in an object's Start or Awake method, or a class' constructor.
Can be setup like:
GameEvents.someEventVoidEvent.Add(yourMethod);
or
GameEvents.someEventVoidEvent.Add(new EventVoid.OnEvent(yourMethod));
The method you want to add, should contain no parameters
Triggers the EventVoid
All of the methods added using Add are run after this.
Remove a method from the list of methods to be run when the EventVoid is fired.
This is generally done in an object's OnDestroy method.
The method you want to remove, should contain no parameters
Any methods added to the event must match the delegate's parameters; none in this case
Append a string to a file, or creates it if it doesn't exist.
Open a stream that appends to a file.
Open a stream that creates a file.
Open a stream that creates a file.
Delete a file in your IO sandbox.
Find out if a file in your IO sandbox exists.
Open a stream that operates on a file.
Open a stream that operates on a file.
Open a stream that writes to a file.
Read all the bytes from a file in your IO sandbox.
Read all lines from a file in your IO sandbox.
Read all the text from a file in your IO sandbox.
Write a bunch of bytes to a file on disk
Write an array of strings to a file, with each string becoming a line.
Write a string to a file.
A surrogate for System.IO.FileInfo.
Creates a System.IO.StreamWriter that appends text to the file represented by this instance of the System.IO.FileInfo.
Copies an existing file to a new file, disallowing the overwriting of an existing file.
Copies an existing file to a new file, allowing the overwriting of an existing file.
Creates a file.
Create a text reader stream.
Creates a KSP.IO.TextWriter that writes a new text file.
Decrypts a file that was encrypted by the current account using the System.IO.FileInfo.Encrypt() method.
Permanently deletes a file.
Encrypts a file so that only the account used to encrypt the file can decrypt it.
Moves a specified file to a new location, providing the option to specify a new file name.
Opens a file in the specified mode.
Opens a file in the specified mode with read, write, or read/write access.
Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.
Creates a read-only System.IO.FileStream.
Creates a System.IO.StreamReader with UTF8 encoding that reads from an existing text file.
Creates a write-only System.IO.FileStream.
Replaces the contents of a specified file with the file described by the current System.IO.FileInfo object, deleting the original file, and creating a backup of the replaced file.
Replaces the contents of a specified file with the file described by the current System.IO.FileInfo object, deleting the original file, and creating a backup of the replaced file. Also specifies whether to ignore merge errors.
Returns the path as a string.
Gets a string representing the directory's full path.
Gets a value indicating whether a file exists.
Gets or sets a value that determines if the current file is read only.
Gets the size, in bytes, of the current file.
Gets the name of the file.
This class is related to control of the main camera used in the flight scene. Its transform is the
parent of the actual Camera objects.
Returns the singleton FlightCamera object.
Enables mouse control of the camera.
Disables mouse control of the camera.
You can set this to change the look direction of the in-flight camera (value is in radians).
You can set this to change the look direction of the in-flight camera (value is in radians).
A FlightCtrlState is a snapshot of the state of all control inputs to a vessel at a given instant in time.
See FlightInputHandler.state and Vessel.OnFlyByWire.
Unused?
Unused? Landing gear are lowered by sending an Event.
Unused? Landing gear are raised by sending an Event.
Presumably, whether the EVA headlight is turned on.
Whether SAS is turned on.
The throttle setting; this must be between 0 and 1.
The pitch control input; this must be between -1 and 1.
Presumably, the pitch trim setting, i.e., the pitch input that will
be given if no other input is given.
The roll control input; this must be between -1 and 1.
Presumably, the roll trim setting, i.e., the roll input that will
be given if no other input is given.
The RCS x-axis control input.
The RCS y-axis control input.
The yaw control input; this must be between -1 and 1.
Presumably, the yaw trim input; i.e., the yaw input that will be
given if no other input is given.
The RCS z-axis control input.
Presumably, copies the state of the FlightCtrlState st into this FlightCtrlState object.
Presumably, whether this flight control represents "neutral" controls, i.e., no input and zero throttle.
FlightGlobals contains lists of all CelestialBodies and Vessels in the game.
It also provides static utility functions for computing the atmospheric and gravitational properties of CelestialBodies.
Use this FlightGlobals instance to access non-static members of FlightGlobals.
For example, the current target is FlightGlobals.fetch.VesselTarget.
The altitude above the sea level of the current main body of the given world space position.
World space position
Altitude above sea level
The altitude above the sea level of the current main body of the given world space position.
World space position
Altitude above sea level
The altitude above the sea level of the given body of the given world space position.
World space position
The body in question
Altitude above sea level
Converts an atmospheric pressure into an atmospheric density. Atmospheric density is what
appears in the KSP drag equation. This function seems to just multiply the input by 1.2230948554874
Use the output of getStaticPressure
An atmospheric density, suitable for use in calculating drag.
Finds the temperature at a given world space position.
World space position
Temperature
Finds the temperature at a given altitude above a given body.
An altitude (in meters?)
The body of interest
Temperture
Returns the gravitational *acceleration* vector at a given position.
Contrary to its name, it does *not* return force.
World space position
Gravitational acceleration vector
Returns the current dominant body?
Returns the body whose sphere of influence contains a given position?
World space position?
Returns the current atmospheric pressure?
Atmospheric pressure, in units of Kerbin's atmospheric pressure at sea level
Returns the atmospheric pressure at a given position. Feed the output of this
function into getAtmDensity to get the atmopsheric density.
World space position
Atmospheric pressure, in units of Kerbin's atmospheric pressure at sea level
Returns the atmospheric pressure at a given altitude above a given body
Altitude in meters?
The body in question
Atmospheric pressure, in units of Kerbin's atmospheric pressure at sea level
Returns the atmospheric pressure of a given body's atmopshere at a given position
World space position
The body in question
Atmospheric pressure, in units of Kerbin's atmospheric pressure at sea level
Sets the currently selected target vessel, celestial body, or docking node
The Vessel, CelestialBody, or ModuleDockingNode to target
The vessel the player is currently controlling.
A list of all CelestialBodies in the universe. Contents in 0.18.2:
Bodies[0] = Sun
Bodies[1] = Kerbin
Bodies[2] = Mun
Bodies[3] = Minmus
Bodies[4] = Moho
Bodies[5] = Eve
Bodies[6] = Dun
Bodies[7] = Ike
Bodies[8] = Jool
Bodies[9] = Laythe
Bodies[10] = Vall
Bodies[11] = Bop
Bodies[12] = Tylo
Bodies[13] = Gilly
Bodies[14] = Pol
Bodies[15] = Dres
Bodies[16] = Eeloo
The KSP formula for the drag force on a part is
(1/2) * DragMultiplier * part.mass * part.mass_drag * airspeed^2
Whether KSP is doing its computations in an inertial reference frame, or the reference frame that
rotates with the current dominant celestial body.
A list of all the Vessels that currently exist
The currently selected target vessel, celestial body, or docking node. If no target is selected, this is null.
FlightInputHandler stores some global information about the control of the current active vessel.
Use this FlightInputHandler instance to access non-static members of the class.
Presumably, whether precision mode is engaged.
Whether RCS is enabled.
Presumably, whether staging has been locked via Alt-L.
The FlightCtrlState that represents player input. You can change the on-screen throttle
by setting FlightCtrlState.state.mainThrottle.
Call this to set neutral controls; in particular this wil turn off the throttle.
Whether RCS is enabled.
Represents a function of one variable. The function is interpolated from a given set of points,
and optionally the tangents at those points can be specified.
Evaluate the function at a given value of the input parameter.
The input parameter (not necessarily a time).
The value of the function.
Stock fuel lines are not yet PartModules, but are implemented through this class.
The part that can draw fuel through this fuel line. This fuel line in turn draws fuel from its parent.
The old, deprecated class that implemented fuel tanks before the resource system.
Don't use this class: to allow a part to store a resource add a RESOURCE block to the part.cfg.
An unused class.
GameEvents are EventData or EventVoid methods called when certain conditions are met.
Many include some relevant data on the objects affected when they are triggered.
Use:
GameEvents.desiredEvent.Add(yourMethod);
and
GameEvents.desiredEvent.Removed(yourMethod);
to add and remove methods from a list of methods to be called when the event is triggered.
Methods are generally added in your object's Start or Awake method and generally removed
in your object's OnDestroy method.
Be sure not add methods multiple times withoud destroying them between additions.
Triggered when a vessel docks or attaches with the grappling device;
fires twice, once for each vessel
Triggered when two parts collide
Triggered when a part or vessel crashes into the terrain
Triggered when a part crashes into the ocean
Triggered when an EVA Kerbal boards a vessel
Triggered whenever a Kerbal dies; either on EVA or in a crashing vessel
Triggered when a Kerbal goes on EVA
Triggered when changing SOI; both objects return the new dominant CelestialBody
See also onVesselSOIChanged
Triggered when any part is added or removed from a vessel in the editor;
also triggered when any tweakable settings are changed;
also when undo is called
When a flag is planted by an EVA Kerbal
Triggered when a flag is selected from the space center's flag pole
Triggered when a vessel is fully loaded
Deprecated?
When Funds level changes, returns total Funds amount
When the game is paused
Triggered upon scene change requests; returns the target GameScene
When Game Settings are applied in the main settings menu, or the in-game settings menu
When a game is first created or loaded; returns the Game object
Triggered on loading a game, returns the game's full ConfigNode from the persistent file
Triggered on saving a game, returns the game's full ConfigNode from the persistent file
Triggered when a game is saved, returns the Game object;
When the game is unpaused
When the application launcher (toolbar) is closed
Called when the ApplicationLauncher toolbar is ready to have buttons added to it.
When the astronaut complex window closes
When the astronaut complex window opens; from the space center or editor
When the vessel selection screen is closed or a vessel is selected and launched
When the launch screen (that allows you to view and select available vessels) is opened;
after selecting the launchpad/runway from the space center.
See VesselSpawnInfo for more on what is returned by this callback.
When a vessel is selected from the vessel selection screen at the space center
When the application launcher's message button is ready
When the mission control center window closes
When the mission control center window opens
When the application launcher (toolbar) loads;
triggers before onGUIApplicationLauncherReady and onGUIMessageSystemReady
When the recovery dialog window closes
When the recovery dialog window opens
When the R&D center window closes
When the R&D center window opens
Called when the player hides the UI by pressing F2. Register for this callback (and for onShowUI)
so that you can hide your UI too.
Triggered when input locks are activated or deactivated;
when putting the mouse over one window/button locks the controls
of another window/button
Deprecated? Use onPartJointBreak
Triggered when a new Kerbal is added in the astronaut complex scene;
also triggered when a rescue Kerbal contract is generated
Triggered when a Kerbal is removed from the roster in the astronaut complex;
also triggered when a rescue Kerbal contract is failed, expires, or declined
Triggered when the ProtoCrewMember.RosterStatus changes;
usually upon vessel recovery, new crew addition, or death;
returns the ProtoCrewMember and its old and new status
Triggered when the ProtoCrewMember.KerbalType changes;
KerbalTypes are possibly not fully implemented;
occurs upon hiring crew or rescuing Kerbal
Triggered upon starting or stopping asteroid tracking, or when approaching an asteroid
Triggered when a vessel's velocity falls below ~750m/s
Triggered when a vessel's velocity reaches ~750m/s
Triggered when launching by activating the first stage
Triggered when a new scene is loaded; returns that GameScene;
occurs after onGameSceneLoadRequested
Triggered when selecting a new flag from in the editor;
returns the flag texture's GameDatabse URL
Triggered when spawning a new asteroid or a new Kerbal for
a rescue Kerbal contract
Triggered when a part overheats; returns an EventReport with the part name
Triggered when right-clicking a part; returns that part;
triggered every time a part event is selected
Triggered when closing the right-click menu of a part
Triggered when adding a part in the editor, when docking, and when another vessel comes into range and is loaded;
returns the part and its new parent part
Triggered when a docking port or asteroid grappling device attaches;
returns the host part and the target part
Triggered when a part object's OnDestroy method is called;
occurs any time a part or vessel is unloaded,
ie scene changes or vessel moving out of loading distance
Triggered when a part is destroyed, usually by exploding/crashing
Triggered when a part explodes, usually due to crashing into the ground or into another part;
also triggered by a part overheating and exploding
Triggered when a part decouples, undocks, a grappling device undocks, a strut breaks,
a part is destroyed, or when a part is removed in the editor
Triggered when a part goes on rails (enters timewarp) or exits loading distance
Triggered when purchasing a part in the R&D center;
currently (KSP 0.24.2) called for all parts in a tech node when researching that node
Triggered when removing a part in the editor
Triggered upon undock event/action; not triggered by a docking node's decouple event;
also triggered by asteroid grappling device's release event
Triggered when a part goes off rails (exits timewarp) or comes into loading distance
Triggered when the map view or tracking station camera focuses on a new object;
this can be a Celestial Body or vessel;
also triggered when switching to or loading a new vessel
Triggered when a ProgressNode and all of its subNodes are completed.
See also OnProgressReached and OnProgressComplete
Triggered when all sub ProgressNodes within a given ProgressNode are completed;
records the UT of node completion and returns the ProgressNode
See the ProgressTracking module in the persistent.sfs file for more on how ProgressNodes
are setup and saved.
If the ProgressNode is completed upon first achievement this will also trigger OnProgressReached.
See also OnProgressReached and OnProgressAchieved
Triggered when a ProgressNode is first reached but not completed;
records the UT of node achievement and returns the ProgressNode.
For instance, when a vessels first enters the SOI of a new Celestial Body
the event will trigger and a "reached" entry will be added to the persistent.sfs file.
If a ProgressNode is completed at the same time it is reached (ie has no ProgressNode subNodes)
OnProgressCompelete will be triggered at the same time
See the ProgressTracking module in the persistent.sfs file for more on how ProgressNodes
are setup and saved.
See also OnProgressComplete and OnProgressAchieved
When reputation level changes; returns total rep amount
Triggered when reference frame changes (ie from inertial to rotating);
this is generally accompanied by a shift in the camera position
and a debug log message ("Reference Frame: Rotating/Inertial")
Triggered when two docking ports on the same vessel dock together
Triggered when two docking ports on the same vessel undock
When science level changes; returns total science amount
Triggered science data is transmitted or recovered; returns the amount of science and the ScienceSubject
Called when the player un-hides the UI by pressing F2. Register for this callback (and onHideUI)
so that you can un-hide your UI too.
Triggered when engine exhaust damages another part
Triggered upon staging, returns the stage number
Triggered by decoupler staging;
also triggered by separation through a decoupler's right-click menu event
Triggered when researching a tech node in the R&D center;
triggers whether or not you have enough science to unlock the node
Triggered whenever timewarp rate changes; applies to physics and non-physics timewarp;
triggered by the key press also (called even if you are at max/min timewarp already)
Deprecated? Use onPartUndock
Triggered when switching to a different vessel, loading a vessel, or launching
Triggered when a vessel is launched, or created by undocking, decoupling, planting a flag, or EVA;
also triggered by new asteroid creation and rescue Kerbal contracts
Triggered when a vessel instance is destroyed;
any time a vessel is unloaded, ie scene changes, exiting loading distance
Triggered when a vessel is loaded on the launchpad, when a vessel enters within loading distance,
or when a vessel goes off of time warp
Triggered when a vessel exits loading distance or enters time warp
Triggered whenever a vessel's load method is called
Triggered when a closed orbit is reached
Triggered when orbit eccentricity becomes > 1
Triggered after a vessel has been recovered and the science data
and part values have been accounted for;
occurs in the space center or tracking station.
Triggered after onVesselRecoveryProcessing
Triggered in the space center or tracking station when a vessel is recovered;
occurs before onVesselRecovered
Triggered a vessel is recovered (the big green button at the top) from the flight scene
Returns old 'from' vessel name and new 'to' vessel name
Triggered when vessel is loaded onto the launchpad from the editor/launch selection window;
called after the transition to flight scene
Returns old and new vessel situations
Returns old and new Celestial Body
Triggered when a vessel is deleted from the tracking station
Triggered when any aspect of a vessel changes;
docking, undocking, decoupling, parts breaking, crash, etc...
Triggered when a vessel crashes, or passes into the atmosphere;
when an EVA Kerbal boards, or when an asteroid is despawned
Game events related to contract status changes;
the contract in question is returned as EventData for most events
Triggered when a contract is accepted through the mission control center
Triggered upon cancellation of an active contract through the mission control center
Triggered upon successful contract completion
Triggered when a new contract is offered, or a contract expires or completes
Triggered by the ContractSystem Scenario Module loading existing contracts
Triggered by declining an offered contract from the mission control center
Triggered when a contract fails for any reason
Triggered when a contract finishes for any reason, success or failure
Triggered when the contract is first offered in the mission control center
Triggered whenever an individual contract parameter changes state;
from Incomplete to complete for example
Game events related to vessel situation changes;
mostly related to progress tracking.
The Celestial Body in question and the vessel being
used are returned as EventData in most cases
Triggered upon escaping a celestial body's orbit;
triggered by onVesselSOIChanged, not by simply attaining an escape trajectory
Triggered upon entering a new celestial bodies SOI, the inverse of onEscape;
may not apply to the Sun, ie requires eccentricity > 1
Triggered upon landing or splashing down
Triggered upon entering orbit;
must be stable, with periapsis above the max atmospheric height and eccentricity < 1
Triggered the first time a sub-orbital situation is achieved
Triggered when landing on Kerbin after a flyby or orbiting a Celestial Body
Triggered when landing on Kerbin after landing on a Celestial Body
Used by onPartExplode
The distance between the exploding part and the active vessel
Some explosion magnitude variable; related to fuel content of the exploding part
Two objects; of the same type in all stock uses.
See onPartCouple for an example
The "originating" object
The "target" object
Two potentially different object types;
the From/To object (B) returns two values, generally the old and new.
See onVesselSOIChanged for an example
Host object
From/To Object
Two objects of the same or different type;
used generally in a manner similar to FromToAction.
See OnTechnologyResearched for an example
Host object
Target object
Used by onGUILaunchScreenSpawn
Exposes information on saved .craft files
Contains some functions you can call to save the game state to a persistence file, or load the game state from a persistence file.
Creates a persistence file containing the current game state. Probably persistent.sfs and quicksave.sfs are
generated by calls to this function.
The name of the persistence file to create (".sfs" will be appended to the file name).
The folder in which to create the save file. Try using HighLogic.SaveFolder.
Whether to overwrite, append, or abort if the given file already exists.
Returns the filename on success. Returns an empty string when the file already exists and SaveMode.ABORT is used.
An enum corresponding to the different Unity scenes in KSP
This class stores some very high-level information about the current game state.
Use this instance to access non-static members of this class.
Whether the game is currently in the VAB or SPH scenes.
Whether the game is currently in the flight scene.
The GUISkin used by the game. Set GUI.skin = HighLogic.Skin at the start of your GUI function to use it yourself.
Methods allowing information for celestial bodies or ships to be hidden at game start
These methods appear to be used in the tracking station.
Implemented by CelestialBody
Implemented by Vessel
Returns the object's altitude
The height above the reference sphere of the Celestial Body in
whose sphere of influence the object lies, in meters.
Returns the object's mass
Units are implementation-dependent.
Returns the object's tracking station name
The string to display in the tracking station
Describes the state of the object
A string containing the sphere of influence and trajectory of the object
"Orbiting the Sun"
Returns the speed of the object
The inertial speed relative to the Celestial Body in whose sphere of influence
the object lies, in meters per second.
Gives the type of object used
Meaning is implementation-dependent.
Describes to what extent this object has been explored
This class lets you lock the player out of certain controls. It's
probably what KSP uses internally to lock controls during time warp,
or when out of electric charge.
You can view the current set of locks in-game with the Alt-F12 debug menu.
The set of locks currently in place?
Unlock a set of controls that were earlier locked with SetControlLock.
The string ID passed to SetControlLock.
Locks a set of controls.
Which controls to lock. You can OR several ControlTypes together to lock several types of controls at once.
A unique string ID that you will pass to RemoveControlLock to unlock these controls.
?
If ControlTypes.X & LockMask != 0
then ControlTypes.X is locked?
A surrogate for System.IO.IOException.
Has some useful little tools and utilities.
Deserialize a binary serialized object
Return the full path for a given filename, provided a class from the plugin.
PluginData/[.flights/FLIGHT_UUID/]assemblyname/file
Serialize an object (same as using a BinaryFormatter).
Interface used by ModuleScienceExperiment and ModuleScienceContainer. Used for storing, transfering and transmitting Science Data.
Removes science data from the part, called after transmission or EVA data collection.
Returns an array of all Science Data stored in the module.
Returns a count of Science Data reports stored in the module.
Can the experiment be run more than once?
Opens the experimental results dialog page, displays stored Science Data.
Opens the experimental results dialog page, displays stored Science Data.
Kerbals on EVA are represented as vessels with a single part. That part contains a KerbalEVA PartModule.
Extending PartModule lets you add new functionality to parts. The main class of many plugins
will be a subclass of PartModule. See this forum thread for the official instructions on
using PartModule:
http://forum.kerbalspaceprogram.com/showthread.php/10296-0-15-code-update-PartModule-KSPField-KSPEvent-ConfigNode-and-PartResource
The return value of this function appears in the part's description in the editor.
Editor info for the part
This function is called once when the part gets activated.
This function gets called only once, during the KSP loading screen. See the Unity documentation on Awake for more information.
This function gets called once every Unity FixedUpdate cycle (once per physics frame) once the part has been activated.
If you want to be called even if the part has not been activated, define a function called void FixedUpdate() instead
of overriding OnFixedUpdate
See the Unity documentation on FixedUpdate for more information. You can get the time between FixedUpdates from
TimeWarp.fixedDeltaTime. Do any physics stuff in OnFixedUpdate, not OnUpdate.
When does this get called?
This function is called to initialize the part. The ConfigNode contains the parameters of the module
as specified in the part.cfg file, or as you last saved them in OnSave.
A ConfigNode containing the module's parameters from part.cfg or persistent.sfs
This function is called when the game is saved to let the part save persistent data. Add any data you want
to persist to the ConfigNode. The ConfigNode will then be saved as part of persistent.sfs.
When the game is resumed, you can then read this data back out in OnLoad.
Called when the flight starts, or when the part is created in the editor. OnStart will be called
before OnUpdate or OnFixedUpdate are ever called.
Some information about what situation the vessel is starting in.
Called once per Unity Update cycle once the part has been activated.
If you want to be called even if the part has not been activated, define a function called void Update() instead
of overriding OnFixedUpdate.
See the
Unity documentation on Update for more information. Poll for user input in OnUpdate, not OnFixedUpdate.
A list of KSPActions which can be added to action groups.
A hash of ClassName?
In any subclass of PartModule, ClassName will be the name of the subclass.
It gets set by the PartModule loading process.
A list of KSPEvents, which can be triggered by code or by the user through the part's right-click menu.
A list of the KSPFields which the module loads from the part.cfg file.
The Part to which this PartModule is attached. Use this to reference the part from your module code.
The Vessel of the Part to which this PartModule is attached.
A StartState is passed on OnStart in order to provide the PartModule with some information
about where it is starting up.
Whether the kerbal is currently hanging on to a ladder.
A finite state machine. States are represented by KFSMState objects, and
"events" (transitions between states) are represented by KFSMEvent objects.
The name of the state the machine is currently in.
The name of the last event that occurred.
Add a new event (possible transition) to the finite state machine.
The event to add.
The states to add the event to. The event can only be triggered when
the machine is in one of these states.
Add a new event (possible transition) to the finite state machine.
The event to add.
A list of states *not* to add the event to. The event can only be triggered
when the machine is *not* in one of these states.
Add a new possible state to the machine.
The state to add.
Cause the machine to execute the transition specified by evt.
The event to execute.
Start the state machine in a given initial state.
The state to start in.
Start the state machine in a given initial state.
The name of the state to start in
The state the machine is currently in.
How many frames the machine has been in this state.
The last event that occurred.
The state the machine was in before this state.
Whether the state machine has been started.
How long the machine has been in the current state, in seconds.
A KerbalInstructor object controls the animated image of a kerbal instructor
in a TutorialScenario. KerbalInstructors come with a stock emote animations
that you can trigger by calling the appropriate functions.
Presumably, makes the instructor execute a given animation.
The animation to execute.
Presumably, makes the instructor execute a given animation repeatedly.
The animation to exectue.
How often to repeat the animation, in seconds?
Presumably, makes the instructor stop repeating whatever animation
you last told it to repeat.
A KFSMEvent represents a possible transition between two KFSMStates in a KerbalFSM
finite state machine.
Which state to transition to when this event is triggered.
The name of the event.
You can assign to this field a delegate that takes a KFSMState (the current state)
and returns a bool. The function will be called each frame and if it returns true,
the event is triggered.
You can assign a delegate to this field, and the delegate will be run when the event is triggered.
Specifies when OnCheckCondition should be checked?
Creates a new KFSMEvent
The name of the event.
Whether this event can be triggered when the state machine is in the given state.
Events must be added to states through KerbalFSM.AddEvent before they can be triggered,
and they can only be triggered when the machine is in one of the states to which they
have been added.
The state to check.
Whether the event can be triggered from the given state.
Represents a state in a KerbalFSM finite state machine.
The name of this state.
You can assign to this field a delegate that takes a KFSMState (which will be this state).
The delegate will be called when the state machine enters this state.
You can assign a delegate to this field, and the delegate will be called during each FixedUpdate
while the state machine is in this state.
You can assign a delegate to this field, and the delegate will be called during each LateUpdate
while the state machine is in this state.
You can assign to this field a delegate that takes a KFSMState. The delegate will be called
when the state machine leaves this state, and the argument passed to the delegate will be
the new state that the machine is transitioning to.
You can assign a delegate to this field, and the delegate will be call during each Update while
the state machine is in this state.
Create a new KFSMState with a given name.
The name of the new state.
Add an event (possible transition) to this state.
The event to add.
Whether the given event can be triggered from this state. An event must be added to a state before
it can be triggered from that state.
The event to check.
Whether the event can be triggered from this state.
The set of events that are valid for this state (i.e., the possible transitions from this state).
The physics simulation has problems if vessels move too fast relative to
the underlying reference frame used by the simulation, or get too far from
the origin of the coordinate system. Krakensbane shifts the reference frame
origin and velocity so that the active vessel is always near the origin of,
and moving slowly with respect to, the underlying coordinate system used by the
physics simulation.
Returns the velocity of the Krakensbane velocity frame.
Returns the velocity of the Krakensbane velocity frame as a single-precision vector.
Returns the last velocity correction performed.
sets the frame velocity back to 0m/s. Use this if setting the worldspace velocity of vessels directly.
Moves all vessels not on rails by the given position offset. This will usually only affect the active vessel,
unless there are other vessels nearby. The offset can be very large and the vessels
will not break, unlike for Vessel.SetPosition.
Apply this attribute to a function to allow it to be called via action groups.
Which action groups this action is currently a part of? Probably you can test
whether this action is part of a given action group (say, the Abort group) with
if((actionGroup & KSPActionGroup.Abort) != 0)
The name of this action as it appears in the action group editor.
Apply this attribute to a class that derives from MonoBehaviour to have KSP automatically start up
your addon at a specified time.
At the time specified by the "startup" argument KSP will create
a new GameObject and attach your MonoBehaviour to it. You can then implement the Unity event functions
like Start(), Update(), etc.
Whether KSP should start up your addon just once per game session, or every time
the startup time is reached. If you want your addon to persist forever, even through
scene changes, after being started once, set once to true. call DontDestroyOnLoad(this) in your
Start() function.
When this addon should be started.
Constructor.
When this addon should be started
Whether KSP should start up your addon just once per game session, or every time
the startup time is reached. If you want your addon to persist forever, even through
scene changes, after being started once, set once to true. call DontDestroyOnLoad(this) in your
Start() function.
Possible values for when your addon can be started up.
Presumably, start on entering either the VAB or the SPH.
Presumably, start soon as possible after loading your assembly?
Start up on any scene transition?
Start on entering the main KSP menu.
Start on entering the KSP settings menu.
Start on entering the KSP credits scene.
Start on entering the space centre scene.
Start on entering the VAB scene.
Start on entering the flight scene.
Start on entering the tracking station scene.
Start on entering the SPH scene.
Start just before KSP creates the solar system? This seems to be the right hook to
use for addons that modify the solar system. See the PSystemManager class and related
classes.
This attribute and the KSPAssemblyDependency attribute can be used to ensure that plugin assemblies are loaded in the right order.
Suppose Mod A depends on mod B, which is currently at version 2.6.
Mod B should add the following line to the end of Properties/AssemblyInfo.cs:
[assembly: KSPAssembly("ModBName", 2, 6)]
where "ModBName" is the name of Mod B (Mod B's .dll?). Replace 2 and 6 with the major and minor version of
Mod B.
Then Mod A should add the following line to the end of Properties/AssemblyInfo.cs:
[assembly: KSPAssemblyDependency("ModBName", 2, 6)]
This will tell KSP that Mod A depends on version 2.6 of Mod B, and ensure the the assemblies get loaded in
the proper order.
This attribute and the KSPAssembly attribute can be used to ensure that plugin assemblies are loaded in the right order.
Suppose Mod A depends on mod B, which is currently at version 2.6.
Mod B should add the following line to the end of Properties/AssemblyInfo.cs:
[assembly: KSPAssembly("ModBName", 2, 6)]
where "ModBName" is the name of Mod B (Mod B's .dll?). Replace 2 and 6 with the major and minor version of
Mod B.
Then Mod A should add the following line to the end of Properties/AssemblyInfo.cs:
[assembly: KSPAssemblyDependency("ModBName", 2, 6)]
This will tell KSP that Mod A depends on version 2.6 of Mod B, and ensure the the assemblies get loaded in
the proper order.
Apply this attribute to a function in a PartModule to make it callable by the player via
the right click menu of the part, or from other plugin code via Part.SendEvent.
It seems like this attribute is NOT refreshed on parts already in flight when you rebuild
your module DLL! You need to launch a new ship with your part.
Whether this event can be triggered through Part.SendEvent.
Whether the event is only available when out on EVA.
Whether the event is shown as available in the right click menu (active must also be true).
Whether the event is shown as available in the right click menu even when
the part is on a ship not currently being controlled by the player (but
close enough to right click).
The name shown for the event in the right click menu.
The name of the event, which can be used to trigger the event using from plugin code using Part.SendEvent.
When the part is on a ship not being controlled by the player,
how close the player needs to be (in meters) in order for the event to appear in the right click menu.
Apply this attribute to a field in a PartModule or ScenarioModule to make the field
get automatically initialized from the cfg file, and optionally persistent. See
http://forum.kerbalspaceprogram.com/showthread.php/10296-0-15-code-update-PartModule-KSPField-KSPEvent-ConfigNode-and-PartResource
Whether to show the value of this field in the right click menu of the part.
The format string that will be passed to ToString when displaying the value of your field
in the right click menu of the part?
E.g. "F3" for a floating point number with 3 digits past the decimal point.
The name that will be shown for this field in the right click menu of the part.
The units that will be shown for this field in the right click menu of the part.
Whether to store the value of this field in persistent.sfs when the game state is saved, and
reload it from persistent.sfs when the game state is loaded.
Like KSPAddon, but for ScenarioModules. Apply this attribute to your subclass
of ScenarioModule and KSP will add it to the game at the right time.
Constructor.
Directions about which games the scenario should be added to. Different options
can be combined with the | operator.
A list of the game scenes to which the scenario should be added
Represents a maneuver node.
The delta-V of the burn represented by this maneuver node, in m/s. NOTE: maneuver nodes use a special coordinate system for delta-V.
The x-component of DeltaV represents the delta-V in the radial-plus direction. The y-component of DeltaV
represents the delta-V in the normal-minus direction. The z-component of DeltaV represents the delta-V in the
prograde direction.
The orbit patch that starts at this maneuver node.
The orbit patch that ends at this maneuver node?
The universal time of the burn represented by this maneuver node.
Perhaps this translates the DeltaV vector into a world-space vector?
You can call this function to change the delta-V and time of a maneuver node.
The new delta-V. See the DeltaV for notes about the coordinate system used.
The new universal time.
This class stores some global information related to the map view.
Whether the game is currently in map view or not.
Calling this function will cause the game to switch to map view from the flight view.
Calling this function will cause the game to switch to flight view from the map view.
Useful for manipulating bytes in memory.
Key module in PART[PotatoRoid]
Although this module is included in the PotatoRoid config file, it is not saved
in the VESSEL trees of unvisited asteroids. The module is initialized when an asteroid
first enters physics range
Density of asteroid, in tons/m^3. Used to calculate part mass.
Largest allowed radius relative to nominal radius for that asteroid class
The fraction of science recovered by transmitting back to Kerbin.
The science experiment triggered by sampling this asteroid.
Smallest allowed radius relative to nominal radius for that asteroid class
Stores the original name of the asteroid, before any ships docked with it
Used to generate asteroid mesh
Stores some kind of resource.
"Procedural/PA_C"
Returns asteroid name
The original asteroid name, not that of any docked ships
Implements IVesselAutoRename
Returns the ship class
Returns VesselType.SpaceObject
Implements IVesselAutoRename
Called when the player selects the asteroid's center of mass as their target
Initializes the asteroid
Called when the player manually renames the asteroid
Called when the player takes a surface sample
A PartModule that can be configured to behave like many different kinds of engines. All stock
propulsion systems except for RCS are implemented through ModuleEngines.
Represents the specific impulse (Isp) of the engine as a function of altitude. To get
the Isp at a certain height h (in meters), use atmosphereCurve.Evaluate(h)
.
The current *internal* throttle of the engine, which may be different from the current
throttle set by the player if useEngineResponseTime is true.
How quickly the engine spools up when the user-set throttle is higher than
currentThrottle.
Each frame, if the user throttle is higher than
the engine's currentThrottle, currentThrottle
is updated according to the formula
currentThrottle += (user throttle - currentThrottle) * engineAccelerationSpeed * dt
engineAccelerationSpeed has units of inverse seconds.
How quickly the engine spools down when the user-set throttle is higher than
currentThrottle.
Each frame, if the user throttle is lower than
the engine's currentThrottle, currentThrottle
is updated according to the formula
currentThrottle += (user throttle - currentThrottle) * engineDecelerationSpeed * dt
engineDecelerationSpeed has units of inverse seconds.
Whether the engine has ever been turned on?
Whether the engine's exhaust will damage parts that it hits. A ray is cast back
along the engine's thrust vector and if that ray hits a part then that part gets heated
up, and may explode if it exceeds its maximum temperature.
The thrust this engine produces at maximum throttle.
The thrust this engine produces at minimum throttle.
The resources used by this engine, and their relative ratios.
The current specific impulse of this engine, in seconds.
Whether this engine always produces maximum thrust once activated (like solid rocket boosters).
These transforms store the locations and directions at which the thrust this engine generates is applied to the part.
Which component of the transform rotation gives the thrust vector?
Whether the engine has a nonzero spool-up and spool-down time.
If useEngineResponseTime is true, then the engine does not
spool up or down instantly when the throttle changes, but uses the
engineAccelerationSpeed and engineDecelerationSpeed
variables.
Whether this engine's thrust varies with airspeed?
How this engine's thrust varies with airspeed?
If this is true, the engine is not producing thrust because it can't get enough resources.
A class that represents the resource requirements of an engine.
The integer ID of the resource consumed.
The string name of the resource consumed, e.g. "LiquidFuel"
How much of this resource is consumed by the engine, in proportion to other resources. For example if the
engine consumes three resources (A, B, C) with A.ratio = 3, B.ratio = 2, C.ratio = 1, then 3 units of every
will be consumed for every 2 units of B and 1 unit of C.
Part module for initiating and describing science experiments.
Name for the right-click option to collect science data from the part while on EVA.
Text for warning pop-up while collecting science data from a non-repeatable experiment while on EVA.
Is EVA science data collection available?
The relevant experiment based on experimentID and info from ScienceDefs file.
Right-click and action group name for initiating experiment.
Must match applicable ID field in the ScienceDefs.cfg file.
Set to 1 to trigger animation in ModuleAnimateGeneric on activation.
Hide right-click experiment button when experiment cannot be performed.
Can the experiment be performed? Only relevant for non-rerunnable experiments.
EVA interaction range for data collection or experiment reset.
Can the experiment be run more than once before requiring Science Lab reset?
Right-click, action group, and EVA button name to reset the experiment, science data will be lost.
Can the experiment be reset on EVA? Science data will be lost.
Cost for cleaning the experiment at the science lab. Units * dataScale * baseValue?
Resource to be used for cleaning the experiment at the science lab.
Right-click and action group name for reviewing collected science data.
Warning displayed before transmitting data from a non-rerunnable experiment.
Allow action groups to be set for the experiment, rather than right-click buttons only.
Percentage of data allowed to be transmitted, 1 equals the amount gained from returning the sample to Kerbin.
Transfers data from the part to an EVA Kerbal.
Initiates the experiment from an action group.
Initiates the experiment from a right-click button.
Removes science data from the part, called after transmission. Implements IScienceDataContainer.
The Science Data to be removed
Returns all Science Data stored in the module. Implements IScienceDataContainer.
A count of how many Science Data reports are stored in the module. Implements IScienceDataContainer.
Is the experiment rerunnable? Refers to rerunnable field. Implements IScienceDataContainer.
Stores any Science Data in the persistent file.
Loads any Science Data stored in the persistent file.
Resets the experiment from an action group. Science Data is lost. Experiment can be re-run.
Resets the experiment from a right-click button. Science Data is lost. Experiment can be re-run.
Resets the experiment from an EVA right-click button. Science Data is lost. Experiment can be re-run.
Opens experimental results dialog. Implements IScienceDataContainer.
Review stored Science Data from a right-click button.
Review individual Science Data reports? Implements IScienceDataContainer.
Sets the Inoperable bool, determines whether experiment can be performed again.
An Orbit class represents a Keplerian orbit. Each Vessel and each CelestialBody has an Orbit. CelestialBodies and
on-rails Vessels follow their Orbits exactly. Off-rails vessels (the active vessel and any nearby vessels)
do not follow their orbits exactly; instead their motion is computed frame-by-frame from the forces acting on them.
A patched consics trajectory consists of a series of Orbits, called patches.
This class uses multiple axes and reference frames to describe
positions and velocities.
We call the choices of axes
-
World: world coordinates. Left-handed.
-
AliceWorld: world coordinates with the y and z axes flipped. Right-handed.
We call the reference frames used
-
BodyCentre[foo]: position and velocity relative to the centre of the CelestialBody |foo|.
-
BodyRotating[foo]: position relative to the centre of the CelestialBody |foo|,
velocity relative to its rotating surface.
-
ConditionallyRotating[foo]: If |foo.inverseRotation|, BodyRotating[foo],
otherwise BodyCentre[foo].
-
Sun: BodyCentre[Planetarium.fetch.Sun].
-
Primary: BodyCentre[this.referenceBody].
-
ActiveVesselPrimary: If the active vessel is not null,
BodyCentre[FlightGlobals.ActiveVessel.orbit.referenceBody], otherwise Sun.
-
ActiveVesselPrimaryConditionallyRotating: If the active vessel is not null,
ConditionallyRotating[FlightGlobals.ActiveVessel.orbit.referenceBody], otherwise Sun.>
We use the concise notation {Axes, Frame}
for describing the reference frame and axes used.
Whether this patch actually represents a real orbit patch in the projected flight path. Often
Orbit.nextPatch for the last real will not be null, but will be some sort of bogus Orbit object.
You can recognize these because activePatch will be false.
The angle between the ascending node and the periapsis, in degrees.
A quantity used in the math describing Keplerian orbits; Google it.
The eccentricity of the orbit.
A vector that points toward periapsis, with mangitude equal to the eccentricity.
NOTE: All Vector3d's returned by Orbit class functions have their y and z axes flipped. You have
to flip these back to get the vectors in world coordinates.
The universal time at which this patch ends.
A special UT at which the parameters of the Orbit are defined. See meanAnomalyAtEpoch.
The specific orbital angular momentum
The inclination of this orbit with respect to the equator of the central body in degrees
The longitude of the ascending node of the orbit, in degrees. The LAN
is the angle between the ascending node and Planetarium.right, as viewed along
Planetarium.up.
Mean anomaly is the fraction of the orbit that has been completed, measured starting
from the periapsis, multiplied by 2π. Look it up.
The mean anomaly of the orbit at the special UT given by Orbit.epoch.
Time since periapsis, in seconds.
The value of ObT at the universal time given by epoch.
Equal to >ObT / period
How the next patch follows onto this one, or FINAL if there is no patch after this one.
The period of the orbit, in seconds.
The position of the orbiting object, {AliceWorld, Primary}.
The body orbited.
The semi-major axis of the orbit, in meters. Equal to (PeR + ApR)/2
The time until the object will reach apoapsis, in seconds.
The time unti lthe object will reach periapsis, in seconds.
The velocity of the orbiting object, {AliceWorld, Primary}.
The velocity of the orbiting object, {AliceWorld, Sun}.
A unit vector normal to the plane of the orbit. NOTE: All Vector3d's returned by Orbit class functions have their y and z axes flipped. You have
to flip these back to get the vectors in world coordinates.
A unit normal vector.
Gets the predicted displacement of the orbiting object from the center of the main
body at a given time since perigee passage. NOTE: All Vector3d's returned by Orbit class functions have their y and z axes flipped. You have
to flip these back to get the vectors in world coordinates.
Time since perigee passage (seconds)
Position relative to the main body (YZ flipped)
Gets the predicted displacement of the orbiting object from the center of the main
body at a given universal time. NOTE: All Vector3d's returned by Orbit class functions have their y and z axes flipped. You have
to flip these back to get the vectors in world coordinates.
A univeral time.
Position relative to the main body (YZ flipped)
The velocity of the orbiting object, {World, Primary}.
The velocity of a hypothetical object, located where the orbiting object
is, and at rest in the ConditionallyRotating[refBody] frame,
{AliceWorld, BodyCentre[refBody]}.
In other words, velocity of the ConditionallyRotating[refBody] frame in the
BodyCentre[refBody] frame at the position of the orbiting object (AliceWorld axes).
Note: this only depends on the orbital position, not on the orbital velocity.
The velocity of the orbiting object, {World, ActiveVesselPrimary}.
The velocity of the orbiting object, {World, ActiveVesselPrimaryConditionallyRotating}.
The distance the orbiting object will be from the center of the main body when it reaches the given true anomaly.
True anomaly (in degrees)
Distance from the main body's center, in meters
The true anomaly at which the orbiting object will achieve the given distance from the center of the main body.
Distance from the center of the main body, in meters.
True anomaly, in radians.
Updates this orbit to reflect the orbit that will be taken around the given body by an object with the
given position and velocity at the given universal time.
The initial position of the object RELATIVE TO refBody at UT (YZ flipped)
The initial velocity of the object (YZ flipped)
The main body
The universal time at which to start the orbit.
The apoapsis of the orbit in meters, measured from sea level.
The apoapsis of the orbit in meters, measured from the center of the main body.
The periapsis of the orbit in meters, measured from sea level.
The periapsis of the orbit in meters, measured from the center of the main body.
A property of ellipses, parabolas and hyperbolas; Google it.
A property of ellipses; Google it.
Describes the two possibilities for how a part can be attached to its parent.
The part is attached to its parent via a stack node; for example this is
how vertically stacked fuel tanks are attached
This part is attached to the surface of its parent; for example this is how
radial decouplers are attached.
A PartResource object represents the store of a single type of resource within a Part.
How much of the resource is in this part, in whatever units the resource uses.
The definition of this type of resource, which contains all information about this resource type.
The maximum amount of this resource that this part can hold.
The part whose stored resource this object represents
The name of this resource, as a string, e.g. "ElectricCharge"
A PartResourceDefinition contains the basic information defining a type of resource.
The mass of this resource, per unit. This is not necessarily per unit volume, as resources
don't have defined volumes. Instead resource "density" is the mass of one units of the resourc.e
The integer ID of this resource type.
The string ID of this resource type
How this resource does or does not flow between parts on a ship in response
to resource requests by engines and the like.
How this resource does or does not flow when using the resource transfer function?
The PartResourceLibrary lets you retrieve information about a resource type, given its name or integer id.
Gets information about a resource, specified by its integer ID.
The integer ID of the resource
A PartResourceDefinition, which contains all the information about the resource
Gets information about a resource, specified by its name as a string.
The name of the resource, e.g. "ElectricCharge"
A PartResourceDefinition, which contains all the information about the resource
Use this instance to access the methods of this class
Stores information on an asteroid's shape
for a
factory method creating PAsteroids
The largest distance of any vertex to the mesh center
The (approximate?) volume of the asteroid mesh
Combines premade elements into visual, collider, and convex meshes.
Each vessel has a PatchedConicSolver, which stores the predicted patched conics trajectory and
any maneuver nodes that currently exist.
A list of the maneuver nodes that are currently planned for this vessel.
Add a maneuver node to the flight plan.
The universal time of the maneuver node.
A reference to the maneuver node
Remove a maneuver node from the flight plane.
The maneuver node to be removed.
Probably the most useful function here is Planetarium.GetUniversalTime().
Presumably, the main body of the active vessel?
Use this instance to access non-static fields.
The CelestialBody representing the Sun.
Presumably, whether the game is currently using a rotating
frame for physics (as opposed to an unrotating inertial frame).
Below a certain altitude (CelestialBody.inverseRot
The simulation time, in seconds, since this save was started.
Universal time, in seconds
Along with "up" and "right," one of the three vectors defining the fixed celestial
reference frame.
Along with "up" and "forward," one of the three vectors defining the fixed celestial
reference frame. The LAN (longitude of the ascending node) of every orbit is defined
in reference to Planetarium.right. Specifically, the LAN is the angle between
Planetarium.right and the orbit's ascending node, as viewed along Planetarium.up.
Along with "right" and "forward," one of the three vectors defining the fixed celestial
reference frame. As of 0.23.5, all planet rotation axes are aligned with Planetarium.up.
A class related to the map view camera.
Use this instance to access non-static members of this class.
This is the Camera that looks at the planetarium scene. See the Unity documentation on Camera
to see what you can do with this object.
A node full of configuration values.
Gets the parent of this node.
Get the value of a configuration key.
Get the value of a configuration key.
Set the value of a configuration key
Get or set the value of a configuration key
From N3X15: PluginConfiguration was something I threw together a while ago to try and improve settings serialization. The INI files we were using just couldn't cope with newlines and had all sorts of horrible workarounds. Instead of INI files, it writes structured XML files that look like this:
<config>
<int name="int"\>4</int>
<long name="long">45</long>
<short name="short">4</short>
<byte name="byte">255</byte>
<bool name="bool">1</bool>
<vector3 name="vector3">
<x>0</x>
<y>1</y>
<z>2</z>
</vector3>
<vector3d name="vector3d">
<x>0</x>
<y>1</y>
<z>2.05</z>
</vector3d>
<string name="string">string</string>
</config>
Despite looking a bit messy, it's actually a lot easier to use and doesn't have as many drawbacks as INI files. Newlines are preserved, and most importantly, types are also preserved. Oh, and it's UTF-8 encoded, so internationalization won't be as much as a problem, theoretically. Here's how to use it:
PluginConfiguration cfg = PluginConfiguration.CreateForType<MyCoolModule>();
cfg["a string"] = "I love KSP!";
cfg["another setting"] = new Vector3d(0,1,2);
cfg.save();
// Later...
cfg.load();
settingAString = cfg.GetValue<string>("a string");
settingAVector = cfg.GetValue<Vector3d>("another setting");
Initialize the configuration object
Get a typed value from the root node.
Get a typed value from the root node, and set to a default if it doesn't exist.
Load from disk
Commit changes to disk
Set a configuration key's value
Return configuration key from the root node
Generates an asteroid shape
The desired reference surface of the asteroid mesh
Initializes a randomly generated asteroid shape
Used to randomize the mesh
The desired reference surface of the asteroid mesh
The reference frame in which the asteroid is to be oriented
Note: may not be null, even though UnityEngine.Transforms
are usually allowed to have null parents.
An object containing all relevant meshes and key statistics
Smallest mesh height that can be randomly chosen, in units of the asteroid radius
Largest mesh height that can be randomly chosen, in units of the asteroid radius
Size multiplier in addition to ProceduralAsteroid.radius
A class for managing planetary systems. Ask the Kopernicus guys/look at their code for details.
An enumeration of the different behaviors resources can have with respect to fuel flow.
This resource cannot flow between parts (like SolidFuel).
The flow scheme used by the stock ElectricCharge and IntakeAir resources.
Unused?
The flow scheme used by the stock MonoPropellant and XenonGas resources.
Resource can be draw from any container by any consumer, but it tries to
prioritize drawing from continers in earlier stages.
This resource behaves like LiquidFuel or Oxidizer, and can only flow
through crossfeed-enabled parts and fuel lines.
A class that handles the transformations between the scaled-down coordinate system used by the map view and the
regular coordinate system used by the main flight view and the physics.
Convert a position in world coordinates into a position in planetarium coordinates.
A position in world coordinates
The corresponding position in planetarium coordinates
Convert a position in planetarium coordinates into a position in world coordinates.
A position in planetarium coordinates.
The corresponding position in world coordinates.
"Scaled space" is the coordinate system used by the planetarium view. It's the same coordinate system as
the world coordinates used by the physics, except scaled down by this scale factor.
A list of options for use with the KSPScenario attribute.
Stores information on asteroid spawning
Executed while in Flight, Tracking Station, and Space Center scenes
The module schedules periodic "spawn checks" while the game clock is running, at an interval
set by spawnInterval. At each spawn check, any asteroids that have gone untracked for too long
are removed from the game.
To add an element of randomness, only a fraction of checks (controlled by spawnOddsAgainst)
have a chance to produce asteroids. No asteroids are produced if the number of untracked
asteroids already in the game exceeds spawnGroupMaxLimit. Because spawn checks happen
very frequently, the number of detected asteroids in a game where the player never
tracks an asteroid will almost always be close to spawnGroupMaxLimit.
The timing of spawn checks appears to be independent of the warp rate, but at high time warp
multiple asteroids may be spawned per check. (Needs confirmation)
Number of untracked asteroids at which spawn rate begins to slow
Number of untracked asteroids at which spawn rate stops completely
Sets size distribution for asteroids
The output range of [0, 1) is divided equally among the classes. So [0, 0.2) is class A,
[0.2, 0.4) is class B, ..., [0.8, 1) is class E.
Default curve translates to
12% class A, 13% class B, 49% class C, 13% class D, and 12% class E
Controls the fraction of spawn checks in which new asteroids are generated
The probability of spawning an asteroid is 1 / (1 + spawnOddsAgainst)
Number of seconds between asteroid checks
These are seconds of time spent playing KSP, regardless of the time warp rate. The faster
your time warp, the longer the in-game interval between asteroid detections.
Since asteroids are removed during spawn checks, spawnInterval also controls the
asteroid removal rate.
Longest time an asteroid can go untracked before disappearing, in Earth days
Shortest time an asteroid can go untracked before disappearing, in Earth days
Returns a description of the current spawn interval and spawn odds
Creates a random asteroid and Kerbin-intercepting orbit
Creates a random asteroid and Kerbin-intercepting orbit.
Asteroid is identical to the last
call of SpawnAsteroid()
Intended for debugging?
Class containing information on science reports, stored in the persistent file in modules using IScienceDataContainer.
Amount of data, in mits, to be transmitted or recovered. Affects transmission time and energy usage.
Level of science lab boost, less than 1 is un-boosted, 1.5 is the standard lab boosted value, higher levels don't appear to be used.
ID of science data in Experimentname@CelestialbodynameExperimentalsituationBiome format, matches Science Subject id.
Science data title, displayed on experimental results dialog page and recovery summary.
Percentage of science value that can be transmitted. 1 is equal to the amount gained by returning to Kerbin.
Generate Science Data based on Science Subject values.
Amount of data, it mits.
Transmission value
Current state of science lab boost
Matches Science Subject ID
Title of science data
Class containing information from the experiment stored in the ScienceDefs file.
Base science value from ScienceDefs file.
Bitmask to determine when biomes are relevant.
Multiplier to increase data amount in mits.
Title to be displayed for experimental results dialog and science archives.
Matches ID from ModuleScienceExperiment field.
Can the experiment only be performed on planets with an atmosphere?
Maximum science value available for each experimental result.
Bitmask to determine which Experiment Situations the experiment can be performed in.
Checks if the biome is relevent to the experiment given the biomeMask specified in the ScienceDefs file.
Current Experiment Situation
Determines if the experiment is available given the situationMask and requireAtmosphere values specified in the ScienceDefs file.
Current Experiment Situation
Current Celestial Body
Class containing information on a specific science result, data stored in the persistent file under the R&D node.
Multiply science value by this dataScale value to determine data amount in mits.
Subject ID in Experimentname@CelestialbodyExperimentalsituationBiome format
Amount of science already earned from this subject, not updated until after transmission/recovery.
Total science allowable for this subject, based on subjectValue.
Diminishing value multiplier for decreasing the science value returned from repeated experiments.
Multiplier for specific Celestial Body/Experiment Situation combination.
Title of science subject, displayed in science archives.
Return a Science Subject from Research and Development node in the persistent file.
Generate new Science Subject.
Science Experiment from ScienceDefs file and ModuleScienceExperiment
Current experimantal situation, based on VesselSituation
Current Celestial Body
Current biome if applicable, empty string if not
A class representing temporary messages posted to the screen. Don't use this class, use the static methods in ScreenMessages instead.
A class that lets you post temporary messages to the screen. If you use this class your messages will
automatically have the same style as regular in-game messages.
The set of currently active screen messages. This is a non-static member, but you can get a
reference to the ScreenMessages instance via
ScreenMessages sm = (ScreenMessages)GameObject.FindObjectOfType(typeof(ScreenMessages));
Post a temporary message to the screen. Examples of screen messages are the "Warp = {number}x" message
and the "Quicksaving..." message.
The message to post
Post a temporary message to the screen. Examples of screen messages are the "Warp = {number}x" message
and the "Quicksaving..." message.
The message to post.
A reference to the posted message
Post a temporary message to the screen. Examples of screen messages are the "Warp = {number}x" message
and the "Quicksaving..." message.
The message to post
How long the message should remain on the screen, in seconds.
A reference to the posted message
Post a temporary message to the screen. Examples of screen messages are the "Warp = {number}x" message
and the "Quicksaving..." message.
The message to post
How long the message should remain on the screen, in seconds.
Which style of screen message to post--for instance, should it by like the warp message, the quicksaving message, etc.
A reference to the posted message
Remove a currently active message from the screen.
The message to remove
An enumeration of the different styles of message you can display.
This results in a message in the same font and position as the "Warp = {number}x" message.
What sort of message style does this produce?
This results in a message in the same font and position as the "Quicksaving..." message.
What sort of message style does this produce?
This enum is a replacement for its System.IO equivalent. It's used to determine from where one wishes to seek in a file stream.
Seek from the beginning of the stream.
Seek from the current position in the stream.
Seek from the end of the stream.
A list of all the parts in the ShipConstruct.
The parts are listed in the same order in which they were added to the ship in the editor.
Identical to System.IO.TextReader, but with added IDisposable methods (for use in using() statements), and a factory method instead of constructors.
Create a text reader stream.
Identical to System.IO.TextWriter, but with added IDisposable methods (for use in using() statements), and a factory method instead of constructors.
Create a text writing stream
The class that handles time warp.
Unused? CelestialBodies have their own sets of altitude limits.
Use this TimeWarp instance to access non-static members.
The available physics warp rates. In 0.18.2 these are {1, 2, 3, 4} by default. You can modify the
available rates by modifying this array.
The available regular warp rates. In 0.18.2 these are {1, 5, 10, 50, 100, 1000, 10000, 100000} by default.
You can modify the available rates by modifying this array.
Presumably, gets the minimum altitude in meters above the sea level of the given body at which the
given warp rate index is allowed.
A warp rate index
The body in question
The minimum altitude in meters at which that warp rate index is allowed
Changes the warp rate to either warpRates[rateIndex] or physicsWarpRates[rate_index], depending
on whether WarpMode is HIGH or LOW.
The index of the desired new warp rate
If false, KSP will gradually smoothly adjust the warp rate up or down until it reaches the target.
If true, the warp rate will change instantly.
The current warp rate, e.g. 50 if the current warp rate is 50x. This number
may not be equal to one of the entries in warpRates, because KSP will smoothly
interpolate between two warp rates over a period of time when you increase
or decrease the warp.
The index of the current current warp rate in either warpRates or physicsWarpRates, depending
on whether WarpMode is HIGH or LOW. Note that CurrentRate may not equal the warp rate indexed
by CurrentRateIndex if KSP has not finished interpolating the last warp change.
The time between FixedUpdate cycles (i.e., the time between physics steps). See the Unity FixedUpdate
documentation for more details.
Whether we are in regular warp mode or physics warp mode
Reguar time warp mode
Physics warp mode
A TutorialScenario is a ScenarioModule with some added features that
are useful for building tutorials or similar kinds of scenarios. A TutorialScenario
comes with a builtin in finite state machine for running the scenario and
displays "tutorial pages" in a GUI window alongside a picture of a friendly Kerbal instructor.
You can take advantage of all these features by making your ScenarioModule a subclass of
TutorialScenario.
See HarvesteR's example code in his forum article:
http://forum.kerbalspaceprogram.com/content.php/121-Writing-Tutorials-A-Demo-%28and-some-source-code%29
Controls the animated image of the kerbal instructor. This object lets you make the instructor run
various animations .
Set this string in OnAssetSetup to specify which instructor kerbal will appear
in the tutorial window. The value "Instructor_Gene" gives Gene Kerman as the
instructor. The default if you do not specify anything is Werner von Kerman.
The finite state machine that controls the progression of the tutorial.
Override this function to run some initialization code?
Override this function to run some code as the tutorial
is being set up.
Sets the location of the GUI window of the tutorial.
The TutorialFSM provides a convient interface for implementing the meat of
your scenario logic through a finite state machine. The states of the state
machine are "pages."
The page that the tutorial was on before this one.
The list of all pages in the tutorial.
Add a page (a new possible state) to the tutorial.
The page to add.
Add a page (a new possible state) to the tutorial, but outside
the default page sequence that will be used by GoToLastPage and
GoToNextPage.
The page to add.
Transition the tutorial to the page before the current one in the default page sequence.
Transition the tutorial to the page after current one in the default page sequence.
Start the finite state machine on the page with the given name.
The name of the page to start on.
Start the finite state machine on the given page.
The page to start one.
TutorialPages are the states in the TutorialFSM finite state machine.
They extend the KFSMState class, which represents a class in a more general
finite state machine, to add tutorial-related features like a Callback in which
you draw the GUI of the tutorial page.
Presumably, this KFSMEvent will be triggered when the function you passed to SetAdvanceCondition
returns true. This should give you the opportunity to go to a page besides the default next
page when the advance condition is met.
Assign this Callback to a function that uses GUILayout to draw the GUI of this tutorial page.
Whatever you do here gets draw inside the tutorial window, next to the picture of the
Kerbal instructor.
Is this event triggered when GoToLastPage is called? Perhaps it gives you a chance to
go to a page besides the default previous page?
The title displayed for this page.
Create a new tutorial page with a given name. Note that the name of the page
is distinct from its title.
The name of the new page.
You can call this function and pass to it a function that takes a KFSMState
and returns a boolean. That function will be called every update cycle while
this tutorial page is active. If the function ever returns true, the tutorial
will automatically advance to the next page.
Describes an asteroid's size
Standard radius = ???
Standard radius = 5.5 m?
Standard radius = 8.5 m?
Standard radius = 15 m?
Standard radius = 25 m?
A Vector3d in 3D space.
Vector3d is just like Unity's Vector3 class, except it uses doubles instead of floats,
so refer to the Unity documentation on Vector3.
Vector3d also adds a few functions.
Returns fromThat - Vector3d.Project(fromThat, excludeThis)
. That is, it removes
the component of fromThat that is parallel to excludeThis and returns the remainder, which will
be perpendicular to excludeThis.
The direction to exclude from the result.
The starting vector
A vector perpendicular to excludeThis and pointing in the same general direction as fromThat.
Minus forward
Minus up
Minus right.
Returs a new Vector3d with the y and z coordinates swapped?
A Vessel object represents a single vessel. Parts that break off from a vessel become their own Vessels. Vessels that merge
via docking become one Vessel.
Presumably, this is the current acceleration vector of the vessel, in m/s^2?
Presumably, this is the current altitude above sea of the vessel, in meters?
Is equal to pqsAltitude + heightFromTerrain (where heightFromTerrain is not -1).
Presumably, this is the current angular momentum of the vessel?
The current angular velocity vector of the vessel.
Presumably, this is the current density of the atmosphere at the vessel's position?
Presumably, this is the position of the center of mass of the vessel?
The set of flight inputs currently being fed to the vessel. For example the current
throttle being applied to the vesesl is vessel.ctrlState.mainThrottle.
Presumably, the current stage of the vessel as seen e.g. in the staging display
Appears to always be -1?
The vertical distance in meters between the vessel and the nearest terrain (including buildings),
or -1 when sea depth is greater than 600m (terrainAltitude <= -600).
Presumably, the horizontal component of srf_velocity, in m/s.
A unique identifier assigned to a vessel. When two vessels dock, the combined vessel has the id of the vessel docked to.
On undock, the vessel undocked from keeps its id, the vessel that undocks gets a new id.
Note that this id is always fresh, a vessel gets a different id when it undocks then it had before docking.
This is the pid value in the persistent.sfs at the VESSEL level.
Presumably, whether this vessel is an EVAing kerbal.
Whether the vessel is currently sitting on the ground.
The current latitude of the vessel over the current mainBody, in degrees.
The universal time at which the vessel was launched, in seconds?
Whether the vessel is currently loaded. Vessels are only loaded when they come
within about 2.5km of the active vessel.
The current longitude of the vessel over the current mainBody, in degrees
Mission elapsed time, in seconds, maybe?
The current velocity of the vessel, in world coordinates, in the nonrotating inertial reference frame.
You can add your own function to this callback to register a function that can provide flight control input
to the vessel. Once you've registered this callback, it will be called once per FixedUpdate. Provide flight
control input by modifying the FlightCtrlState passed to your function. This FlightCtrlState will already
contain the player's input, which you can modify or override as desired.
void MyAutopilotFunction(FlightCtrlState s) {
s.yaw = 1;
}
...
vessel.OnFlyByWire += MyAutopilotFunction
This will create an autopilot that always yaws hard to the right. You can probably devise something more useful, though...
You can add a function to this callback, and the function will be called when the vessel is "just about to be destroyed."
Whether the vessel is currently packed. Vessels are only packed when the come within about 300m of the active vessel.
A list of the parts in the vessel. Note that when the vessel is not loaded, this list will be empty.
Among other things, the patchedConicSolver stores information about the player's current set of maneuver nodes.
Presumably, the height in meters of the planet's terrain QuadSphere directly under the vessel, compared to sea level.
This does not take the height of buildings into account. It is generally within +/- 1m of terrainAltitude,
except when over buildings (terrainAltitude does account for buildings) or sea with a depth of greater
than 600m (terrainAltitude <= -600, heightFromTerrain == -1).
The protoVessel can be used to get some saved information about unloaded vessels.
This is the flightID of the part that is the current 'Control from Here' part.
This is the root part until changed by the player.
The vessel transform is set to the transform of this part.
This is the 'ref' value in the persistent.sfs at the VESSEL level.
The root of the tree of parts that comprises the vessel. Usually this is the original command pod placed when constructing the vessel.
Some coarse information about the current state of the vessel.
Whether the vessel is currently splashed down.
The velocity of the vessel in the "surface" reference frame, the reference frame that rotates with the planet.
Presumably, the atmospheric pressure at the vessel's current location.
The height in meters of the nearest terrain (including buildings) directly under the vessel, compared to sea level.
Ground which is underwater will have a negative terrainAltitude.
Presumably, a unit vector in the up (radially outward from the planet) direction.
Presumably, the vertical speed of the vessel in m/s.
The name of the vessel as it appears in e.g. the tracking station.
The type of the vessel, as shown by the type of icon on the map view.
Add a given velocity offset to the vessels current velocity, instantaneously (may only work for loaded vessels?)
Broken Function with expensive runtime. Do not use. (If it worked it'd do as the name says but it doesn't as of 0.23.5)
Returns the vessel's moment of inertia around its center of mass.
Returns nonsense answers; DO NOT USE
Computes and returns the position of the center of mass of the vessel, in world coordinates.
The number of kerbals inside the vessel. This is ONLY reliable when the vessel is loaded (vessel.loaded == true).
When the vessel is unloaded you can compute the crew count as
vessel.protoVessel.protoPartSnapshots.Sum(pps => pps.protoModuleCrew.Count))
Gets the transform of the part the vessel is being controlled from (i.e., the part
set by the "control from here" right click option).
Pulls the vessel off rails?
Puts the vessel on rails?
Sets the velocity of the vessel to a new value, instantaneously. May only work for loaded vessels?
Returns the vessel's altitude above the reference sphere of
the CelestialBody it orbits
Implements IDiscoverable
Returns the vessel's mass, in tons
Implements IDiscoverable
Returns the vessel's tracking station name
Implements IDiscoverable
Describes the state of the vessel
A string containing the sphere of influence and trajectory of the object
"Orbiting the Sun"
Implements IDiscoverable
Returns the vessel's speed
Implements IDiscoverable
Returns the type of the vessel
A string representation of vesselType
Implements IDiscoverable
Describes to what extent this object has been explored
Whether the player is currently controlling this vessel.
Landed || Splashed; use this to determined whether the vessel is on the ground somewhere, whether on land or water.
The body whose sphere of influence the vessel is currently in.
The current orbit of the vessel.
A list of the parts this vessel is composed of.
Get a part by its index, in some order.
Index of the part to get.
The "index"th part in the vessel.
Get a part by its part.flightID value
The flightID value of some part in the vessel
The matching part, or null if there is no part with that flightID.
The type of Vessel.situation
Waiting on the launchpad, ready to be launched
On a collision course with the ground
On a hyperbolic trajectory