MASFlightComputerProxy - MOARdV/AvionicsSystems GitHub Wiki

MASFlightComputerProxy.cs

Contents

The fc group contains the core interface between KSP, Avionics Systems, and props in an IVA. It consists of many 'information' functions that can be used to get information as well as numerous 'action' functions that are used to do things.

Due to the number of methods in the fc group, this document has been split across three pages:

NOTE 1: If a function listed below includes an entry for 'Supported Mod(s)', then that function will automatically use one of the mods listed to generate the data. In some cases, it is possible that the function does not work without one of the required mods. Those instances are noted in the function's description.

NOTE 2: Many descriptions make use of mathetmatical short-hand to describe a range of values. This short-hand consists of using square brackets [ and ] to denote "inclusive range", while parentheses ( and ) indicate exclusive range.

For example, if a parameter says "an integer between [0, fc.ExperimentCount())", it means that the parameter must be an integer greater than or equal to 0, but less than fc.ExperimentCount().

For another example, if a parameter says "a number in the range [0, 1]", it means that the number must be at least zero, and it must not be larger than 1.


Abort Category

The Abort action and the GetAbort query belong in this category.

fc.Abort()

Returns: 1 (abort is always a SET, not a toggle).

Trigger the Abort action group.

fc.GetAbort()

Returns 1 if the Abort action has been triggered.


Action Groups Category

Variables and actions related to player-configured action groups are in this category.

fc.ActionGroupHasActions(double groupID)

  • groupID: A number between 0 and 9 (inclusive) for stock action groups, 10 or larger for MAS action groups.

Returns: 1 if there are actions for this action group, 0 otherwise.

Returns 1 if there is at least one action associated with the action group. 0 otherwise, or if an invalid action group is specified.

fc.ActionGroupActiveMemo(double groupID)

  • groupID: A number between 0 and 9 (inclusive). Note that MAS action groups do not have an AG Memo.

Returns: The memo for the requested group, or an empty string.

Returns the current memo from the action group selected by groupID. If the memo was configured with active and inactive descriptions, this memo will change. If an invalid groupID is provided, the result is an empty string. If no memo was specified, the result is "AG0" for action group 0, "AG1" for action group 1, etc.

fc.ActionGroupMemo(double groupID, bool active)

  • groupID: A number between 0 and 9 (inclusive). Note that MAS action groups do not have an AG Memo.
  • active: Whether the memo is for the active (true) or inactive (false) setting.

Returns: The memo for the requested group and state, or an empty string.

Returns the action group memo specified by the groupID, with active selecting whether the memo is for the active mode or the inactive mode. If the selected memo does not differentiate between active and inactive, the result is the same. If an invalid groupID is provided, the result is an empty string. If no memo was specified, the result is "AG0" for action group 0, "AG1" for action group 1, etc.

fc.GetActionGroup(double groupID)

  • groupID: A number between 0 and 9 (inclusive) for stock action groups, 10 or larger for MAS action groups.

Returns: 1 if active, 0 if inactive

Get the current state of the specified action group.

fc.SetActionGroup(double groupID, bool active)

  • groupID: A number between 0 and 9 (inclusive) for stock action groups, 10 or larger for MAS action groups.
  • active: true or false to set the state.

Returns: 1 if the action group ID was valid, 0 otherwise.

Set the specified action group to the requested state.

fc.ToggleActionGroup(double groupID)

  • groupID: A number between 0 and 9 (inclusive) for stock action groups, 10 or larger for MAS action groups.

Returns: 1 if the action group ID was valid, 0 otherwise.

Toggle the selected action group or MAS action group.


Altitudes Category

Variables relating to the current vessel's altitude are found in this category.

fc.Altitude()

Returns the vessel's altitude above the datum (sea level where applicable), in meters.

fc.AltitudeAtmospheric()

Returns altitude above datum (or sea level) for vessels in an atmosphere. Returns 0 otherwise. Altitude in meters.

fc.AltitudeBottom()

Returns the distance from the lowest point of the craft to the surface of the planet. Ocean is treated as surface for this purpose. Precision reporting sets in at 500m (above 500m it reports the same as AltitudeTerrain(false)). Distance in meters.

fc.AltitudeTerrain(bool ignoreOcean)

  • ignoreOcean: When false, returns height above sea level when over the ocean; when true, always returns ground height.

Returns: Altitude above the terrain in meters.

Returns the height above the ground, optionally treating the ocean surface as ground. Altitude in meters.

fc.TerrainHeight()

Returns the terrain height beneath the vessel relative to the planet's datum (sea level or equivalent). Height in meters.


Atmosphere Category

Atmosphere and airflow variables are found in this category.

fc.AtmosphereDepth()

Returns the atmospheric depth as reported by the KSP atmosphere gauge, a number ranging between 0 and 1.

fc.AtmosphereTop()

Returns the altitude of the top of atmosphere, or 0 if there is no atmo. Altitude in meters.

fc.AtmosphericDensity()

Returns the atmospheric density.

fc.Drag()

Returns: Drag in kN.

Returns the drag force on the vessel. If FAR is installed, this variable uses FAR's computation for drag.

fc.DragAccel()

Returns: Drag acceleration in m/s^2.

Returns the drag effect on the vessel as acceleration. If FAR is installed, this variable uses FAR's computation for drag.

fc.DynamicPressure()

Returns: Dynamic pressure in kPa.

Returns the current dynamic pressure on the vessel in kPa. If FAR is installed, this variable uses FAR's computation instead.

fc.GravityForce()

Returns: Force of gravity in kN.

Returns the force of gravity affecting the vessel.

fc.HasAtmosphere()

Returns: 1 if there is an atmosphere, 0 otherwise.

Returns 1 if the body the vessel is orbiting has an atmosphere.

fc.Lift()

Returns: Lift in kN.

Returns the lift force on the vessel. If FAR is installed, this variable uses FAR's computation for lift.

fc.LiftUpForce()

Returns: Lift opposed to gravity in kN.

Returns the force of lift opposed to gravity. If FAR is installed, this variable uses FAR's computations for lift.

fc.StaticPressureAtm()

Returns the static atmospheric pressure outside the vessel in standard atmospheres.

fc.StaticPressureKPa()

Returns: Static pressure in kPa.

Returns the static atmospheric pressure outside the vessel in kiloPascals.

fc.TerminalVelocity()

Returns: Terminal velocity in m/s.

Returns the current terminal velocity of the vessel. If the vessel is not in an atmosphere, returns 0. If FAR is installed, returns FAR's terminal velocity result.


Autopilot Category

The Autopilot region provides information about and control over the MAS Vessel Computer Control system (which needs a cool name amenable to acronyms).

The attitude control pilot is very similar to MechJeb's advanced SASS modes, but it uses the stock SAS module to provide steering control.

Some caveats about the autopilot subsystems:

The attitude control pilot uses the stock SAS feature to provide steering control. When it is engaged, SAS is usually in Stability Control mode. If SAS is changed to a different mode (such as Prograde), the attitude control pilot is disengaged. Likewise, if Stability Control is selected, the attitude pilot disengages. Turning off SAS will disengage the pilots.

Other MAS autopilots may use the attitude control system to steer the vessel. If the attitude control pilot is disengaged, the other autopilot is also disengaged.

There are several supported references available to the MAS autopilot system, as detailed here. "Forward" is defined as the front of the vessel (nose of a space plane, or the top of a vertically-launched rocket). "Up" is the direction of the heads of kerbals sitting in a conventional orientation relative to the forward direction, such that their heads point away from the surface of the planet in horizontal flight.

TODO: Fully document these reference frames.

  • 0 - Inertial Frame: The reference frame of the universe.
  • 1 - Orbital Prograde: Forward = orbital prograde, Up = surface-relative up (radial out).
  • 2 - Orbital Prograde Horizontal: Forward = horizontal, aligned towards orbital prograde, Up = surface-relative up (radial out).
  • 3 - Surface Prograde: Forward = surface-relative prograde, Up = surface-relative up (radial out).
  • 4 - Surface Prograde Horizontal: Forward = horizontal, aligned towards surface-relative prograde, Up = surface-relative up (radial out).
  • 5 - Surface North: Forward = planetary north, Up = surface-relative up.
  • 6 - Target: Forward = direction towards the target, Up = perpendicular to the target direction and orbit normal.
  • 7 - Target Prograde: Forward = towards the target-relative velocity vector, Up = perpendicular to the velocity vector and orbit normal.
  • 8 - Target Orientation: Forward = target's forward direction, Up = target's up direction.
  • 9 - Maneuver Node: Forward = facing towards the maneuver vector, Up = radial out at the time of the burn.
  • 10 - Sun: Forward = facing Kerbol, Up = orbital normal of the body orbiting Kerbol.
  • 11 - Up: Forward = surface-relative up, Up = planetary north.

