Skip to content

MASFlightComputerProxy

MOARdV edited this page Jan 5, 2019 · 80 revisions

MASFlightComputerProxy.cs

Contents

The fc group contains the core interface between KSP, Avionics Systems, and props in an IVA. It consists of many 'variable' 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: If a variable listed below includes an entry for 'Required Mod(s)', then the mod listed (or any of the mods, if more than one) must be installed for that particular feature to work.


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 in standard atmospheres.

fc.StaticPressureKPa()

Returns: Static pressure in kPa.

Returns the static atmospheric pressure 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.

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 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.

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

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

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 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, it selects an inertial reference attitude, which will cause problems during launch or reentry.

fc.SetHeading(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 - the universe's inertial frame of reference, relative to no bodies or vessels.
  • 1 - Orbital Prograde - The orbital prograde direction with Radial Out up.
  • 2 - Orbital Prograde Horizontal - The orbital prograde direction with a surface-relative up.
  • 3 - Surface Prograde - The surface prograde direction with Radial Out up.
  • 4 - Surface Prograde Horizontal - The surface prograde direction with a surface-relative up.
  • 5 - Surface North - Local planetary north with a surface-relative up.
  • 6 - Target - Pointed towards the target with an up direction based on Radial Out.
  • 7 - Target Relative Prograde - Target-relative prograde with an up direction based on Radial Out.
  • 8 - Target Orientation - target's "forward" and "up" directions (for celestial bodies, this is an arbitrary direction).
  • 9 - Maneuver Node - towards the maneuver node, with up based on Radial Out.
  • 10 - Sun - towards the Sun, with an inertial reference frame "up".

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 an inertial reference attitude, which will cause problems during launch or reentry.

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.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 are in this category.

fc.BrakesHasActions()

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

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.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.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.AddFoV(double index, double deltaFoV)

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.

fc.AddPan(double index, double deltaPan)

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

Adjusts the pan setting on the selected camera.

fc.AddTilt(double index, double deltaTilt)

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

Adjusts the tilt setting on the selected camera.

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)

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

Retrieve the field of view setting on the selected camera.

fc.GetPan(double index)

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

Retrieve the pan setting on the selected camera.

fc.GetTilt(double index)

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

Retrieve the 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)

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.

fc.SetPan(double index, double setPan)

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

Adjusts the pan setting on the selected camera.

fc.SetTilt(double index, double setTilt)

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

Adjusts the tilt setting on the selected camera.

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.


CommNet Category

Variables related to CommNet connectivity are in this category.

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.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.


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.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.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.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.SetDockToReference()

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

Set the primary docking port 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: If the active dock undocked from something.

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.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.

Required 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.

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.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.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.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.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.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.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

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.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 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


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 14:26 UTC on 5/Jan/2019.

Clone this wiki locally