fc.DisengageAscentPilot()

Returns: 1 if the pilot was on, 0 if it was already disengaged.

Disengage the Ascent Control Pilot.

fc.EngageAscentPilot(double apoapsis, double periapsis, double inclination, double roll)

  • apoapsis: Goal apoapsis, in meters.
  • periapsis: Goal periapsis, in meters.
  • inclination: Orbital inclination.
  • roll: Horizon-relative roll to maintain during ascent.

Returns: 1 if the pilot is engaged, 0 if it failed to engage.

Engage the Ascent Control Pilot.

NOTE: This function is not enabled, and it always returns 0.

If invalid parameters are supplied, or the vessel is in flight, the pilot will not activate.

fc.EngageAttitudePilot(double reference)

  • reference: Reference vector, as described in the summary.

Returns: 1 if the pilot was engaged, otherwise 0.

Engage the MAS Attitude Control Pilot to hold the vessel's heading towards the reference direction vector. The reference field must be one of:

  • 0 - Inertial Frame
  • 1 - Orbital Prograde
  • 2 - Orbital Prograde Horizontal
  • 3 - Surface Prograde
  • 4 - Surface Prograde Horizontal
  • 5 - Surface North
  • 6 - Target
  • 7 - Target Prograde
  • 8 - Target Orientation
  • 9 - Maneuver Node
  • 10 - Sun
  • 11 - Up

This function is equivalent of fc.EngageAttitudePilot(reference, 0, 0).

fc.EngageAttitudePilot(double reference, double heading, double pitch)

  • reference: Reference vector, as described in the summary.

Returns: 1 if the pilot was engaged, otherwise 0.

Engage the MAS Attitude Control Pilot to hold the vessel's heading towards an offset relative to the reference direction vector. The reference field must be one of:

  • 0 - Inertial Frame
  • 1 - Orbital Prograde
  • 2 - Orbital Prograde Horizontal
  • 3 - Surface Prograde
  • 4 - Surface Prograde Horizontal
  • 5 - Surface North
  • 6 - Target
  • 7 - Target Prograde
  • 8 - Target Orientation
  • 9 - Maneuver Node
  • 10 - Sun
  • 11 - Up

This version does not lock the roll of the vessel to a particular orientation.

fc.EngageAttitudePilot(double reference, double heading, double pitch, double roll)

  • reference: Reference attitude, as described in the summary.
  • heading: Heading (yaw) relative to the reference attitude.
  • pitch: Pitch relative to the reference attitude.
  • roll: Roll relative to the reference attitude.

Returns: 1 if the SetHeading command succeeded, 0 otherwise.

Engages SAS and sets the vessel's heading based on the reference attitude, heading, pitch, and roll. The reference attitude is one of the following:

  • 0 - Inertial Frame
  • 1 - Orbital Prograde
  • 2 - Orbital Prograde Horizontal
  • 3 - Surface Prograde
  • 4 - Surface Prograde Horizontal
  • 5 - Surface North
  • 6 - Target
  • 7 - Target Prograde
  • 8 - Target Orientation
  • 9 - Maneuver Node
  • 10 - Sun
  • 11 - Up

fc.GetAscentPilotActive()

Returns 1 if the MAS ascent autopilot is active, 0 if it is idle.

fc.GetAttitudePilotActive()

Returns: 1 if the attitude control pilot is active, 0 otherwise.

Reports if the attitude control pilot is actively attempting to control the vessel's heading. This pilot could be active if the crew used fc.SetHeading() to set the vessel's heading, or if another pilot module is using the attitude pilot's service.

fc.GetAttitudePilotHeading()

Returns: Heading relative to the reference attitude, in degrees.

Returns the currently stored heading offset in the atittude control pilot.

fc.GetAttitudePilotPitch()

Returns: Pitch relative to the reference attitude, in degrees.

Returns the currently stored pitch offset in the atittude control pilot.

fc.GetAttitudePilotRoll()

Returns: Roll relative to the reference attitude, in degrees.

Returns the currently stored roll offset in the atittude control pilot.

fc.GetAttitudeReference()

Returns: One of the numbers listed in the summary.

Returns the current attitude reference mode. This value may be one of the following:

  • 0 - Inertial Frame
  • 1 - Orbital Prograde
  • 2 - Orbital Prograde Horizontal
  • 3 - Surface Prograde
  • 4 - Surface Prograde Horizontal
  • 5 - Surface North
  • 6 - Target
  • 7 - Target Prograde
  • 8 - Target Orientation
  • 9 - Maneuver Node
  • 10 - Sun
  • 11 - Up

This reference mode does not indicate whether the attitude control pilot is active, but it does indicate which reference attitude will take effect if the pilot is engaged. Refer to the documentation for fc.SetHeading() for a detailed explanation of the attitude references.

fc.GetManeuverPilotActive()

Returns 1 if the MAS maneuver autopilot is active, 0 if it is idle.

fc.GetPilotActive()

Returns 1 if any MAS autopilot is active, 0 if all are idle.

fc.SetAttitudePilotActive(bool active)

  • active: If true, engage the autopilot and restore the previous attitude.

Returns: Returns 1 if the autopilot is now on, 0 if it is now off.

Set the attitude pilot to the selected state. If another pilot is using the attitude pilot (such as the launch pilot), switching off the attitude pilot will disengage the other pilot as well.

CAUTION: If the attitude system has not been initialized, this function may select the orbital prograde attitude, which may cause problems during launch or reentry.

fc.SetManeuverPilotActive(bool active)

  • active: If true, attempts to activate the maneuver autopilot; if false, deactivates it.

Returns: 1 if the maneuver autopilot is active, 0 if it is not active.

Sets the maneuver autopilot state to active or not based on 'active'. If no valid maneuver node exists, activating the maneuver pilot has no effect.

fc.ToggleAttitudePilot()

Returns: Returns 1 if the autopilot is now on, 0 if it is now off.

Toggle the MAS attitude pilot. The exisiting reference attitude and heading, pitch, and roll are restored. If another pilot is using the attitude pilot (such as the launch pilot), switching off the attitude pilot will disengage the other pilot as well.

CAUTION: If the attitude system has not been initialized, it defaults to a orbital prograde, which may not be desired.

fc.ToggleManeuverPilot()

Returns: 1 if the maneuver pilot is now active, 0 if it is now inactive.

Toggles the maneuver autopilot.


Body Category

Information about the Celestial Bodies may be fetched using the methods in this category.

Most of these methods function in one of two ways: by name or by number. By name means using the name of the body to select it (eg, fc.BodyMass("Jool")). However, since strings are slightly slower than numbers for lookups, these methods will accept numbers. The number for a world can be fetched using fc.BodyIndex(), fc.CurrentBodyIndex(), or fc.TargetBodyIndex().

fc.BodyArea(object id)

  • id: The name or index of the body of interest.

Returns: Surface area of the planet in m^2.

Returns the surface area of the selected body.

fc.BodyAtmosphereTop(object id)

  • id: The name or index of the body of interest.

Returns: The altitude of the top of the atmosphere, in meters, or 0.

Returns the altitude of the top of the selected body's atmosphere. If the body does not have an atmosphere, or an invalid body is selected, 0 is returned.

fc.BodyBiome(object id, double latitude, double longitude)

  • id: The name or index of the body of interest.
  • latitude: Latitude of the location of interest.
  • longitude: Longitude of the location of interest.

Returns: The name of the biome at the specified location, or an empty string.

Returns the name of the biome at the given location on the selected body.

fc.BodyCount()

The number of Celestial Bodies in the database.

fc.BodyDistance(object id)

  • id: The name or index of the body of interest.

Returns: Distance in meters, or 0 if invalid.

Returns the distance to the requested body, in meters.

fc.BodyEscapeVelocity(object id)

  • id: The name or index of the body of interest.

Returns: Escape velocity in m/s, or 0 if the body was invalid.

Returns the escape velocity of the body.

fc.BodyGeeASL(object id)

  • id: The name or index of the body of interest.

Returns: Acceleration in G's, or 0 if the body was invalid.

Returns the acceleration from gravity as the surface for the selected body.

fc.BodyGM(object id)

  • id: The name or index of the body of interest.

Returns: GM in m^3/s^2, or 0 if the body is invalid.

Returns the standard gravitational parameter of the body.

fc.BodyHasAtmosphere(object id)

  • id: The name or index of the body of interest.

Returns: 1 if the body has an atmosphere, 0 if it does not, or an invalid body was selected.

Indicates if the selected body has an atmosphere.

fc.BodyHasOxygen(object id)

  • id: The name or index of the body of interest.

Returns: 1 if the body has an atmosphere that contains oxygen, 0 if it does not, or an invalid body was selected.

Indicates if the selected body's atmosphere has oxygen.

fc.BodyIndex(object id)

  • id: The name of the body, eg. "Kerbin" or one of the indices (including -1 and -2).

Returns: An index from 0 to (number of Celestial Bodies - 1), or -1 if the named body was not found.

Returns the numeric identifier for the named body. If the name is invalid (no such body exists), returns -1. May also use the index, which is useful for -1 and -2.

fc.BodyIsHome(object id)

  • id: The name or index of the body of interest.

Returns: 1 if the body is home, 0 otherwise.

Returns 1 if the selected body is "Home" (Kerbin in un-modded KSP).

fc.BodyIsMoon(object id)

  • id: The name or index of the body of interest.

Returns: 1 if the body is a moon, 0 if it is a planet.

Returns 0 if the selected body orbits the star; returns 1 if the body is a moon of another body.

fc.BodyMass(object id)

  • id: The name or index of the body of interest.

Returns: Mass in kg.

Returns the mass of the requested body.

fc.BodyMoonCount(object id)

  • id: The name or index of the body of interest.

Returns: The number of moons, or 0 if an invalid value was provided.

Returns the number of worlds orbiting the selected body. If the body is a planet, this is the number of moons. If the body is the Sun, this number is the number of planets.

fc.BodyMoonId(object id, double moonIndex)

  • id: The name or index of the body of interest.
  • moonIndex: The index of the moon to select, between 0 and 'fc.BodyMoonCount(id)' - 1.

Returns: Returns an index 0 or greater, or -1 for an invalid combination of 'id' and 'moonIndex'.

Returns the numeric ID of the moon selected by moonIndex that orbits the body selected by 'id'. If 'id' is the Sun, moonIndex selects the planet.

fc.BodyName(object id)

  • id: The name or index of the body of interest.

Returns: The name of the body, or an empty string if invalid.

Returns the name of the requested body. While this method can be used with a name for its parameter, that is kind of pointless.

fc.BodyRadius(object id)

  • id: The name or index of the body of interest.

Returns: Radius in meters, or 0 if the body is invalid.

Returns the radius of the selected body.

fc.BodyParent(object id)

  • id: The name or index of the body of interest.

Returns: Returns the index of the body that the current body orbits.

Returns the index of the parent of the selected body. Returns 0 (the Sun) on an invalid id.

fc.BodyRotationPeriod(object id)

  • id: The name or index of the body of interest.

Returns: Rotation period in seconds, or 0.

Returns the rotation period of the body. If the body does not rotate, 0 is returned.

fc.BodySoI(object id)

  • id: The name or index of the body of interest.

Returns: SoI in meters

Returns the radius of the body's Sphere of Influence.

fc.BodySunLongitude(object id)

  • id: The name or index of the body of interest.

Returns: Longitude of local noon, or 0 if it could not be determined.

Returns the longitude on the body that is directly below the sun (longitude of local noon).

fc.BodySurfaceTemp(object id, bool useKelvin)

  • id: The name or index of the body of interest.
  • useKelvin: If true, temperature is in Kelvin; if false, temperature is in Celsius.

Returns: Surface temperature in K or C; 0 if the selected object was invalid

Returns the temperature of the body at sea level.

fc.BodySyncOrbitSMA(object id)

  • id: The name or index of the body of interest.

Returns: SMA in meters, or 0 if the body is invalid, or the synchronous orbit is out side the body's SoI.

Returns the semi-major axis of a synchronous orbit with the selected body. When a vessel's SMA matches the sync orbit SMA, a craft is in a synchronous orbit.

fc.BodySyncOrbitVelocity(object id)

  • id: The name or index of the body of interest.

Returns: Velocity in m/s, or 0 if there is no synchronous orbit.

Returns the speed of a synchronous orbit. Provided an orbit is perfectly circular, an orbit that has this velocity will be synchronous.

fc.BodyTerrainHeight(object id, double latitude, double longitude)

  • id: The name or index of the body of interest.
  • latitude: Latitude of the location of interest in degrees.
  • longitude: Longitude of the location of interest in degrees.

Returns: Terrain height in meters. Will return negative values for locations below sea level.

Returns the terrain height at a given latitude and longitude relative to the planet's datum (sea level or equivalent). Height in meters.

fc.BodyTerrainSlope(object id, double latitude, double longitude)

  • id: The name or index of the body of interest.
  • latitude: Latitude of the location of interest in degrees.
  • longitude: Longitude of the location of interest in degrees.

Returns: Slope in degrees.

Returns an estimate of the terrain slope at a given latitude and longitude. If the location is beneath the ocean, it provides the slope of the ocean floor. Values near the poles may be very inaccurate.

fc.CurrentBodyIndex()

Returns: The index of the current body, used as the 'id' parameter in other body query functions.

Returns the index of the body currently being orbited, for use as an input for other body query functions..

fc.SetBodyTarget(object id)

  • id: The name or index of the body of interest.

Returns: 1 if the command succeeds, 0 if an invalid body name or index was provided.

Set the vessel's target to the selected body.

fc.BodyTargetIndex()

Returns: The index of the targeted body, or -1.

Returns the body index of the current target, provided the target is a celestial body. If there is no target, or the current target is not a body, returns -1.


Brakes Category

Variables related to a vessel's brakes and air brakes are in this category.

fc.BrakesHasActions()

Returns 1 if the brakes action group has at least one action assigned to it.

fc.GetAirBrakeCount()

Returns: 0 or more.

Returns the number of air brakes installed on the vessel.

Air brakes are defined as parts that have ModuleAeroSurface installed.

fc.GetAirBrakes()

Returns: 1 for air brakes deployed, 0 for no air brakes deployed, or no air brakes.

Returns 1 if any air brakes are deployed. Returns 0 if no air brakes are deployed.

A future update may return a number between 0 and 1 to report the amount of brake deployment.

fc.GetBrakeForce()

Returns: The brake force as a percentage of maximum, in the range of [0, 2].

Returns the average brake force setting of all wheel brakes installed on the vessel.

fc.GetBrakes()

Returns: 1 if the brake action group is active, 0 otherwise.

Returns the current state of the Brakes action group

fc.SetBrakeForce(double force)

  • force: The new brake force setting, in the range of 0 to 2.

Returns: The brake force as a percentage of maximum, in the range of [0, 2].

Sets the brake force setting of all wheel brakes installed on the vessel.

fc.SetAirBrakes(bool active)

Returns: 1 if air brakes are now deployed, 0 if they are now retracted or if there are no air brakes.

Set the state of the air brakes.

fc.SetBrakes(bool active)

  • active: Sets the state of the brakes

Returns: 1 if the brake action group is active, 0 otherwise.

Set the brake action group to the specified state.

fc.ToggleAirBrakes()

Returns: 1 if air brakes are now deployed, 0 if they are now retracted or if there are no air brakes.

Toggle the state of the air brakes.

fc.ToggleBrakes()

Returns: 1 if the brake action group is active, 0 otherwise.

Toggle the state of the brake action group.


Cameras Category

The methods in this section are focused around controlling external cameras installed on the vessel. They provide an interface between the MASCamera part module and CAMERA nodes in a monitor page.

fc.ActiveDockingPortCamera()

Returns: The name of the MASCamera on the reference docking port, or an empty string.

Returns the name of the camera (if any) attached to the current reference docking port. If the reference transform is not a docking port, or there is no camera on the reference docking port, an empty string is returned.

fc.ActiveDockingPortCameraIndex()

Returns: The index between 0 and fc.CameraCount() - 1, or -1 if there is no camera on the current docking port, or a docking port camera is not active.

Returns the index of the camera (if any) attached to the current reference docking port. If the reference transform is not a docking port, or there is no camera on the reference docking port, -1 is returned.

fc.AddFoV(double index, double deltaFoV)

  • index: A number between 0 and fc.CameraCount() - 1.
  • deltaFoV: The number of degrees to add or subtract from the current FoV.

Returns: The new field of view setting, or 0 if an invalid index was supplied.

Adjusts the field of view setting on the selected camera. The change in deltaFoV is clamped to the selected camera's range. A negative value reduces the FoV, which is equivalent to zooming in; a positive value increases the FoV (zooms out).

fc.AddPan(double index, double deltaPan)

  • index: A number between 0 and fc.CameraCount() - 1.
  • deltaPan: The number of degrees to increase or decrease the pan position.

Returns: The new pan setting, or 0 if an invalid index was supplied.

Adjusts the pan setting on the selected camera. deltaPan is clamped to the pan range of the selected camera. A negative value pans the camera left, while a positive value pans right.

fc.AddTilt(double index, double deltaTilt)

  • index: A number between 0 and fc.CameraCount() - 1.
  • deltaTilt: The number of degrees to increase or decrease the pan position.

Returns: The new tilt setting, or 0 if an invalid index was supplied.

Adjusts the tilt setting on the selected camera. deltaTilt is clamped to the tilt range of the selected camera. A negative value tilts the camera up, while a positive value tils the camera down. Verify these directions

fc.GetCameraCanPan(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: 1 if the camera can pan, 0 if it cannot pan or an invalid index is provided.

Returns 1 if the camera is capable of panning left/right.

fc.GetCameraCanTilt(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: 1 if the camera can tilt, 0 if it cannot tilt or an invalid index is provided.

Returns 1 if the camera is capable of tilting up/down.

fc.GetCameraCanZoom(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: 1 if the camera can zoom, 0 if it cannot zoom or an invalid index is provided.

Returns 1 if the camera is capable of zooming.

fc.CameraCount()

Returns: The number of valid MASCamera modules installed on this vessel.

Returns a count of the valid MASCamera modules found on this vessel.

fc.GetCameraDamaged(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns 1 if the selected camera is damaged, 0 otherwise. Deployable cameras may be damaged.

fc.GetCameraDeployable(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns 1 if the selected camera is deployable, 0 otherwise.

fc.GetCameraDeployed(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns 1 if the selected camera is deployed, 0 otherwise.

fc.GetCameraMaxFoV(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The maximum field of view in degrees, or 0 for an invalid camera index.

Returns the maximum field of view supported by the selected camera.

fc.GetCameraMaxPan(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The maximum pan in degrees, or 0 for an invalid camera index.

Returns the maximum pan angle supported by the selected camera.

fc.GetCameraMaxTilt(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The maximum tilt in degrees, or 0 for an invalid camera index.

Returns the maximum tilt angle supported by the selected camera.

fc.GetCameraMinFoV(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The minimum field of view in degrees, or 0 for an invalid camera index.

Returns the minimum field of view supported by the selected camera.

fc.GetCameraMinPan(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The minimum pan in degrees, or 0 for an invalid camera index.

Returns the minimum pan angle supported by the selected camera.

fc.GetCameraMinTilt(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The minimum tilt in degrees, or 0 for an invalid camera index.

Returns the minimum tilt angle supported by the selected camera.

fc.GetCameraMode(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The number of the modes (between 0 and fc.GetCameraModeCount(index)-1), or 0 if an invalid camera was selected.

Returns the id number of the currently-active mode on the MASCamera selected by index.

fc.GetCameraModeCount(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The number of modes (1 or higher), or 0 if an invalid camera was selected.

Returns the number of modes available to the MASCamera selected by index.

fc.GetCameraModeName(double index, double mode)

  • index: A number between 0 and fc.CameraCount() - 1.
  • mode: A number between 0 and fc.GetCameraModeCount(index) - 1.

Returns: The name of the selected mode, or an empty string if an invalid camera or mode was selected.

Returns the id number of the currently-active mode on the MASCamera selected by index.

fc.GetCameraMoving(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: -1, 0, or +1.

Returns -1 if the selected camera is retracting, +1 if it is extending, or 0 for any other situation (including non-deployable cameras).

fc.GetCameraName(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The name of the camera, or an empty string.

Returns the name of the camera selected by index, or an empty string if the index is invalid.

fc.GetFoV(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The current field of view setting, or 0 if an invalid index was supplied.

Retrieve the current field of view setting on the selected camera.

fc.GetPan(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The current pan setting, or 0 if an invalid index was supplied.

Retrieve the current pan setting on the selected camera.

fc.GetTilt(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: The current tilt setting, or 0 if an invalid index was supplied.

Retrieve the current tilt setting on the selected camera.

fc.SetCameraDeployment(double index, bool deploy)

  • index: A number between 0 and fc.CameraCount() - 1.
  • deploy: true to deploy the camera, false to retract it.

Returns: 1 if the camera deploys / undeploys, 0 otherwise.

Extends or retracts a deployable camera. Has no effect on non-deployable cameras.

fc.SetCameraMode(double index, double mode)

  • index: A number between 0 and fc.CameraCount() - 1.
  • mode: A number between 0 and fc.GetCameraModeCount(index) - 1.

Returns: The mode that was selected, or 0 if an invalid camera was selected.

Returns the id number of the currently-active mode on the MASCamera selected by index.

fc.SetFoV(double index, double newFoV)

  • index: A number between 0 and fc.CameraCount() - 1.
  • newFoV: The new field of view of the selected camera.

Returns: The new field of view setting, or 0 if an invalid index was supplied.

Adjusts the field of view setting on the selected camera. newFoV is clamped to the FoV range.

fc.SetPan(double index, double newPan)

  • index: A number between 0 and fc.CameraCount() - 1.
  • newPan: The new pan position of the camera. Use 0 to send it to the camera's home position.

Returns: The new pan setting, or 0 if an invalid index was supplied.

Adjusts the pan setting on the selected camera. newPan is clamped to the pan range.

fc.SetTilt(double index, double newTilt)

  • index: A number between 0 and fc.CameraCount() - 1.
  • newTilt: The new tilt position for the camera. Use 0 to send it to the home position.

Returns: The new tilt setting, or 0 if an invalid index was supplied.

Adjusts the tilt setting on the selected camera. newTilt is clamped to the camera's tilt range.

fc.ToggleCameraDeployment(double index)

  • index: A number between 0 and fc.CameraCount() - 1.

Returns: 1 if the camera deploys / undeploys, 0 otherwise.

Toggles a deployable camera (retracts it if extended, extends it if retracted). Has no effect on non-deployable cameras.


Cargo Bay Category

The methods in this section provide information on cargo bays, including the number of such bays and their deployment state. There are also methods to open and close such bays.

Note that, for the purpose of this section, cargo bays are defined as parts that use ModuleAnimateGeneric to control access to the cargo bay. The ModuleServiceModule introduced for the KSP Making History expansion is not counted, since it does not provide a method that MAS can use to deploy the covers.

fc.CargoBayCount()

Returns: The number of controllable cargo bays on the vessel.

Returns a count of the number of controllable cargo bays on the vessel.

fc.CargoBayMoving()

Returns: -1, 0, or +1.

Returns -1 if any cargo bay doors are closing, +1 if any are opening, or 0 if none are moving.

fc.CargoBayPosition()

Returns: A number between 0 and 1 as described in the summary.

Returns a number representing the average position of cargo bay doors.

  • 0 - No cargo bays, or all cargo bays are closed.
  • 1 - All cargo bays open.

If the cargo bays are moving, a number between 0 and 1 is returned.

fc.SetCargoBay(bool open)

Returns: 1 if at least one cargo bay is now opening or closing, 0 otherwise.

Open or close cargo bays. Will not affect any cargo bays that are already in motion.

fc.ToggleCargoBay()

Returns: 1 if at least one cargo bay is now moving, 0 otherwise.

Opens closed cargo bays, closes open cargo bays. Will not try to toggle any cargo bays that are already in motion.


Color Changer Category

The Color Changer category controls the ModuleColorChanger module on parts. This module is most commonly used to toggle emissives representing portholes and windows on occupied parts, as well as the charring effect on heat shields.

There are two groups of functions in this category. Those functions that contain the name PodColorChanger only affect the current command pod / part. This allows external cockpit glows to be coordinated with interior lighting, for instance. The other group of functions contain ColorChanger without the Pod prefix. Those functions are used to control all ModuleColorChanger installations on the current vessel.

The ColorChanger functions may return inconsistent results if modules are controlled through other interfaces, such as the PodColorChanger functions or action groups.

The Color Changer category only interacts with those modules that have toggleInFlight and toggleAction set to true.

fc.ColorChangerCount()

Returns: An integer 0 or larger.

Returns the total number of ModuleColorChanger installed on the vessel.

fc.ColorChangerId(double ccId)

  • ccId: An integer between 0 and fc.ColorChangerCount() - 1.

Returns: The moduleID field of the selected ModuleColorChanger, or an empty string..

Returns the module ID for the selected color changer module.

Returns an empty string if an invalid ccId is provided.

fc.GetColorChanger()

Returns: 1 if the color changers are on, 0 if they are off, or there are no color changer modules.

Returns the current state of the vessel color changer modules.

fc.GetPodColorChanger()

Returns: 1 if the color changer is on, 0 if it is off, or there is no color changer module.

Returns the current state of the current part's color changer module.

fc.PodColorChangerCanChange()

Returns 1 if the pod's color changer module can currently be changed. Returns 0 if it cannot, or there is no color changer module.

fc.PodColorChangerExists()

Returns: 1 or 0.

Returns 1 if the current IVA has a color changer module.

fc.SetColorChanger(bool newState)

  • newState: true to switch on the color changers, false to switch them off.

Returns: 1 if any color changers were updated.

Set the state of all color changer modules.

Some color changers may not be able to update under some circumstances, so this function could return 0 with a valid color changer.

fc.SetPodColorChanger(bool newState)

  • newState: true to switch on the color changer, false to switch it off.

Returns: 1 if the color changer has been updated, 0 if did not change, or it cannot currently change, or there is no color changer module.

Set the state of the pod color changer.

Some color changers may not be able to update under some circumstances, so this function could return 0 with a valid color changer. Query fc.PodColorChangerCanChange() to determine in advance if the color changer is able to be updated.

fc.ToggleColorChanger()

Returns: 1 if any color changers were updated.

Toggle the color changers on the vessel.

If the current pod has a color changer, its setting is used to decide the toggled setting. For instance, if the pod's color changer is on, then all color changers will be switched off.

If the current pod does not have a color changer, the first color changer detected will decide what the new state will be.

fc.TogglePodColorChanger()

Returns: 1 if the color changer is switching on, 0 if it is switching off, or there is no color changer.

Toggle the pod's color changer.


CommNet Category

Functions related to CommNet connectivity are in this category, as are functions related to the Kerbal Deep Space Network ground stations.

fc.AntennaCount()

Returns: The number of deployable antennae on the vessel.

Returns the number of antennae on the vessel.

fc.AntennaDamaged()

Returns: 1 if all antennae are damaged; 0 otherwise.

Returns 1 if any antennae are damaged.

fc.AntennaDeployable()

Returns: 1 if any antenna is retracted and available to deploy; 0 otherwise.

Returns 1 if at least one antenna may be deployed.

fc.AntennaMoving()

Returns: -1, 0, or +1.

Returns -1 if an antenna is retracting, +1 if an antenna is extending, or 0 if no antennas are moving.

fc.AntennaPosition()

Returns: A number between 0 and 1 as described in the summary.

Returns a number representing the average position of undamaged deployable antennae.

  • 0 - No antennae, no undamaged antennae, or all undamaged antennae are retracted.
  • 1 - All deployable antennae extended.

If the antennae are moving, a number between 0 and 1 is returned.

fc.AntennaRetractable()

Returns: 1 if a antenna is deployed, and it may be retracted; 0 otherwise.

Returns 1 if at least one antenna is retractable.

fc.CommNetCanCommunicate()

Returns: 1 if the vessel can communicate, 0 otherwise.

Reports if the vessel can communicate.

fc.CommNetCanScience()

Returns: 1 if the vessel can transmit science, 0 otherwise.

Reports if the vessel can transmit science.

fc.CommNetConnected()

Returns: 1 if the vessel is connected, 0 otherwise.

Reports if the vessel is connected to CommNet.

fc.CommNetConnectedHome()

Returns: 1 if the vessel can talk to home, 0 otherwise.

Reports if the vessel has a connection home.

fc.CommNetControlState()

Returns: A value between -1 and +2

Returns the current control state of the vessel:

  • 2: Full Kerbal control
  • 1: Partial Kerbal control
  • 0: No Kerbal control
  • -1: Other control state

fc.CommNetEndpoint()

Returns: The name of the endpoint.

Returns the name of the endpoint of the CommNet connection.

fc.CommNetLatitude()

Returns: Latitude of the DSN relay, or 0.

Returns the latitude on Kerbin of the current CommNet deep space relay. If there is no link home, returns 0.

fc.CommNetLongitude()

Returns: Longitude of the DSN relay, or 0.

Returns the longitude on Kerbin of the current CommNet deep space relay. If there is no link home, returns 0.

fc.CommNetSignalDelay()

Returns: Delay in seconds.

Returns the signal delay between the vessel and its CommNet endpoint.

fc.CommNetSignalQuality()

Returns: A value from 0 to 4 as described in the summary.

Returns a quality value for the CommNet signal. The quality value correlates to the "signal bars" display on the KSP UI.

  • 0 - No signal
  • 1 - Red
  • 2 - Orange
  • 3 - Yellow
  • 4 - Green

fc.CommNetSignalStrength()

Returns: A value between 0 (no signal) and 1 (maximum signal strength).

Returns the signal strength of the CommNet signal.

fc.GroundStationAltitude(double dsnIndex)

  • dsnIndex: A value between 0 and fc.GroundStationCount() - 1.

Returns: The altitude of the station, or 0 if an invalid station index was specified.

Returns the altitude of the selected ground station.

fc.GroundStationCount()

Returns the number of ground stations in the Kerbal deep space network.

fc.GroundStationLatitude(double dsnIndex)

  • dsnIndex: A value between 0 and fc.GroundStationCount() - 1.

Returns: The latitude of the station, or 0 if an invalid station index was specified.

Returns the latitude of the selected ground station.

fc.GroundStationLongitude(double dsnIndex)

  • dsnIndex: A value between 0 and fc.GroundStationCount() - 1.

Returns: The longitude of the station, or 0 if an invalid station index was specified.

Returns the longitude of the selected ground station.

fc.GroundStationName(double dsnIndex)

  • dsnIndex: A value between 0 and fc.GroundStationCount() - 1.

Returns: The name of the station, or an empty string if an invalid station index was specified.

Returns the name of the selected ground station.

fc.SetAntenna(bool deploy)

  • deploy: Whether the function should deploy the antennae or undeploy them.

Returns: 1 if any antenna changes, 0 if all are already in the specified state.

Deploys antennae (when 'deployed' is true) or undeploys antennae (when 'deployed' is false).

fc.ToggleAntenna()

Returns: 1 if any antennas were toggled, 0 otherwise

Deploys / undeploys antennae.


Control Input State Category

Variables and actions related to the controls (roll / pitch / yaw / translation) are in this category.

fc.ControlNeutral()

Returns 1 when roll/translation controls are near neutral.

fc.StickPitch()

Returns the current pitch control state.

fc.StickRoll()

Returns the current roll control state.

fc.StickTranslationX()

Returns: A value between -1 (full left) and +1 (full right).

Returns the current X translation state. Note that this value is the direction the thrust is firing, not the direction the vessel will move.

fc.StickTranslationY()

Returns: A value between -1 (full top) and +1 (full bottom).

Returns the current Y translation state. Note that this value is the direction the thrust is firing, not the direction the vessel will move.

fc.StickTranslationZ()

Returns: A value between -1 (full aft) and +1 (full forward).

Returns the current Z translation state. Note that this value is the direction the thrust is firing, not the direction the vessel will move.

fc.StickTrimPitch()

Returns: Trim setting, between -1 and +1

Returns the current pitch trim setting.

fc.StickTrimRoll()

Returns: Trim setting, between -1 and +1

Returns the current roll trim setting.

fc.StickTrimYaw()

Returns: Trim setting, between -1 and +1

Returns the current yaw trim setting.

fc.StickYaw()

Returns the current yaw control state.


Control Point Category

This category allows the current IVA's control point to be changed, and it provides information about the available control points on this part.

Note that control points must be defined in ModuleCommand. If the current part is not a command pod (no ModuleCommand), then the control point cannot be updated.

fc.GetCurrentControlPoint()

Returns: An integer between 0 and fc.GetNumControlPoints() - 1.

Returns the index of the current control point, or 0 if there are no control points.

fc.GetControlPointName(double controlPoint)

  • controlPoint: An integer between 0 and fc.GetNumControlPoints() - 1, or -1.

Returns: The name of the control point, or an empty string.

Get the name for the selected control point. If there are no control points, or an invalid controlPoint is specified, returns an empty string.

If controlPoint is -1, the current control point's name is returned.

fc.GetNumControlPoints()

Returns: 0, or the number of available control points.

Returns the number of control points on the current part. If there is no ModuleCommand on the part, returns 0.

fc.SetCurrentControlPoint(double newControlPoint)

  • newControlPoint: An integer between 0 and fc.GetNumControlPoints() - 1.

Returns: 1 if the control point was updated, 0 otherwise.

Set the control point to the index selected by newControlPoint. If newControlPoint is not valid, or there is no ModuleCommand, nothing happens.


Crew Category

The Crew category provides information about the crew aboard the vessel.

seatNumber is a 0-based index to select which seat is being queried. This means that a 3-seat pod has valid seat numbers 0, 1, and 2. A single-seat pod has a valid seat number 0.

One difference to be aware of between RPM and MAS: The full-vessel crew info (those methods starting 'VesselCrew') provide info on crew members without regards to seating arrangements. For instance, if the command pod has 2 of 3 seats occupied, and a passenger pod as 1 of 4 seats occupied, VesselCrewCount will return 3, and the crew info (eg, VesselCrewName) will provide values for indices 0, 1, and 2.

fc.CrewBadS(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: 1 or 0 (see summary)

Returns 1 if the crew in seatNumber has the 'BadS' trait. Returns 0 if seatNumber is invalid or there is no crew in that seat, or the crew does not possess the 'BadS' trait.

fc.CrewConscious(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0. Use -1 to check the kerbal in the current seat.

Returns: 1 if the crew member is conscious, 0 if the crew member is unconscious.

Returns 1 if the crew in seatNumber has passed out due to G-forces.

fc.CrewEva(double seatNumber)

  • seatNumber: A negative number, or a number in the range [0, fc.NumberSeats()-1].

Returns: 1 if a Kerbal is ejected, 0 if no Kerbal was ejected.

Ejects ... or sends ... the selected Kerbal to EVA.

If seatNumber is a negative value, the Kerbal who is currently viewing the control will go on EVA. If seatNumber is between 0 and fc.NumberSeats(), and the seat is currently occupied, the selected Kerbal goes on EVA.

In all cases, the camera shifts to EVA view if a Kerbal is successfully expelled from the command pod.

fc.CrewExperience(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: A number 0 or higher; 0 if the requested seat is invalid or empty.

Returns the number of experience points for the selected crew member.

fc.CrewGender(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: 1 if the crew is male, 2 if the crew is female, 0 if the seat is empty.

Returns a number representing the gender of the selected crew member.

fc.CrewLevel(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: A number 0-5; 0 if the requested seat is invalid or empty.

Returns the experience level of the selected crew member.

fc.CrewName(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: The crew name, or an empty string if there is no crew in the given seat.

Returns the name of the crew member seated in seatNumber. If the number is invalid, or no Kerbal is in the seat, returns an empty string.

fc.CrewPanic(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: A number between 0 and 1; 0 if the requested seat is invalid or empty.

Returns the 'PANIC' level of the selected crew member.

fc.CrewStupidity(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: A number between 0 and 1; 0 if the requested seat is invalid or empty.

Returns the stupidity rating of the selected crew member.

fc.CrewTitle(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: The name of the job title, or an empty string if seatNumber is invalid or unoccupied.

Returns the job title of the selected crew member.

fc.CrewWhee(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: A number between 0 and 1; 0 if the requested seat is invalid or empty.

Returns the 'WHEE' level of the selected crew member.

fc.NumberSeats()

Returns: The number of seats in the current IVA (1 or more).

Returns the number of seats in the current IVA pod.

fc.SeatOccupied(double seatNumber)

  • seatNumber: The index of the seat to check. Indices start at 0.

Returns: 1 if seatNumber is a valid seat; 0 otherwise.

Indicates whether a given seat is occupied by a Kerbal. Returns 1 when seatNumber is valid and there is a Kerbal in the given seat, and returns 0 in all other instances.

fc.VesselCrewBadS(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: 1 or 0 (see summary)

Returns 1 if the selected crew has the 'BadS' trait. Returns 0 if crewIndex is invalid or the crew does not possess the 'BadS' trait.

fc.VesselCrewCapacity()

Returns: 0 or higher.

Capacity of all crewed locations on the vessel.

fc.VesselCrewCount()

Returns: 0 or higher.

Total count of crew aboard the vessel.

fc.VesselCrewExperience(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: A number 0 or higher; 0 if the requested seat is invalid.

Returns the number of experience points for the selected crew member.

fc.VesselCrewGender(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: 1 if the crew is male, 2 if the crew is female, 0 if the index is invalid.

Returns a number representing the gender of the selected crew member.

fc.VesselCrewLevel(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: A number 0-5; 0 if the requested index is invalid.

Returns the experience level of the selected crew member.

fc.VesselCrewName(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: The crew name, or an empty string if index is invalid.

Returns the name of the crew member seated in seatNumber. If the number is invalid, or no Kerbal is in the seat, returns an empty string.

fc.VesselCrewPanic(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: A number between 0 and 1; 0 if the requested index is invalid.

Returns the 'PANIC' level of the selected crew member.

fc.VesselCrewStupidity(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: A number between 0 and 1; 0 if the requested index is invalid.

Returns the stupidity rating of the selected crew member.

fc.VesselCrewTitle(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: The name of the job title, or an empty string if crewIndex is invalid.

Returns the job title of the selected crew member.

fc.VesselCrewWhee(double crewIndex)

  • crewIndex: The index of the crewmember to check. Indices start at 0.

Returns: A number between 0 and 1; 0 if the requested index is invalid.

Returns the 'WHEE' level of the selected crew member.


Docking Category

Docking control and status are in the Docking category.

Many of these methods use the concept of "Primary Docking Port". The primary docking port is defined as the first or only docking port found on the vessel. These features are primarily centered around CTV / OTV type spacecraft where there is a single dock, not space stations or large craft with many docks.

fc.DockConnected()

Return 1 if the dock is attached to something (this includes parts that are not compatible to the docking port, such as boost protective covers or launch escape systems that are attached in the VAB).

To determine if the dock is connected to a compatible docking port, use fc.Docked().

fc.DockedObjectName()

Returns: The name of the docked vessel.

Returns the name of the object docked to the vessel. Returns an empty string if fc.Docked() returns 0.

fc.Docked()

Return 1 if the dock is attached to a compatible dock; return 0 otherwise.

Note that this function will return 0 if the compatible dock was connected in the VAB. fc.Docked() only detects docking events that take place during Flight.

fc.DockReady()

Return 1 if the dock is ready; return 0 otherwise.

fc.GetDockIsReference()

Returns 1 if the primary docking port on the vessel is the current reference transform.

Returns 0 if the primary docking port is not the reference transform, or if there is no docking port, or if a docking port other than the primary port is the reference transform.

fc.GetGrappleIsReference()

Returns 1 if the primary grapple on the vessel is the current reference transform.

Returns 0 if the grapple is not the reference transform, or if there is no grapple, or if a grapple other than the primary grapple is the reference transform.

fc.GetPodIsReference()

Returns 1 if the current IVA pod is the reference transform. Returns 0 otherwise.

fc.GetTargetDockIndex()

Returns: For a valid docking port, a number between 0 and 'fc.TargetDockCount()' - 1. Otherwise, -1.

Returns the index of the docking port currently tracked by the vessel.

If no port is being tracked, returns -1.

fc.HasDock()

Returns: 1 if a node was found, 0 otherwise.

Indicates whether a primary docking port was found on this vessel.

fc.SetDockToReference()

Returns: 1 if the reference was changed, 0 otherwise.

Set the primary docking port to be the reference transform.

fc.SetGrappleToReference()

Returns: 1 if the reference was changed, 0 otherwise.

Set the primary grapple to be the reference transform.

fc.SetPodToReference()

Returns: 1 if the reference was changed.

Set the current IVA pod to be the reference transform.

fc.SetTargetDock(double idx)

  • idx: A value between 0 and fc.TargetDockCount() - 1.

Returns: 1 the dock could be targeted, 0 otherwise.

Targets the docking port on the target vessel identified by 'idx'.

Note that KSP only allows targeting docking ports within a certain range (typically 200 meters).

fc.TargetDockCount()

Returns: Number of available compatible docking ports, or total available docking ports, or 0.

Returns the number of available docking ports found on the target vessel when the following conditions are met:

  1. There are docking ports on the target vessel compatible with the designated docking port on the current vessel. The designated docking port is either the only docking port on the current vessel, or it is one of the docking ports selected arbitrarily.

  2. There are no docking ports on the current vessel. In this case, all docking ports on the target vessel are counted.

Note that if the target is unloaded, this method will return 0. If the target is not a vessel, it also returns 0.

This function is identical to fc.TargetAvailableDockingPorts().

fc.TargetDockError()

Returns: The roll required to align docking ports, or 0.

Returns the angle in degrees that the vessel must roll in order to align with the currently-targeted docking port.

If no dock is targeted, there are no alignment requirements, or a compatible docking port is not the reference part, this function returns 0.

fc.TargetDockName(double idx)

Returns: The name of the selected dock, or an empty string.

Returns the name of the target dock selected by 'idx'. If the Docking Port Alignment Indicator mod is installed, the name given to the dock from that mod is returned. Otherwise, only the part's name is returned.

fc.TargetNextDock()

Returns: 1 if a dock could be targeted, 0 otherwise.

Targets the next valid docking port on the target vessel.

Note that KSP only allows targeting docking ports within a certain range (typically 200 meters).

fc.Undock()

Returns: 1 if the active dock undocked from something, 0 otherwise.

Undock / detach (if pre-attached) the active docking node.


Engine Category

Engine status and control methods are in the Engine category.

fc.CurrentFuelFlow()

Returns the current fuel flow in grams/second

fc.CurrentGimbalDeflection()

Returns the average deflection of active, unlocked gimbals, from 0 (no deflection) to 1 (max deflection).

The direction of the deflection is ignored, but the value accounts for assymetrical gimbal configurations, eg, if X+ is 5.0, and X- is -3.0, the deflection percentage accounts for this difference.

fc.CurrentIsp()

Returns: The current Isp.

Return the current specific impulse in seconds.

fc.CurrentRatedThrust()

Returns: Thrust output, ranging from 0 to 1.

Returns the current thrust output relative to the current stage's max rated thrust, from 0.0 to 1.0.

fc.CurrentThrust(bool useThrottleLimits)

Returns: Thrust output, ranging from 0 to 1.

Returns the current thrust output, from 0.0 to 1.0.

fc.CurrentThrustkN()

Returns the current thrust in kiloNewtons

fc.CurrentTWR()

Returns the current thrust-to-weight ratio.

fc.DeltaV()

Returns: Remaining delta-V in m/s.

Supported Mod(s): MechJeb, Kerbal Engineer Redux

Returns the total delta-V remaining for the vessel based on its current altitude.

If Kerbal Engineer or MechJeb is installed, those mods are used for the computation.

fc.DeltaVStage()

Returns: Remaining delta-V for this stage in m/s.

Returns an estimate of the delta-V remaining for the current stage. This computation uses the current ISP.

fc.DeltaVStageMax()

Returns: Maximum delta-V for this stage in m/s.

Returns an estimate of the maximum delta-V for the current stage. This computation uses the current ISP.

fc.EngineCountActive()

Returns a count of the total number of engines that are active.

fc.EngineCountTotal()

Returns a count of the total number of engines tracked. This count includes engines that have not staged.

fc.EngineFlameout()

Returns 1 if any active engines are in a flameout condition.

fc.GetEnginesEnabled()

Returns 1 if at least one engine is enabled.

fc.GetActiveEnginesGimbal()

Returns 1 if any currently-active engines have gimbals. Returns 0 if no active engine has a gimbal.

fc.GetGimbalDeflectionX()

Returns: A value in the range [-1, 1].

Returns the normalized (-1 to +1) gimbal deflection of unlocked gimbals along their local X axis.

Note that if two engines are deflected in opposite directions during a roll maneuver, this value could be zero.

fc.GetGimbalDeflectionY()

Returns: A value in the range [-1, 1].

Returns the normalized (-1 to +1) gimbal deflection of unlocked gimbals along their local Y axis.

Note that if two engines are deflected in opposite directions during a roll maneuver, this value could be zero.

fc.GetGimbalLimit()

Returns the currently-configured limit of active gimbals, as set in the right-click part menus. This value ranges between 0 (no gimbal) and 1 (100% gimbal).

fc.GetGimbalPitch()

Returns: 1 if active gimbals support pitch, 0 otherwise.

Returns 1 if any active, unlocked gimbals are configured to provide pitch control. Returns 0 otherwise.

fc.GetGimbalRoll()

Returns: 1 if active gimbals support roll, 0 otherwise.

Returns 1 if any active, unlocked gimbals are configured to provide roll control. Returns 0 otherwise.

fc.GetGimbalYaw()

Returns: 1 if active gimbals support yaw, 0 otherwise.

Returns 1 if any active, unlocked gimbals are configured to provide yaw control. Returns 0 otherwise.

fc.GetGimbalsActive()

Returns 1 if any gimbals are currently active.

fc.GetGimbalsLocked()

Returns 1 if at least one active gimbal is locked.

fc.GetMultiModeEngineMode()

Returns 1 if any multi-mode engine is in secondary mode, 0 if no engines are, or there are no multi-mode engines.

fc.GetThrottle()

Returns the current main throttle setting, from 0.0 to 1.0.

fc.GetThrottleLimit()

Returns the average of the throttle limit for the active engines, ranging from 0 (no thrust) to 1 (maximum thrust).

fc.MaxFuelFlow()

Returns the maximum fuel flow in grams/second

fc.MaxIsp()

Returns the maximum specific impulse in seconds.

fc.MaxRatedThrustkN()

Returns: Maximum thrust in kN

Returns the maximum rated thrust in kN for the active engines.

fc.MaxThrustkN(bool useThrottleLimits)

  • useThrottleLimits: Apply throttle limits?

Returns: Maximum thrust in kN

Returns the maximum thrust in kN for the current altitude.

fc.MaxTWR(bool useThrottleLimits)

  • useThrottleLimits: Apply throttle limits?

Returns: Thrust-to-weight ratio, between 0 and 1.

Returns the maximum thrust-to-weight ratio.

fc.SetEnginesEnabled(bool enable)

Returns: 1 if engines are now enabled, 0 if they are disabled.

Turns on/off engines for the current stage.

fc.SetGimbalLimit(double newLimit)

  • newLimit: The new gimbal limit, between 0 and 1.

Returns: 1 if any gimbals were updated, 0 otherwise.

Change the gimbal limit for active gimbals. Values less than 0 or greater than 1 are clamped to that range.

fc.SetGimbalLock(bool locked)

Returns: 1 if any gimbals changed, 0 if none changed.

Locks or unlocks engine gimbals for the current stage.

fc.SetGimbalPitch(bool enable)

  • enable: If true, enables gimbal pitch control. If false, disables gimbal pitch control.

Returns: 1 if any gimbal pitch control changed, 0 otherwise.

Controls whether active, unlocked gimbals provide pitch control.

fc.SetGimbalRoll(bool enable)

  • enable: If true, enables gimbal roll control. If false, disables gimbal roll control.

Returns: 1 if any gimbal roll control changed, 0 otherwise.

Controls whether active, unlocked gimbals provide roll control.

fc.SetGimbalYaw(bool enable)

  • enable: If true, enables gimbal yaw control. If false, disables gimbal yaw control.

Returns: 1 if any gimbal yaw control changed, 0 otherwise.

Controls whether active, unlocked gimbals provide yaw control.

fc.SetMultiModeEngineMode(bool runPrimary)

  • runPrimary: Selects the primary mode when true, the secondary mode when false.

Returns: 1 if any engines were toggled, 0 if no multi-mode engines are installed.

Selects the primary or secondary mode for multi-mode engines.

fc.SetThrottle(double throttlePercentage)

  • throttlePercentage: Throttle setting, between 0 and 1.

Returns: The new throttle setting.

Set the throttle. May be set to any value between 0 and 1. Values outside that range are clamped to [0, 1].

fc.SetThrottleLimit(double newLimit)

Set the throttle limit. May be set to any value between 0 and 1. Values outside that range are clamped to [0, 1].

fc.StockDeltaV()

Returns: Remaining delta-V in m/s.

Returns the total delta-V remaining for the vessel based on its current altitude.

This version uses only the stock KSP delta-V computations.

fc.StockDeltaVStage()

Returns: Remaining delta-V for this stage in m/s.

Returns an estimate of the delta-V remaining for the current stage. This computation uses the current ISP.

This version uses only the stock KSP delta-V computations.

fc.ToggleEnginesEnabled()

Returns: 1 if engines are now enabled, 0 if they are disabled.

Turns on/off engines for the current stage

fc.ToggleGimbalLock()

Returns: 1 if active gimbals are now locked, 0 if they are unlocked.

Toggles gimbal lock on/off for the current stage.

fc.ToggleGimbalPitch()

Returns: 1 if any gimbal pitch control changed, 0 otherwise.

Toggles pitch control for active, unlocked gimbals.

fc.ToggleGimbalRoll()

Returns: 1 if any gimbal roll control changed, 0 otherwise.

Toggles roll control for active, unlocked gimbals.

fc.ToggleGimbalYaw()

Returns: 1 if any gimbal yaw control changed, 0 otherwise.

Toggles yaw control for active, unlocked gimbals.

fc.ToggleMultiModeEngineMode()

Returns: 1 if any engines were toggled, 0 if no multi-mode engines are installed.

Toggles the mode for any multi-mode engines.


Flight Status Category

Flight status variables are in this category.

fc.VesselLanded()

Returns 1 if the vessel is in a landed state (LANDED, SPLASHED, or PRELAUNCH); 0 otherwise

fc.VesselFlying()

Returns 1 if the vessel is in a flying state (FLYING, SUB_ORBITAL, ORBITING, ESCAPING, DOCKED).

fc.VesselSituation()

Returns: A number between 0 and 7 (inclusive).

Returns the vessel's situation, based on the KSP variable:

  • 0 - LANDED
  • 1 - SPLASHED
  • 2 - PRELAUNCH
  • 3 - FLYING
  • 4 - SUB_ORBITAL
  • 5 - ORBITING
  • 6 - ESCAPING
  • 7 - DOCKED

fc.VesselSituationName()

Returns the name of the vessel's situation.


Gear Category

Variables and control methods for the Gear action group are in this category. In addition, status and information methods for deployable landing gear and wheels are in this category. For simplicity, landing gear and wheels may be simply called "landing gear" in the descriptions.

fc.DeployableGearCount()

Returns: Number of deployable gear, or 0.

Returns the number of deployable landing gear on the craft. this function only counts the parts using ModuleWheelDeployment.

fc.GearBrokenCount()

Returns: The number of landing gear that are broken.

Returns the number of landing gear or wheels that are broken. Returns 0 if none are, or if there are no gear.

fc.GearCount()

Returns: Number of gear, or 0.

Returns the number of wheels / landing gear installed on the craft. This function counts all landing gear and wheels, including those that do not deploy.

fc.GearHasActions()

Returns 1 if there are actions assigned to the landing gear AG.

fc.GearMoving()

Returns: -1, 0, or +1.

Returns -1 if any deployable landing gear or wheels are retracting, +1 if they are extending. Otherwise returns 0.

fc.GearPosition()

Returns: An number between 0 and 1 as described in the summary.

Returns a number representing the average position of undamaged deployable landing gear or wheels.

  • 0 - No deployable gear, no undamaged gear, or all undamaged gear are retracted.
  • 1 - All deployable gear extended.

If the gear are moving, a number between 0 and 1 is returned.

fc.GearStress()

Returns: Highest stress percentage, or 0 if no gear/wheels.

Returns the highest stress percentage of any non-broken landing gear in the range [0, 1].

fc.GetGear()

Returns 1 if the landing gear action group is active.

fc.SetGear(bool active)

Returns: 1 if active is true, 0 otherwise.

Set the landing gear action group to the specified state.

fc.ToggleGear()

Returns: 1 if the gear action group is active, 0 if not.

Toggle the landing gear action group


Grapple Category

The Grapple category controls grappling nodes ("The Claw").

Like the Dock category, many of these methods use the concept of "Primary Grapple". The primary grapple is defined as the first or only grapple found on the vessel.

Grapples may be made reference transforms. The functions related to that are found under the Dock category to be consistent with the existing reference transform functionality.

fc.GetGrapplePivotLocked()

Returns 1 if the primary grapple's pivot is locked, returns 0 if it is unlocked, or there is no grapple.

fc.GrappleArmed()

Returns: 1 if the primary grapple is ready, 0 if it is not ready (in use, not armed), or there is no grapple.

Returns 1 if the primary grapple is armed and ready for use. Returns 0 otherwise.

fc.Grappled()

Returns 1 if the primary grapple is holding something. Returns 0 if it is not, or no grapple is installed.

fc.GrappledObjectName()

Returns: The name of the grappled object.

Returns the name of the object grappled by the vessel. Returns an empty string if fc.Grappled() returns 0.

fc.GrappleMoving()

Returns: -1 if the grapple is disarming, +1 if the grapple is arming, 0 otherwise.

Returns a number representing whether the primary grapple is arming, or disarming, or not changing.

fc.GrappleReady()

Returns: 1 if the primary grapple is ready, 0 if it is not ready, or there is no grapple.

Returns 1 if the primary grapple is armed and ready for use. Returns 0 otherwise.

fc.GrappleRelease()

Returns: 1 if the grapple released, 0 if it did not, or there is no grapple.

Release the primary grapple from whatever it's connected to.

fc.HasGrapple()

Returns: 1 if a grapple is available, 0 if none were detected.

Indicates whether a primary grapple was found on the vessel.

fc.SetGrappleArmed(bool armGrapple)

  • armGrapple: If true, and the grapple is disarmed, arm the grapple. If false, and the grapple can be disarmed, disarm the grapple.

Returns: 1 if the state was changed. 0 otherwise.

Sets the arming state of the primary grapple. Has no effect if there is no grapple, or if it can not be armed or disarmed, such as when it is grappling something.

fc.SetGrapplePivot(bool locked)

  • locked: If true, the joint is locked. If loose, it is unlocked.

Returns: 1 if the state is changed, 0 otherwise.

Change whether the primary grapple's pivot is locked on loose.

fc.ToggleGrappleArmed()

Returns: 1 if the grapple is arming or disarming, 0 if the grapple does not have an arming behavior, or if there is no grapple.

Arm or disarm the installed primary grapple.

fc.ToggleGrapplePivot()

Returns: 1 if the state qas changed, 0 otherwise.

Toggle the state of the primary grapple's pivot


Lights Category

The Lights action group can be controlled and queried through this category.

fc.LightsHasActions()

Returns 1 if the Lights action group has at least one action assigned to it.

fc.GetLights()

Returns: 1 if the lights action group is active, 0 otherwise.

Returns 1 if the Lights action group is active.

fc.SetLights(bool active)

Returns: 1 if the lights action group is active, 0 otherwise.

Set the state of the lights action group.

fc.ToggleLights()

Returns: 1 if the lights action group is active, 0 otherwise.

Toggle the lights action group.


This documentation was automatically generated from source code at 15:10 UTC on 23/Aug/2020.