Parts#

The following classes allow interaction with a vessel’s individual parts.

See also

The parts guide walks the tree of parts, and explains fuel lines, stage numbers and part modules.

Parts#

class SpaceCenter.Parts()#

Instances of this class are used to interact with the parts of a vessel. An instance can be obtained by calling SpaceCenter.Vessel.getParts().

Parts.getAll()#

A list of all of the vessels parts.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Part

Parts.getRoot()#

The vessels root part.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Note

See the discussion on Traversing the Tree.

Parts.getControlling()#
Parts.setControlling(value)#

The part from which the vessel is controlled. Returns null if the vessel has no control point, in which case it is oriented by its root part.

Property:

Can be read or written

Return type:

SpaceCenter.Part or null

Game Scenes:

Flight

Note

A vessel gets no control point when it is created by a decoupler or an undocking and none of its parts is a command module with crew aboard. A probe core does not give it one either. Assign this property to choose the control point, which is equivalent to “Control From Here” in game.

Parts.withName(name)#

A list of parts whose SpaceCenter.Part.getName() is name.

Arguments:
  • name (string) – The name of the part.

Return type:

Array of SpaceCenter.Part

Parts.withTitle(title)#

A list of all parts whose SpaceCenter.Part.getTitle() is title.

Arguments:
  • title (string) – The title of the part.

Return type:

Array of SpaceCenter.Part

Parts.withTag(tag)#

A list of all parts whose SpaceCenter.Part.getTag() is tag.

Arguments:
  • tag (string) – The name tag of the part.

Return type:

Array of SpaceCenter.Part

Parts.withModule(moduleName)#

A list of all parts that contain a SpaceCenter.Module whose SpaceCenter.Module.getName() is moduleName.

Arguments:
  • moduleName (string) – The name of the module.

Return type:

Array of SpaceCenter.Part

Parts.modulesWithName(moduleName)#

A list of modules (combined across all parts in the vessel) whose SpaceCenter.Module.getName() is moduleName.

Arguments:
  • moduleName (string) – The name of the module.

Return type:

Array of SpaceCenter.Module

Parts.getAntennas()#

A list of all antennas in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Antenna

Note

A part with several antennas has an entry for each. If RemoteTech is installed, this will always return an empty list. To interact with RemoteTech antennas, use the RemoteTech service APIs.

Parts.getCargoBays()#

A list of all cargo bays in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.CargoBay

Parts.getControlSurfaces()#

A list of all control surfaces in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.ControlSurface

Parts.getDecouplers()#

A list of all decouplers in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Decoupler

Parts.getDockingPorts()#

A list of all docking ports in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.DockingPort

Parts.getEngines()#

A list of all engines in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Engine

Note

This includes any part that generates thrust. This covers many different types of engine, including liquid fuel rockets, solid rocket boosters, jet engines and RCS thrusters.

Parts.getExperiments()#

A list of all science experiments in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Experiment

Parts.getFairings()#

A list of all fairings in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Fairing

Parts.getIntakes()#

A list of all intakes in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Intake

Parts.getLegs()#

A list of all landing legs attached to the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Leg

Parts.getLaunchClamps()#

A list of all launch clamps attached to the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.LaunchClamp

Parts.getLights()#

A list of all lights in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Light

Parts.getParachutes()#

A list of all parachutes in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Parachute

Parts.getRadiators()#

A list of all radiators in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Radiator

Parts.getResourceDrains()#

A list of all resource drains in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.ResourceDrain

Parts.getRCS()#

A list of all RCS blocks/thrusters in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.RCS

Parts.getReactionWheels()#

A list of all reaction wheels in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.ReactionWheel

Parts.getResourceConverters()#

A list of all resource converters in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.ResourceConverter

Parts.getResourceHarvesters()#

A list of all resource harvesters in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.ResourceHarvester

Parts.getRoboticControllers()#

A list of all robotic controllers in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.RoboticController

Parts.getRoboticHinges()#

A list of all robotic hinges in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.RoboticHinge

Parts.getRoboticPistons()#

A list of all robotic pistons in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.RoboticPiston

Parts.getRoboticRotations()#

A list of all robotic rotations in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.RoboticRotation

Parts.getRoboticRotors()#

A list of all robotic rotors in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.RoboticRotor

Parts.getSensors()#

A list of all sensors in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Sensor

Parts.getSolarPanels()#

A list of all solar panels in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.SolarPanel

Parts.getWheels()#

A list of all wheels in the vessel.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Wheel

Part#

class SpaceCenter.Part()#

Represents an individual part. Vessels are made up of multiple parts. Instances of this class can be obtained by several methods in SpaceCenter.Parts.

Part.getName()#

Internal name of the part, as used in part cfg files. For example “Mark1-2Pod”.

Property:

Read-only, cannot be set

Return type:

string

Part.getTitle()#

Title of the part, as shown when the part is right clicked in-game. For example “Mk1-2 Command Pod”.

Property:

Read-only, cannot be set

Return type:

string

Part.getConfig()#

The static configuration of the part, as found in its part cfg file. This provides access to data that is not exposed elsewhere, such as the configuration of the part’s modules. Returns null if the part has no associated configuration node.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ConfigNode

Part.getTag()#
Part.setTag(value)#

The name tag for the part. Can be set to a custom string using the in-game user interface. Throws an exception if no name tag part module is installed.

Property:

Can be read or written

Return type:

string

Note

Requires KSPCommunityPartModules 0.5 or later, or kOS, which share one name tag.

Part.getFlagURL()#
Part.setFlagURL(value)#

The asset URL for the part’s flag.

Property:

Can be read or written

Return type:

string

Part.getHighlighted()#
Part.setHighlighted(value)#

Whether the part is highlighted.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Note

The highlighting is removed when the client that enabled it disconnects.

Part.getHighlightColor()#
Part.setHighlightColor(value)#

The color used to highlight the part.

Property:

Can be read or written

Return type:

StdLib.ColorRGB

Game Scenes:

Flight

Part.getCost()#

The cost of the part with its resources full, in units of funds.

Property:

Read-only, cannot be set

Return type:

number

Part.getVessel()#

The vessel that contains this part.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Vessel

Game Scenes:

Flight

Part.getParent()#

The parts parent. Returns null if the part does not have a parent. This, in combination with SpaceCenter.Part.getChildren(), can be used to traverse the vessels parts tree.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part or null

Note

See the discussion on Traversing the Tree.

Part.getChildren()#

The parts children. Returns an empty list if the part has no children. This, in combination with SpaceCenter.Part.getParent(), can be used to traverse the vessels parts tree.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Part

Note

See the discussion on Traversing the Tree.

Part.getAxiallyAttached()#

Whether the part is axially attached to its parent, i.e. on the top or bottom of its parent. If the part has no parent, returns false.

Property:

Read-only, cannot be set

Return type:

boolean

Note

See the discussion on Attachment Modes.

Part.getRadiallyAttached()#

Whether the part is radially attached to its parent, i.e. on the side of its parent. If the part has no parent, returns false.

Property:

Read-only, cannot be set

Return type:

boolean

Note

See the discussion on Attachment Modes.

Part.getStage()#

The stage in which this part will be activated. Returns -1 if the part is not activated by staging.

Property:

Read-only, cannot be set

Return type:

number

Note

See the discussion on Staging.

Part.getDecoupleStage()#

The stage in which this part will be decoupled. Returns -1 if the part is never decoupled from the vessel.

Property:

Read-only, cannot be set

Return type:

number

Note

See the discussion on Staging.

Part.getMassless()#

Whether the part is massless.

Property:

Read-only, cannot be set

Return type:

boolean

Part.getMass()#

The current mass of the part, including resources it contains, in kilograms. Returns zero if the part is massless.

Property:

Read-only, cannot be set

Return type:

number

Part.getDryMass()#

The mass of the part, not including any resources it contains, in kilograms. Returns zero if the part is massless.

Property:

Read-only, cannot be set

Return type:

number

Part.getShielded()#

Whether the part is shielded from the exterior of the vessel, for example by a fairing.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Part.getDynamicPressure()#

The dynamic pressure acting on the part, in Pascals.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getStaticPressure()#

The static pressure acting on the part, in Pascals. Below the waterline this includes the pressure of the water.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getDisplacement()#

The volume of water the part displaces when fully submerged, in \(\mathrm{m^{3}}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

See SpaceCenter.Part.getDisplacedVolume() for the volume it is displacing now.

Part.getBuoyancyMultiplier()#

The multiplier applied to the buoyant force on the part. One for most parts.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Part.buoyantForceAt(density, gravity)#

The buoyant force on the part when fully submerged in a fluid of the given density, in Newtons.

Arguments:
  • density (number) – The density of the fluid, in \(\mathrm{kg/m^{3}}\).

  • gravity (number) – The acceleration due to gravity, in \(\mathrm{m/s^{2}}\).

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Applies SpaceCenter.getBuoyancyScalar() and SpaceCenter.Part.getBuoyancyMultiplier(), so the result is what the game would do to the part rather than what Archimedes’ principle alone gives.

Part.getSplashed()#

Whether the part is in contact with water.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Part.getSubmergedPortion()#

The fraction of the part below the waterline, between 0 and 1.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getDisplacedVolume()#

The volume of water the part is displacing, in \(\mathrm{m^{3}}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getDepth()#

The depth of the part below the waterline, in meters, measured at SpaceCenter.Part.centerOfDisplacement(). Negative above the waterline. Returns zero if the body the vessel is at has no ocean.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getMinDepth()#

The depth of the shallowest point of the part below the waterline, in meters. Returns zero if the body the vessel is at has no ocean.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getMaxDepth()#

The depth of the deepest point of the part below the waterline, in meters. Returns zero if the body the vessel is at has no ocean.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The game ramps the buoyant force in over the first fraction of a meter of this depth.

Part.getSubmergedDynamicPressure()#

The dynamic pressure of the water acting on the part, in Pascals.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getSubmergedDragMultiplier()#

The multiplier applied to the drag on the part while it is submerged.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The game sets this high on splashdown and eases it down as the part moves through the water. It climbs back once the part slows to a crawl, so a hull under way reads lower than one lying still.

Part.getSubmergedLiftMultiplier()#

The multiplier applied to the lift on the part while it is submerged.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getWaterAngularDragMultiplier()#

The multiplier applied to the angular drag on the part while it is submerged.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Part of the part’s configuration rather than a live readout, so it reads the same in the editor and at a body with no ocean.

Part.getImpactTolerance()#

The crash tolerance of the part, in \(\mathrm{m/s}\).

Property:

Read-only, cannot be set

Return type:

number

Part.getBreakingForce()#

The breaking force of the part’s attachments, in \(\mathrm{kN}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

The joint to the parent part takes the lower breaking force of the two parts, scaled by the size of the attachment node. See SpaceCenter.Part.getJointBreakForce().

Part.getBreakingTorque()#

The breaking torque of the part’s attachments, in \(\mathrm{kN \cdot m}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

The joint to the parent part takes the lower breaking torque of the two parts, scaled by the size of the attachment node. See SpaceCenter.Part.getJointBreakTorque().

Part.getJointBreakForce()#

The force that breaks the joint to the parent part, in \(\mathrm{kN}\). Throws an exception if the part has no joint to its parent part.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The sum over the joint’s physics joints. It is infinite for a short time after the vessel loads, such as just after launch. The root part and a physicsless part have no joint to their parent.

Part.getJointBreakTorque()#

The torque that breaks the joint to the parent part, in \(\mathrm{kN \cdot m}\). Throws an exception if the part has no joint to its parent part.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The sum over the joint’s physics joints. It is infinite for a short time after the vessel loads. On a stack node of size 2 or more, the physics joints sit apart around the node. A bending moment then breaks the joint when one physics joint’s force exceeds its share of SpaceCenter.Part.getJointBreakForce(), usually at a much larger moment than this torque.

Part.getJointSpring()#

The spring constant of the joint to the parent part against translation, in \(\mathrm{kN/m}\). Throws an exception if the part has no joint to its parent part.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The sum over the joint’s physics joints. A rigid attachment locks the joint, and this spring then has no effect.

Part.getJointDamper()#

The damping constant of the joint to the parent part against translation, in \(\mathrm{kN \cdot s/m}\). Throws an exception if the part has no joint to its parent part.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The sum over the joint’s physics joints. The stock game sets it to zero, and mods such as Kerbal Joint Reinforcement change it.

Part.getJointAngularSpring()#

The spring constant of the joint to the parent part against bending, in \(\mathrm{kN \cdot m/rad}\). Throws an exception if the part has no joint to its parent part.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The sum over the joint’s physics joints, about the two axes perpendicular to the joint axis. The joint is far stiffer against twisting about its axis. On a stack node of size 2 or more, the physics joints sit apart around the node, and the joint bends much less than this spring gives. A rigid attachment makes it infinite.

Part.getJointAngularDamper()#

The damping constant of the joint to the parent part against bending, in \(\mathrm{kN \cdot m \cdot s/rad}\). Throws an exception if the part has no joint to its parent part.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The sum over the joint’s physics joints. The stock game sets it to zero, and mods such as Kerbal Joint Reinforcement change it.

Part.getTemperature()#

Temperature of the part, in Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getSkinTemperature()#

Temperature of the skin of the part, in Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getMaxTemperature()#

Maximum temperature that the part can survive, in Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Part.getMaxSkinTemperature()#

Maximum temperature that the skin of the part can survive, in Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Part.getMaxPressure()#

Maximum pressure that the part can survive, in Pascals.

Property:

Read-only, cannot be set

Return type:

number

Note

With part pressure limits enabled in the difficulty settings, the part is destroyed when SpaceCenter.Part.getStaticPressure() plus SpaceCenter.Part.getDynamicPressure() exceeds this.

Part.getThermalMass()#

A measure of how much energy it takes to increase the internal temperature of the part, in Joules per Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getThermalSkinMass()#

A measure of how much energy it takes to increase the skin temperature of the part, in Joules per Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getThermalResourceMass()#

A measure of how much energy it takes to increase the temperature of the resources contained in the part, in Joules per Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getThermalConductionFlux()#

The rate at which heat energy is conducting into or out of the part via contact with other parts. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getThermalConvectionFlux()#

The rate at which heat energy is convecting into or out of the part from the surrounding atmosphere. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getThermalRadiationFlux()#

The rate at which heat energy is radiating into or out of the part from the surrounding environment. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getThermalInternalFlux()#

The rate at which heat energy is begin generated by the part. For example, some engines generate heat by combusting fuel. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getThermalSkinToInternalFlux()#

The rate at which heat energy is transferring between the part’s skin and its internals. Measured in energy per unit time, or power, in Watts. A positive value means the part’s internals are gaining heat energy, and negative means its skin is gaining heat energy.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getCrewCapacity()#

The number of crew members that can occupy the part.

Property:

Read-only, cannot be set

Return type:

number

Part.getCrew()#

The crew members occupying the part.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.CrewMember

Game Scenes:

Flight

Part.getAvailableSeats()#

How many open seats the part has.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Part.getResources()#

A SpaceCenter.Part.getResources() object for the part.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Resources

Part.getCrossfeed()#

Whether this part is crossfeed capable.

Property:

Read-only, cannot be set

Return type:

boolean

Part.getIsFuelLine()#

Whether this part is a fuel line.

Property:

Read-only, cannot be set

Return type:

boolean

Part.getFuelLinesFrom()#

The parts that are connected to this part via fuel lines, where the direction of the fuel line is into this part.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Part

Game Scenes:

Flight

Note

See the discussion on Fuel Lines.

Part.getFuelLinesTo()#

The parts that are connected to this part via fuel lines, where the direction of the fuel line is out of this part.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Part

Game Scenes:

Flight

Note

See the discussion on Fuel Lines.

Part.getModules()#

The modules for this part.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Module

Part.getAntenna()#

An SpaceCenter.Part.getAntenna() if the part is an antenna, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Antenna or null

Note

For a part with several antennas, this is the first. SpaceCenter.Parts.getAntennas() lists them all. If RemoteTech is installed, this will always return null. To interact with RemoteTech antennas, use the RemoteTech service APIs.

Part.getCargoBay()#

A SpaceCenter.Part.getCargoBay() if the part is a cargo bay, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.CargoBay or null

Part.getControlSurface()#

A SpaceCenter.Part.getControlSurface() if the part is an aerodynamic control surface, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ControlSurface or null

Part.getDecoupler()#

A SpaceCenter.Part.getDecoupler() if the part is a decoupler, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Decoupler or null

Part.getDockingPort()#

A SpaceCenter.Part.getDockingPort() if the part is a docking port, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DockingPort or null

Part.getEngine()#

An SpaceCenter.Part.getEngine() if the part is an engine, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Engine or null

Part.getExperiment()#

An SpaceCenter.Part.getExperiment() if the part contains a single science experiment, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Experiment or null

Note

Throws an exception if the part contains more than one experiment. In that case, use SpaceCenter.Part.getExperiments() to get the list of experiments in the part.

Part.getExperiments()#

A list of SpaceCenter.Part.getExperiment() objects that the part contains.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Experiment or null

Part.getFairing()#

A SpaceCenter.Part.getFairing() if the part is a fairing, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Fairing or null

Part.getIntake()#

An SpaceCenter.Part.getIntake() if the part is an intake, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Intake or null

Note

This includes any part that generates thrust. This covers many different types of engine, including liquid fuel rockets, solid rocket boosters and jet engines. For RCS thrusters see SpaceCenter.Part.getRCS().

Part.getLeg()#

A SpaceCenter.Part.getLeg() if the part is a landing leg, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Leg or null

Part.getLaunchClamp()#

A SpaceCenter.Part.getLaunchClamp() if the part is a launch clamp, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.LaunchClamp or null

Part.getLight()#

A SpaceCenter.Part.getLight() if the part is a light, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Light or null

Part.getParachute()#

A SpaceCenter.Part.getParachute() if the part is a parachute, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Parachute or null

Part.getRadiator()#

A SpaceCenter.Part.getRadiator() if the part is a radiator, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Radiator or null

Part.getResourceDrain()#

A SpaceCenter.Part.getResourceDrain() if the part is a resource drain, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ResourceDrain or null

Part.getRCS()#

A SpaceCenter.Part.getRCS() if the part is an RCS block/thruster, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.RCS or null

Part.getReactionWheel()#

A SpaceCenter.Part.getReactionWheel() if the part is a reaction wheel, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ReactionWheel or null

Part.getResourceConverter()#

A SpaceCenter.Part.getResourceConverter() if the part is a resource converter, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ResourceConverter or null

Part.getResourceHarvester()#

A SpaceCenter.Part.getResourceHarvester() if the part is a resource harvester, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ResourceHarvester or null

Part.getRoboticController()#

A SpaceCenter.Part.getRoboticController() if the part is a robotic controller, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.RoboticController or null

Part.getRoboticHinge()#

A SpaceCenter.Part.getRoboticHinge() if the part is a robotic hinge, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.RoboticHinge or null

Part.getRoboticPiston()#

A SpaceCenter.Part.getRoboticPiston() if the part is a robotic piston, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.RoboticPiston or null

Part.getRoboticRotation()#

A SpaceCenter.Part.getRoboticRotation() if the part is a robotic rotation servo, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.RoboticRotation or null

Part.getRoboticRotor()#

A SpaceCenter.Part.getRoboticRotor() if the part is a robotic rotor, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.RoboticRotor or null

Part.getSensor()#

A SpaceCenter.Part.getSensor() if the part is a sensor, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Sensor or null

Part.getSolarPanel()#

A SpaceCenter.Part.getSolarPanel() if the part is a solar panel, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.SolarPanel or null

Part.getWheel()#

A SpaceCenter.Part.getWheel() if the part is a wheel, otherwise null.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Wheel or null

Part.position(referenceFrame)#

The position of the part in the given reference frame.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

This is a fixed position in the part, defined by the parts model. It s not necessarily the same as the parts center of mass. Use SpaceCenter.Part.centerOfMass() to get the parts center of mass.

Part.centerOfMass(referenceFrame)#

The position of the parts center of mass in the given reference frame. If the part is physicsless in flight, this is equivalent to SpaceCenter.Part.position().

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight, Editor Vab, Editor Sph

Part.boundingBox(referenceFrame)#

The axis-aligned bounding box of the part in the given reference frame.

Arguments:
Returns:

The positions of the minimum and maximum vertices of the box.

Return type:

SpaceCenter.BoundingBox

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

This is computed from the meshes that make up the parts model, and covers only this part - the models of any child parts are excluded. If the part has no visible model, the box has zero volume and is centered on the SpaceCenter.Part.centerOfMass() of the part.

Part.direction(referenceFrame)#

The direction the part points in, in the given reference frame.

Arguments:
Returns:

The direction as a unit vector.

Return type:

[number, number, number]

Game Scenes:

Flight, Editor Vab, Editor Sph

Part.velocity(referenceFrame)#

The linear velocity of the part in the given reference frame.

Arguments:
Returns:

The velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed of the body in \(\mathrm{m/s}\).

Return type:

[number, number, number]

Game Scenes:

Flight

Part.rotation(referenceFrame)#

The rotation of the part, in the given reference frame.

Arguments:
Returns:

The rotation as a quaternion of the form (x, y, z, w).

Return type:

[number, number, number, number]

Game Scenes:

Flight, Editor Vab, Editor Sph

Part.lift(referenceFrame)#

The aerodynamic lift currently acting on the part.

Arguments:
Returns:

A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.

Return type:

[number, number, number]

Game Scenes:

Flight

Note

Not available when Ferram Aerospace Research is installed.

Part.drag(referenceFrame)#

The aerodynamic drag currently acting on the part.

Arguments:
Returns:

A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.

Return type:

[number, number, number]

Game Scenes:

Flight

Note

Not available when Ferram Aerospace Research is installed.

Part.centerOfBuoyancy(referenceFrame)#

The point the buoyant force on the part acts at, in the given reference frame.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

A submerged part reports the point the game applied the force at, which it shifts towards the submerged part of the hull. Any other part reports its configured center of buoyancy.

Part.centerOfDisplacement(referenceFrame)#

The point the depth of the part is measured at, in the given reference frame.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight, Editor Vab, Editor Sph

Part.buoyantForce(referenceFrame)#

The buoyant force currently acting on the part.

Arguments:
Returns:

A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.

Return type:

[number, number, number]

Game Scenes:

Flight

Note

The buoyant force on its own. The water drag and lift the game applies alongside it are reported by SpaceCenter.Part.getSubmergedDragMultiplier() and SpaceCenter.Part.getSubmergedLiftMultiplier().

Part.getMomentOfInertia()#

The moment of inertia of the part in \(\mathrm{kg \cdot m^{2}}\) around its center of mass in the parts center of mass reference frame (SpaceCenter.Part.getCenterOfMassReferenceFrame()).

Property:

Read-only, cannot be set

Return type:

[number, number, number]

Game Scenes:

Flight, Editor Vab, Editor Sph

Part.getInertiaTensor()#

The inertia tensor of the part around its center of mass, in the parts center of mass reference frame (SpaceCenter.Part.getCenterOfMassReferenceFrame()). Returns the 3x3 matrix as a list of elements, in row-major order.

Property:

Read-only, cannot be set

Return type:

Array of number

Game Scenes:

Flight, Editor Vab, Editor Sph

Part.getReferenceFrame()#

The reference frame that is fixed relative to this part, and centered on a fixed position within the part, defined by the parts model.

  • The origin is at the position of the part, as returned by SpaceCenter.Part.position().

  • The axes rotate with the part.

  • The x, y and z axis directions depend on the design of the part.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ReferenceFrame

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

For docking port parts, this reference frame is not necessarily equivalent to the reference frame for the docking port, returned by SpaceCenter.DockingPort.getReferenceFrame().

../../../_images/part.png

Mk1 Command Pod reference frame origin and axes#

Part.getCenterOfMassReferenceFrame()#

The reference frame that is fixed relative to this part, and centered on its center of mass.

  • The origin is at the center of mass of the part, as returned by SpaceCenter.Part.centerOfMass().

  • The axes rotate with the part.

  • The x, y and z axis directions depend on the design of the part.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ReferenceFrame

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

For docking port parts, this reference frame is not necessarily equivalent to the reference frame for the docking port, returned by SpaceCenter.DockingPort.getReferenceFrame().

Part.addForce(force, position, referenceFrame)#

Warning

Deprecated. Use Debug.AddForce instead.

Exert a constant force on the part, acting at the given position.

Arguments:
  • force ([number, number, number]) – A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.

  • position ([number, number, number]) – The position at which the force acts, as a vector.

  • referenceFrame (SpaceCenter.ReferenceFrame) – The reference frame that the force and position are in.

Returns:

An object that can be used to remove or modify the force.

Return type:

SpaceCenter.Force

Game Scenes:

Flight

Note

The force is removed when the client that added it disconnects.

Part.instantaneousForce(force, position, referenceFrame)#

Warning

Deprecated. Use Debug.InstantaneousForce instead.

Exert an instantaneous force on the part, acting at the given position.

Arguments:
  • force ([number, number, number]) – A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.

  • position ([number, number, number]) – The position at which the force acts, as a vector.

  • referenceFrame (SpaceCenter.ReferenceFrame) – The reference frame that the force and position are in.

Game Scenes:

Flight

Note

The force is applied instantaneously in a single physics update.

Part.setGlow(value)#

Whether the part is glowing.

Property:

Write-only, cannot be read

Return type:

boolean

Game Scenes:

Flight

Part.getAutoStrutMode()#

Auto-strut mode.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.AutoStrutMode

Part.getHasRealFuelsTank()#

Whether the part is a fuel tank managed by RealFuels. The remaining properties in this section are only available when it is.

Property:

Read-only, cannot be set

Return type:

boolean

Part.getHighlyPressurized()#

Whether the tank is highly pressurized, which is what a pressure-fed engine needs to draw from (see SpaceCenter.Engine.getPressureFed()). Throws an exception if the part is not a RealFuels fuel tank (see SpaceCenter.Part.getHasRealFuelsTank()).

Property:

Read-only, cannot be set

Return type:

boolean

Note

Requires RealFuels.

Part.getBoiloffRate()#

The rate at which the tank’s cryogenic contents are boiling off, in kilograms per second of in-game time, measured over the last update RealFuels computed it in. The contents keep boiling off under time warp, where that update covers a much longer span of in-game time than a physics frame does. The rate is zero for a tank holding nothing cryogenic, for one still being fed by a launch clamp, whose temperature RealFuels holds down instead, and in the editor. Throws an exception if the part is not a RealFuels fuel tank (see SpaceCenter.Part.getHasRealFuelsTank()).

Property:

Read-only, cannot be set

Return type:

number

Note

Requires RealFuels.

class SpaceCenter.AutoStrutMode()#

The state of an auto-strut. SpaceCenter.Part.getAutoStrutMode()

AutoStrutMode.off#

Off

AutoStrutMode.root#

Root

AutoStrutMode.heaviest#

Heaviest

AutoStrutMode.grandparent#

Grandparent

AutoStrutMode.forceRoot#

ForceRoot

AutoStrutMode.forceHeaviest#

ForceHeaviest

AutoStrutMode.forceGrandparent#

ForceGrandparent

class SpaceCenter.Force()#

Obtained by calling Debug.AddForce.

Force.getPart()#

The part that this force is applied to.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight

Force.getForceVector()#
Force.setForceVector(value)#

The force vector, in Newtons.

Property:

Can be read or written

Returns:

A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.

Return type:

[number, number, number]

Game Scenes:

Flight

Force.getPosition()#
Force.setPosition(value)#

The position at which the force acts, in reference frame SpaceCenter.Force.getReferenceFrame().

Property:

Can be read or written

Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Force.getReferenceFrame()#
Force.setReferenceFrame(value)#

The reference frame of the force vector and position.

Property:

Can be read or written

Return type:

SpaceCenter.ReferenceFrame

Game Scenes:

Flight

Force.remove()#

Remove the force.

Game Scenes:

Flight

Note

Any further use of this object throws an exception.

Module#

class SpaceCenter.Module()#

This can be used to interact with a specific part module. This includes part modules in stock KSP, and those added by mods.

In KSP, each part has zero or more PartModules associated with it. Each one contains some of the functionality of the part. For example, an engine has a “ModuleEngines” part module that contains all the functionality of an engine.

Module.getName()#

Name of the PartModule. For example, “ModuleEngines”.

Property:

Read-only, cannot be set

Return type:

string

Module.getPart()#

The part that contains this module.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Module.getConfig()#

The static configuration of the module, as found in the part’s cfg file. This provides access to data that is not exposed as a field, such as the resources produced by a generator. Returns null if the module’s configuration node cannot be found.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ConfigNode

Module.getFieldList()#

A list of all the fields of the module, including those not visible in the right-click menu of the part. Filter by SpaceCenter.PartField.getVisible() to get just the visible ones.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.PartField

Module.getEventList()#

A list of all the events of the module, including those not currently visible or active. Events are the clickable buttons visible in the right-click menu of the part. Filter by SpaceCenter.PartEvent.getVisible() and SpaceCenter.PartEvent.getActive() to get just the ones shown in the menu.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.PartEvent

Module.getActionList()#

A list of all the actions of the module. These are the parts actions that can be assigned to action groups in the in-game editor.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.PartAction

class SpaceCenter.PartField()#

A field of a part module. Obtained by calling SpaceCenter.Module.getFieldList().

Note

Setting a field runs the callbacks that the right-click menu of the part runs.

PartField.getModule()#

The part module that contains this field.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Module

PartField.getName()#

The identifier of the field. This is stable and does not change between game versions, unlike SpaceCenter.PartField.getGuiName().

Property:

Read-only, cannot be set

Return type:

string

PartField.getGuiName()#

The name of the field, as displayed in the right-click menu of the part. This may be empty for fields that are not visible in the menu.

Property:

Read-only, cannot be set

Return type:

string

PartField.getVisible()#

Whether the field is visible in the right-click menu of the part, in the current scene (flight or editor).

Property:

Read-only, cannot be set

Return type:

boolean

PartField.getType()#

The type of the field.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.FieldType

PartField.getValue()#
PartField.setValue(value)#

The value of the field, as a string. This works for fields of any type, and returns the same string that is shown in the right-click menu of the part.

Property:

Can be read or written

Return type:

string

Note

Setting the value using this property is only permitted for string fields. Use the typed properties (SpaceCenter.PartField.getBoolValue(), SpaceCenter.PartField.getIntValue(), SpaceCenter.PartField.getFloatValue(), SpaceCenter.PartField.getDoubleValue()) to set fields of other types.

PartField.getBoolValue()#
PartField.setBoolValue(value)#

The value of a boolean field.

Property:

Can be read or written

Return type:

boolean

Note

The getter throws an exception if the field is not a boolean field (see SpaceCenter.PartField.getType()).

PartField.getIntValue()#
PartField.setIntValue(value)#

The value of an integer field.

Property:

Can be read or written

Return type:

number

Note

The getter throws an exception if the field is not an integer field (see SpaceCenter.PartField.getType()).

PartField.getFloatValue()#
PartField.setFloatValue(value)#

The value of a single precision floating point field.

Property:

Can be read or written

Return type:

number

Note

The getter throws an exception if the field is not a single precision floating point field (see SpaceCenter.PartField.getType()).

PartField.getDoubleValue()#
PartField.setDoubleValue(value)#

The value of a double precision floating point field.

Property:

Can be read or written

Return type:

number

Note

The getter throws an exception if the field is not a double precision floating point field (see SpaceCenter.PartField.getType()).

PartField.reset()#

Set the value of the field to its original value.

Note

The original value is the value the field had when the part was loaded. Works for any field, including those not visible in the right-click menu.

class SpaceCenter.FieldType()#

The type of a part module field. See SpaceCenter.PartField.getType().

FieldType.boolean#

A boolean field. Access using SpaceCenter.PartField.getBoolValue().

FieldType.integer#

An integer field. Access using SpaceCenter.PartField.getIntValue().

FieldType.float#

A single precision floating point field. Access using SpaceCenter.PartField.getFloatValue().

FieldType.double#

A double precision floating point field. Access using SpaceCenter.PartField.getDoubleValue().

FieldType.string#

A string field. Access using SpaceCenter.PartField.getValue().

FieldType.unknown#

A field whose type is not one of the above. Its value can still be read as a string using SpaceCenter.PartField.getValue().

class SpaceCenter.PartEvent()#

An event of a part module. Events are the clickable buttons visible in the right-click menu of the part. Obtained by calling SpaceCenter.Module.getEventList().

PartEvent.getModule()#

The part module that contains this event.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Module

PartEvent.getName()#

The identifier of the event. This is stable and does not change between game versions, unlike SpaceCenter.PartEvent.getGuiName().

Property:

Read-only, cannot be set

Return type:

string

PartEvent.getGuiName()#

The name of the event, as displayed in the right-click menu of the part.

Property:

Read-only, cannot be set

Return type:

string

PartEvent.getVisible()#

Whether the event is visible in the right-click menu of the part, in the current scene (flight or editor).

Property:

Read-only, cannot be set

Return type:

boolean

PartEvent.getActive()#

Whether the event is currently active.

Property:

Read-only, cannot be set

Return type:

boolean

PartEvent.trigger()#

Trigger the event. Equivalent to clicking the button in the right-click menu of the part.

class SpaceCenter.PartAction()#

An action of a part module. These are the part actions that can be assigned to action groups in the in-game editor. Obtained by calling SpaceCenter.Module.getActionList().

PartAction.getModule()#

The part module that contains this action.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Module

PartAction.getName()#

The identifier of the action. This is stable and does not change between game versions, unlike SpaceCenter.PartAction.getGuiName().

Property:

Read-only, cannot be set

Return type:

string

PartAction.getGuiName()#

The name of the action, as displayed in the in-game editor.

Property:

Read-only, cannot be set

Return type:

string

PartAction.setActivated(value)#

Activate or deactivate the action. Equivalent to triggering the action from an action group. Set to true to activate the action, or false to deactivate it.

Property:

Write-only, cannot be read

Return type:

boolean

Config Node#

class SpaceCenter.ConfigNode()#

Represents a configuration node, as found in a part’s configuration file. A node has a name, a set of named values and a set of child nodes. This is used to access the static configuration of a part or part module, for example via SpaceCenter.Part.getConfig() and SpaceCenter.Module.getConfig().

ConfigNode.getName()#

The name of the configuration node. For example “MODULE”.

Property:

Read-only, cannot be set

Return type:

string

ConfigNode.getValues()#

The values stored in the node, as a dictionary mapping names to values.

Property:

Read-only, cannot be set

Return type:

Map from string to string

Note

If a name appears more than once, only the first value is included. Use SpaceCenter.ConfigNode.findValues() to get all of the values with a given name.

ConfigNode.hasValue(name)#

Returns true if the node has a value with the given name.

Arguments:
  • name (string) – Name of the value.

Return type:

boolean

ConfigNode.getValue(name)#

Returns the value with the given name. If there is more than one value with the given name, the first is returned. Throws an exception if there is no value with the given name.

Arguments:
  • name (string) – Name of the value.

Return type:

string

ConfigNode.findValues(name)#

Returns all of the values with the given name, as a list.

Arguments:
  • name (string) – Name of the values.

Return type:

Array of string

ConfigNode.getNodes()#

The child nodes contained in this node.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.ConfigNode

ConfigNode.hasNode(name)#

Returns true if the node has a child node with the given name.

Arguments:
  • name (string) – Name of the child node.

Return type:

boolean

ConfigNode.getNode(name)#

Returns the child node with the given name. If there is more than one child node with the given name, the first is returned. Throws an exception if there is no child node with the given name.

Arguments:
  • name (string) – Name of the child node.

Return type:

SpaceCenter.ConfigNode

ConfigNode.findNodes(name)#

Returns all of the child nodes with the given name, as a list.

Arguments:
  • name (string) – Name of the child nodes.

Return type:

Array of SpaceCenter.ConfigNode

Specific Types of Part#

The following classes provide functionality for specific types of part.

Antenna#

Note

If RemoteTech is installed, use the RemoteTech service APIs to interact with antennas. This class covers stock and RealAntennas antennas.

class SpaceCenter.Antenna()#

An antenna. Obtained by calling SpaceCenter.Part.getAntenna().

Antenna.getPart()#

The part object for this antenna.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Antenna.getState()#

The current state of the antenna.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DeployableState

Game Scenes:

Flight

Antenna.getDeployable()#

Whether the antenna is deployable.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Antenna.getDeployed()#
Antenna.setDeployed(value)#

Whether the antenna is deployed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Note

Fixed antennas are always deployed. Throws KRPC.InvalidOperationException if set on a fixed antenna.

Antenna.getCanTransmit()#

Whether data can be transmitted by this antenna.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Antenna.transmit()#

Transmit data.

Game Scenes:

Flight

Antenna.cancel()#

Cancel current transmission of data.

Game Scenes:

Flight

Antenna.getAllowPartial()#
Antenna.setAllowPartial(value)#

Whether partial data transmission is permitted.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Antenna.getPower()#

The power of the antenna.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Not used by RealAntennas, which replaces the stock range model.

Antenna.getCombinable()#

Whether the antenna can be combined with other antennae on the vessel to boost the power.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Not used by RealAntennas, which replaces the stock range model.

Antenna.getCombinableExponent()#

Exponent used to calculate the combined power of multiple antennae on a vessel.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Not used by RealAntennas, which replaces the stock range model.

Antenna.getPacketInterval()#

Interval between sending packets in seconds.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Antenna.getPacketSize()#

Amount of data sent per packet in Mits.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Antenna.getPacketResourceCost()#

Units of electric charge consumed per packet sent.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Antenna.getGain()#

The gain of the antenna, in \(\mathrm{dBi}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getTransmitPower()#
Antenna.setTransmitPower(value)#

Returns the transmit power of the antenna, in \(\mathrm{dBm}\), and sets it in the editor. Throws an exception if set in flight, or outside zero to SpaceCenter.Antenna.getMaxTransmitPower().

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getMaxTransmitPower()#

The largest transmit power the antenna can be set to, in \(\mathrm{dBm}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getTechLevel()#
Antenna.setTechLevel(value)#

Returns the tech level of the antenna, and sets it in the editor. Throws an exception if set in flight, or outside zero to SpaceCenter.Antenna.getMaxTechLevel().

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getMaxTechLevel()#

The highest tech level the antenna can be set to.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getBand()#

The name of the radio frequency band the antenna uses, e.g. "S".

Property:

Read-only, cannot be set

Return type:

string

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getFrequency()#

The frequency of the antenna’s band, in Hz.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getDataRate()#

The highest data rate the antenna supports, in bits per second.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getBeamwidth()#

The half-power beamwidth of the antenna, in degrees.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getIdlePowerDraw()#

The power the antenna draws while idle, in watts.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getActivePowerDraw()#

The power the antenna draws while transmitting, in watts. This includes SpaceCenter.Antenna.getIdlePowerDraw().

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas.

Antenna.getEnabled()#
Antenna.setEnabled(value)#

Returns whether the antenna is enabled, and sets it in the editor. Throws an exception if set in flight.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealAntennas. A disabled antenna does not communicate and draws no power.

Antenna.disablePermanently()#

Disable the antenna for the rest of the flight. It then draws no power.

Game Scenes:

Flight

Note

Requires RealAntennas.

Antenna.getCanTarget()#

Whether the antenna can be pointed at a target. Omnidirectional antennas cannot.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Note

Requires RealAntennas.

Antenna.getTargetMode()#

The kind of target the antenna points at.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.AntennaTargetMode

Game Scenes:

Flight

Note

Requires RealAntennas.

Antenna.getTargetVessel()#
Antenna.setTargetVessel(value)#

Returns the vessel the antenna points at, and sets the vessel to point at.

Property:

Can be read or written

Return type:

SpaceCenter.Vessel or null

Game Scenes:

Flight

Note

Requires RealAntennas. null if the antenna does not point at a vessel. Throws an exception if set to null, or if the antenna cannot be pointed (see SpaceCenter.Antenna.getCanTarget()).

Antenna.getTargetBody()#
Antenna.setTargetBody(value)#

Returns the body the antenna points at, and sets the body to point at the center of.

Property:

Can be read or written

Return type:

SpaceCenter.CelestialBody or null

Game Scenes:

Flight

Note

Requires RealAntennas. Also the body of a position the antenna points at, or null if it points at neither. Throws an exception if set to null, or if the antenna cannot be pointed (see SpaceCenter.Antenna.getCanTarget()).

Antenna.targetDirection(referenceFrame)#

The direction the antenna points in, in the given reference frame. Throws an exception if the antenna has no target (see SpaceCenter.Antenna.getTargetMode()).

Arguments:
Returns:

The direction as a unit vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Note

Requires RealAntennas.

Antenna.setTargetPosition(body, latitude, longitude, altitude)#

Point the antenna at a position on or above a body.

Arguments:
  • body (SpaceCenter.CelestialBody) – The body.

  • latitude (number) – The latitude, in degrees.

  • longitude (number) – The longitude, in degrees.

  • altitude (number) – The altitude above sea level, in meters.

Game Scenes:

Flight

Note

Requires RealAntennas. Throws an exception if the antenna cannot be pointed (see SpaceCenter.Antenna.getCanTarget()).

Antenna.setTargetAzimuthElevation(azimuth, elevation)#

Point the antenna in a direction relative to the vessel’s position on the surface.

Arguments:
  • azimuth (number) – The azimuth, in degrees clockwise from north, from 0 to 360.

  • elevation (number) – The elevation above the horizon, in degrees, from -90 to 90.

Game Scenes:

Flight

Note

Requires RealAntennas. Throws an exception if the antenna cannot be pointed (see SpaceCenter.Antenna.getCanTarget()).

Antenna.setTargetOrbitRelative(deflection, elevation)#

Point the antenna in a direction relative to the vessel’s orbital velocity.

Arguments:
  • deflection (number) – The angle from the orbital velocity in the orbital plane, in degrees, from -180 to 180.

  • elevation (number) – The angle out of the orbital plane, in degrees, from -90 to 90.

Game Scenes:

Flight

Note

Requires RealAntennas. Throws an exception if the antenna cannot be pointed (see SpaceCenter.Antenna.getCanTarget()).

class SpaceCenter.AntennaTargetMode()#

The kind of target a RealAntennas antenna points at. See SpaceCenter.Antenna.getTargetMode().

AntennaTargetMode.none#

The antenna has no target. Omnidirectional antennas have none.

AntennaTargetMode.vessel#

A vessel. See SpaceCenter.Antenna.getTargetVessel().

AntennaTargetMode.body#

The center of a body. See SpaceCenter.Antenna.getTargetBody().

AntennaTargetMode.position#

A position on or above a body. See SpaceCenter.Antenna.setTargetPosition().

AntennaTargetMode.azimuthElevation#

An azimuth and elevation from the vessel’s position. See SpaceCenter.Antenna.setTargetAzimuthElevation().

AntennaTargetMode.orbitRelative#

A direction relative to the vessel’s orbital velocity. See SpaceCenter.Antenna.setTargetOrbitRelative().

Cargo Bay#

class SpaceCenter.CargoBay()#

A cargo bay. Obtained by calling SpaceCenter.Part.getCargoBay().

CargoBay.getPart()#

The part object for this cargo bay.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

CargoBay.getState()#

The state of the cargo bay.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DeployableState

Game Scenes:

Flight

Note

This describes where the bay’s doors are, which is not the same as whether the parts inside are sheltered: a bay whose open end has nothing attached to it never shelters anything, however tightly shut it is. Use SpaceCenter.Part.getShielded() for that.

A cargo bay is never SpaceCenter.DeployableState.broken, as the game does not track damage for them.

CargoBay.getOpen()#
CargoBay.setOpen(value)#

Whether the cargo bay is open.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Control Surface#

class SpaceCenter.ControlSurface()#

An aerodynamic control surface. Obtained by calling SpaceCenter.Part.getControlSurface().

ControlSurface.getPart()#

The part object for this control surface.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getPitchEnabled()#
ControlSurface.setPitchEnabled(value)#

Whether the control surface has pitch control enabled.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getYawEnabled()#
ControlSurface.setYawEnabled(value)#

Whether the control surface has yaw control enabled.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getRollEnabled()#
ControlSurface.setRollEnabled(value)#

Whether the control surface has roll control enabled.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getAuthorityLimiter()#
ControlSurface.setAuthorityLimiter(value)#

The authority limiter for the control surface, which controls how far the control surface will move.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getInverted()#
ControlSurface.setInverted(value)#

Whether the control surface movement is inverted.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getDeployed()#
ControlSurface.setDeployed(value)#

Whether the control surface has been fully deployed. Throws an exception if set while SpaceCenter.ControlSurface.getDeflectionOverride() is enabled, which holds the surface deployed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getDeployAngle()#
ControlSurface.setDeployAngle(value)#

The deploy angle of the control surface, in degrees.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Applied when SpaceCenter.ControlSurface.getDeployed() is true, and clamped to the range given by SpaceCenter.ControlSurface.getMinDeployAngle() and SpaceCenter.ControlSurface.getMaxDeployAngle(). While SpaceCenter.ControlSurface.getDeflectionOverride() is enabled, SpaceCenter.ControlSurface.getDeflection() drives the angle. A value set here takes effect when the override is released.

ControlSurface.getMinDeployAngle()#

The minimum SpaceCenter.ControlSurface.getDeployAngle() of the control surface, in degrees.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getMaxDeployAngle()#

The maximum SpaceCenter.ControlSurface.getDeployAngle() of the control surface, in degrees.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getDeflectionOverride()#
ControlSurface.setDeflectionOverride(value)#

Whether the control surface deflection is being set directly, bypassing the vessel’s normal flight control. When enabled, the surface holds the deflection set by SpaceCenter.ControlSurface.getDeflection() instead of responding to pitch, yaw and roll control inputs. The prior state is restored when the override is released, when the controlling client disconnects, or when the vessel changes.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

ControlSurface.getDeflection()#
ControlSurface.setDeflection(value)#

The deflection command applied when SpaceCenter.ControlSurface.getDeflectionOverride() is enabled, as a value between -1 and 1, mapped onto the surface’s deploy angle range.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

ControlSurface.getDeflectionAngle()#

The current angle of the control surface from its neutral position, in degrees. Includes the SpaceCenter.ControlSurface.getDeployAngle() while the surface is deployed.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ControlSurface.getControlRange()#

The angle the control surface deflects by for a full control input, in degrees, before the SpaceCenter.ControlSurface.getAuthorityLimiter() is applied.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getActuatorSpeed()#

The rate the control surface deflects at, in degrees per second.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getSurfaceArea()#

Surface area of the control surface in \(\mathrm{m^{2}}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

ControlSurface.getAvailableTorque()#

The available torque, in \(\mathrm{N \cdot m}\), that can be produced by this control surface, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the SpaceCenter.Vessel.getReferenceFrame().

Property:

Read-only, cannot be set

Return type:

SpaceCenter.AxisRange

Game Scenes:

Flight

Decoupler#

class SpaceCenter.Decoupler()#

A decoupler. Obtained by calling SpaceCenter.Part.getDecoupler()

Decoupler.getPart()#

The part object for this decoupler.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Decoupler.decouple()#

Fires the decoupler. Returns the new vessel created when the decoupler fires. Throws an exception if the decoupler has already fired.

Return type:

SpaceCenter.Vessel

Game Scenes:

Flight

Note

When called, the active vessel may change. It is therefore possible that, after calling this function, the object(s) returned by previous call(s) to SpaceCenter.getActiveVessel() no longer refer to the active vessel.

Decoupler.getDecoupled()#

Whether the decoupler has fired.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Decoupler.getStaged()#

Whether the decoupler is enabled in the staging sequence.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Decoupler.getImpulse()#

The impulse that the decoupler imparts when it is fired, in \(\mathrm{N \cdot s}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Decoupler.getIsOmniDecoupler()#

Whether the decoupler is an omni-decoupler (e.g. stack separator)

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Decoupler.getAttachedPart()#

The part attached to this decoupler’s explosive node.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part or null

Game Scenes:

Flight, Editor Vab, Editor Sph

Deployable State#

The deployment state shared by antennas, cargo bays, landing legs, radiators, resource harvesters, solar panels and wheels.

class SpaceCenter.DeployableState()#

The state of a deployable part. SpaceCenter.Antenna.getState(), SpaceCenter.CargoBay.getState(), SpaceCenter.Leg.getState(), SpaceCenter.Radiator.getState(), SpaceCenter.ResourceHarvester.getState(), SpaceCenter.SolarPanel.getState(), SpaceCenter.Wheel.getState()

DeployableState.deployed#

The part is fully deployed. A cargo bay in this state is fully open. Parts that cannot be retracted, such as fixed radiators, solar panels, antennas, landing legs and wheels, are always in this state.

DeployableState.retracted#

The part is fully retracted. A cargo bay in this state is closed and locked.

DeployableState.deploying#

The part is being deployed. A cargo bay in this state is opening.

DeployableState.retracting#

The part is being retracted. A cargo bay in this state is closing.

DeployableState.broken#

The part is broken. Cargo bays and resource harvesters never report this state, as the game does not track damage for them.

Docking Port#

class SpaceCenter.DockingPort()#

A docking port. Obtained by calling SpaceCenter.Part.getDockingPort()

DockingPort.getPart()#

The part object for this docking port.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

DockingPort.getState()#

The current state of the docking port.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DockingPortState

Game Scenes:

Flight

DockingPort.getDockedPart()#

The part that this docking port is docked to. Returns null if this docking port is not docked to anything.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part or null

Game Scenes:

Flight

DockingPort.undock()#

Undocks the docking port and returns the new SpaceCenter.Vessel that is created. This method can be called for either docking port in a docked pair. Throws an exception if the docking port is not docked to anything.

Return type:

SpaceCenter.Vessel

Game Scenes:

Flight

Note

When called, the active vessel may change. It is therefore possible that, after calling this function, the object(s) returned by previous call(s) to SpaceCenter.getActiveVessel() no longer refer to the active vessel.

DockingPort.getReengageDistance()#

The distance a docking port must move away when it undocks before it becomes ready to dock with another port, in meters.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

DockingPort.getHasShield()#

Whether the docking port has a shield.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

DockingPort.getShielded()#
DockingPort.setShielded(value)#

The state of the docking ports shield, if it has one.

Returns true if the docking port has a shield, and the shield is closed. Otherwise returns false. When set to true, the shield is closed, and when set to false the shield is opened. If the docking port does not have a shield, setting this attribute has no effect.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

DockingPort.getCanRotate()#

Whether the docking port can be commanded to rotate while docked.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

DockingPort.getMaximumRotation()#

Maximum rotation angle in degrees.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

DockingPort.getMinimumRotation()#

Minimum rotation angle in degrees.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

DockingPort.getRotationTarget()#
DockingPort.setRotationTarget(value)#

Rotation target angle in degrees.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

DockingPort.getRotationLocked()#
DockingPort.setRotationLocked(value)#

Lock rotation. When locked, allows auto-strut to work across the joint.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

DockingPort.position(referenceFrame)#

The position of the docking port, in the given reference frame.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight

DockingPort.direction(referenceFrame)#

The direction that docking port points in, in the given reference frame.

Arguments:
Returns:

The direction as a unit vector.

Return type:

[number, number, number]

Game Scenes:

Flight

DockingPort.rotation(referenceFrame)#

The rotation of the docking port, in the given reference frame.

Arguments:
Returns:

The rotation as a quaternion of the form (x, y, z, w).

Return type:

[number, number, number, number]

Game Scenes:

Flight

DockingPort.getReferenceFrame()#

The reference frame that is fixed relative to this docking port, and oriented with the port.

  • The origin is at the position of the docking port.

  • The axes rotate with the docking port.

  • The x-axis points out to the right side of the docking port.

  • The y-axis points in the direction the docking port is facing.

  • The z-axis points out of the bottom off the docking port.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ReferenceFrame

Game Scenes:

Flight

Note

This reference frame is not necessarily equivalent to the reference frame for the part, returned by SpaceCenter.Part.getReferenceFrame().

../../../_images/docking-port.png

Docking port reference frame origin and axes#

../../../_images/docking-port-inline.png

Inline docking port reference frame origin and axes#

class SpaceCenter.DockingPortState()#

The state of a docking port. See SpaceCenter.DockingPort.getState().

DockingPortState.ready#

The docking port is ready to dock to another docking port.

DockingPortState.docked#

The docking port is docked to another docking port, or docked to another part (from the VAB/SPH).

DockingPortState.docking#

The docking port is very close to another docking port, but has not docked. It is using magnetic force to acquire a solid dock.

DockingPortState.undocking#

The docking port has just been undocked from another docking port, and is disabled until it moves away by a sufficient distance (SpaceCenter.DockingPort.getReengageDistance()).

DockingPortState.shielded#

The docking port has a shield, and the shield is closed.

DockingPortState.moving#

The docking ports shield is currently opening/closing.

Engine#

class SpaceCenter.Engine()#

An engine, including ones of various types. For example liquid fuelled gimballed engines, solid rocket boosters and jet engines. Obtained by calling SpaceCenter.Part.getEngine().

Note

For RCS thrusters SpaceCenter.Part.getRCS().

Engine.getPart()#

The part object for this engine.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getActive()#
Engine.setActive(value)#

Whether the engine is active. Setting this attribute may have no effect, depending on SpaceCenter.Engine.getCanShutdown() and SpaceCenter.Engine.getCanRestart().

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Engine.getThrust()#

The current amount of thrust being produced by the engine, in Newtons.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Engine.getAvailableThrust()#

The amount of thrust, in Newtons, that would be produced by the engine when activated and with its throttle set to 100%. Returns zero if the engine does not have any fuel. Takes the engine’s current SpaceCenter.Engine.getThrustLimit() and atmospheric conditions into account.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Engine.availableThrustAt(pressure)#

The amount of thrust, in Newtons, that would be produced by the engine when activated and with its throttle set to 100%. Returns zero if the engine does not have any fuel. Takes the given pressure into account.

Arguments:
  • pressure (number) – Atmospheric pressure in atmospheres

Return type:

number

Game Scenes:

Flight

Engine.getMaxThrust()#

The amount of thrust, in Newtons, that would be produced by the engine when activated and fueled, with its throttle and throttle limiter set to 100%.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Engine.maxThrustAt(pressure)#

The amount of thrust, in Newtons, that would be produced by the engine when activated and fueled, with its throttle and throttle limiter set to 100%. Takes the given pressure into account.

Arguments:
  • pressure (number) – Atmospheric pressure in atmospheres

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getMaxVacuumThrust()#

The maximum amount of thrust that can be produced by the engine in a vacuum, in Newtons. This is the amount of thrust produced by the engine when activated, SpaceCenter.Engine.getThrustLimit() is set to 100%, the main vessel’s throttle is set to 100% and the engine is in a vacuum.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getThrustLimit()#
Engine.setThrustLimit(value)#

The thrust limiter of the engine. A value between 0 and 1. Setting this attribute may have no effect, for example the thrust limit for a solid rocket booster cannot be changed in flight.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getThrusters()#

The components of the engine that generate thrust.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Thruster

Game Scenes:

Flight

Note

For example, this corresponds to the rocket nozzel on a solid rocket booster, or the individual nozzels on a RAPIER engine. The overall thrust produced by the engine, as reported by SpaceCenter.Engine.getAvailableThrust(), SpaceCenter.Engine.getMaxThrust() and others, is the sum of the thrust generated by each thruster.

Engine.getSpecificImpulse()#

The current specific impulse of the engine, in seconds. Returns zero if the engine is not active.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Engine.specificImpulseAt(pressure)#

The specific impulse of the engine under the given pressure, in seconds. Returns zero if the engine is not active.

Arguments:
  • pressure (number) – Atmospheric pressure in atmospheres

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getVacuumSpecificImpulse()#

The vacuum specific impulse of the engine, in seconds.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getKerbinSeaLevelSpecificImpulse()#

The specific impulse of the engine at sea level on Kerbin, in seconds.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getPropellantNames()#

The names of the propellants that the engine consumes.

Property:

Read-only, cannot be set

Return type:

Array of string

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getPropellantRatios()#

The ratio of resources that the engine consumes. A dictionary mapping resource names to the ratio at which they are consumed by the engine.

Property:

Read-only, cannot be set

Return type:

Map from string to number

Game Scenes:

Flight

Note

For example, if the ratios are 0.6 for LiquidFuel and 0.4 for Oxidizer, then for every 0.6 units of LiquidFuel that the engine burns, it will burn 0.4 units of Oxidizer.

Engine.getPropellants()#

The propellants that the engine consumes.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Propellant

Game Scenes:

Flight

Engine.getHasFuel()#

Whether the engine has any fuel available.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Engine.getFlameout()#

Whether the engine has flamed out - it is active but has run out of propellant, so it is producing no thrust. This is the signal a client can use to decide when to activate the next stage. Note that on a vessel with drop tanks or asparagus staging some engines can flame out while others keep burning.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Engine.getThrottle()#
Engine.setThrottle(value)#

The current throttle setting for the engine. A value between 0 and 1. This is not necessarily the same as the vessel’s main throttle setting, as some engines take time to adjust their throttle (such as jet engines), or independent throttle may be enabled.

When the engine’s independent throttle is enabled (see SpaceCenter.Engine.getIndependentThrottle()), can be used to set the throttle percentage.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

Engine.getThrottleLocked()#

Whether the SpaceCenter.Control.getThrottle() affects the engine. For example, this is true for liquid fueled rockets, and false for solid rocket boosters.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getIndependentThrottle()#
Engine.setIndependentThrottle(value)#

Whether the independent throttle is enabled for the engine.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Engine.getCanRestart()#

Whether the engine can be restarted once shutdown. If the engine cannot be shutdown, returns false. For example, this is true for liquid fueled rockets and false for solid rocket boosters.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getCanShutdown()#

Whether the engine can be shutdown once activated. For example, this is true for liquid fueled rockets and false for solid rocket boosters.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getHasModes()#

Whether the engine has multiple modes of operation.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getMode()#
Engine.setMode(value)#

The name of the current engine mode.

Property:

Can be read or written

Return type:

string

Game Scenes:

Flight

Engine.getModes()#

The available modes for the engine. A dictionary mapping mode names to SpaceCenter.Engine objects.

Property:

Read-only, cannot be set

Return type:

Map from string to SpaceCenter.Engine

Game Scenes:

Flight

Engine.toggleMode()#

Toggle the current engine mode.

Game Scenes:

Flight

Engine.getAutoModeSwitch()#
Engine.setAutoModeSwitch(value)#

Whether the engine will automatically switch modes.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Engine.getGimballed()#

Whether the engine is gimballed.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getGimbalRange()#

The range over which the gimbal can move, in degrees. Returns 0 if the engine is not gimballed.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getGimbalLocked()#
Engine.setGimbalLocked(value)#

Whether the engines gimbal is locked in place. Setting this attribute has no effect if the engine is not gimballed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getGimbalLimit()#
Engine.setGimbalLimit(value)#

The gimbal limiter of the engine. A value between 0 and 1. Returns 0 if the gimbal is locked.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getGimbalResponseSpeedEnabled()#

Whether the gimbal moves toward its commanded deflection at SpaceCenter.Engine.getGimbalResponseSpeed(). When false, the gimbal reaches its commanded deflection in one physics tick. Throws an exception if the engine is not gimballed.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getGimbalResponseSpeed()#

The response speed of the gimbal, in \(\mathrm{s^{-1}}\). Throws an exception if the engine is not gimballed.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Each physics tick of length \(\Delta t\), the gimbal moves a fraction \(v \Delta t\) of the way from its deflection to the commanded deflection, where \(v\) is the response speed. The fraction is at most 1, so at high physics warp the gimbal can reach its commanded deflection in one tick. This lag only applies when SpaceCenter.Engine.getGimbalResponseSpeedEnabled() is true.

Engine.getGimbalPitchEnabled()#
Engine.setGimbalPitchEnabled(value)#

Whether the gimbal responds to pitch control input. Throws an exception if the engine is not gimballed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getGimbalYawEnabled()#
Engine.setGimbalYawEnabled(value)#

Whether the gimbal responds to yaw control input. Throws an exception if the engine is not gimballed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getGimbalRollEnabled()#
Engine.setGimbalRollEnabled(value)#

Whether the gimbal responds to roll control input. Throws an exception if the engine is not gimballed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getGimbalOverride()#
Engine.setGimbalOverride(value)#

Whether the gimbal is being controlled directly, bypassing the vessel’s normal flight controls. When enabled, the gimbal deflection is set by SpaceCenter.Engine.getGimbalActuation() instead of the normal control inputs. The override is automatically released if the controlling client disconnects or the vessel changes. Has no effect if the engine is not gimballed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Engine.getGimbalActuation()#
Engine.setGimbalActuation(value)#

The gimbal actuation command applied when SpaceCenter.Engine.getGimbalOverride() is enabled, in the pitch, roll and yaw axes. Each component is a normalized control input between -1 and 1. The physical deflection is scaled by SpaceCenter.Engine.getGimbalRange() and SpaceCenter.Engine.getGimbalLimit(). When the gimbal is not being overridden, returns the current actuation.

Property:

Can be read or written

Return type:

[number, number, number]

Game Scenes:

Flight

Note

The gimbal ignores the component for an axis it is disabled for, such as pitch when SpaceCenter.Engine.getGimbalPitchEnabled() is false.

Engine.getAvailableTorque()#

The available torque, in \(\mathrm{N \cdot m}\), that can be produced by this engine, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the SpaceCenter.Vessel.getReferenceFrame(). Returns zero if the engine is inactive, or not gimballed.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.AxisRange

Game Scenes:

Flight

Note

The torque is zero about an axis the gimbal is disabled for, such as pitch when SpaceCenter.Engine.getGimbalPitchEnabled() is false.

Engine.getCanReverseThrust()#

Whether the engine has a recognized thrust reverser. This is true for stock engines with a thrust reverser (such as the J-33 “Wheesley” and J-90 “Goliath” turbofan engines) and for supported mod engines. It is false for engines whose reverser is not recognized, as KSP provides no standard way to detect one.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Recognizes the thrust reversers of Firespitter and KerbalActuators.

Engine.getThrustReversed()#
Engine.setThrustReversed(value)#

Whether the engine’s thrust reverser is engaged, reversing the direction of thrust. While the reverser is still moving, this reports the state it is moving to, so a read immediately after a set returns the value that was set and setting the same value again has no effect. Throws an exception if the engine does not have a thrust reverser (see SpaceCenter.Engine.getCanReverseThrust()).

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Engine.toggleThrustReversal()#

Toggle the engine’s thrust reverser. Throws an exception if the engine does not have a thrust reverser (see SpaceCenter.Engine.getCanReverseThrust()).

Game Scenes:

Flight

Engine.getHasRealFuels()#

Whether the engine is managed by RealFuels. The remaining properties in this section are only available when it is.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Engine.getIgnitions()#

The number of times the engine can still be ignited, or -1 if it can be ignited an unlimited number of times. Throws an exception if the engine is not managed by RealFuels (see SpaceCenter.Engine.getHasRealFuels()).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealFuels.

Engine.getIgnitionResources()#

The resources the engine consumes each time it ignites, keyed by resource name, with the amount of each that is required. The engine uses up an ignition and fails to light if they are not available. Throws an exception if the engine is not managed by RealFuels (see SpaceCenter.Engine.getHasRealFuels()).

Property:

Read-only, cannot be set

Return type:

Map from string to number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealFuels.

Engine.getHasUllage()#

Whether the engine’s propellant is subject to ullage, so that it must be settled before the engine will run reliably. Throws an exception if the engine is not managed by RealFuels (see SpaceCenter.Engine.getHasRealFuels()).

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealFuels.

Engine.getPropellantStability()#

How settled the propellant feeding the engine is, from 0 (fully unsettled) to 1 (fully settled). Acceleration along the engine’s thrust axis settles it, and coasting and rotation unsettle it. Throws an exception if the engine is not managed by RealFuels (see SpaceCenter.Engine.getHasRealFuels()).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

Requires RealFuels.

Engine.getPropellantReliability()#

The probability that the propellant feeding the engine behaves normally, from 0 to 1. This is SpaceCenter.Engine.getPropellantStability() scaled by the game’s ullage difficulty setting, and is the value RealFuels itself tests against when deciding whether the engine runs. Throws an exception if the engine is not managed by RealFuels (see SpaceCenter.Engine.getHasRealFuels()).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

Requires RealFuels.

Engine.getPressureFed()#

Whether the engine is fed by tank pressure rather than by a pump, and so needs to draw from a highly pressurized tank. Throws an exception if the engine is not managed by RealFuels (see SpaceCenter.Engine.getHasRealFuels()).

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

Requires RealFuels.

Engine.getHasFeedPressure()#

Whether the tanks feeding the engine supply the pressure it needs. Always true for an engine that is not pressure fed. Throws an exception if the engine is not managed by RealFuels (see SpaceCenter.Engine.getHasRealFuels()).

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Note

Requires RealFuels.

class SpaceCenter.Propellant()#

A propellant for an engine. Obtains by calling SpaceCenter.Engine.getPropellants().

Propellant.getName()#

The name of the propellant.

Property:

Read-only, cannot be set

Return type:

string

Game Scenes:

Flight

Propellant.getCurrentAmount()#

The current amount of propellant consumed in the current physics update.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Propellant.getCurrentRequirement()#

The required amount of propellant for the current physics update.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Propellant.getTotalResourceAvailable()#

The total amount of the underlying resource currently reachable given resource flow rules.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Propellant.getTotalResourceCapacity()#

The total vehicle capacity for the underlying propellant resource, restricted by resource flow rules.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Propellant.getIgnoreForIsp()#

If this propellant should be ignored when calculating required mass flow given specific impulse.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Propellant.getIgnoreForThrustCurve()#

If this propellant should be ignored for thrust curve calculations.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Propellant.getDrawStackGauge()#

If this propellant has a stack gauge or not.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Propellant.getIsDeprived()#

If this propellant is deprived.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Propellant.getRatio()#

The propellant ratio.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Experiment#

class SpaceCenter.Experiment()#

Obtained by calling SpaceCenter.Part.getExperiment().

Note

Includes the experiments of DMagic’s DMModuleScienceAnimateGeneric.

Experiment.getPart()#

The part object for this experiment.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Experiment.getName()#

Internal name of the experiment, as used in part cfg files.

Property:

Read-only, cannot be set

Return type:

string

Game Scenes:

Flight

Experiment.getTitle()#

Title of the experiment, as shown on the in-game UI.

Property:

Read-only, cannot be set

Return type:

string

Game Scenes:

Flight

Experiment.run()#

Run the experiment.

Game Scenes:

Flight

Experiment.transmit()#

Transmit all experimental data contained by this part.

Game Scenes:

Flight

Experiment.dump()#

Dump the experimental data contained by the experiment.

Game Scenes:

Flight

Experiment.reset()#

Reset the experiment.

Game Scenes:

Flight

Experiment.getDeployed()#

Whether the experiment has been deployed.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Experiment.getRerunnable()#

Whether the experiment can be re-run.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Experiment.getInoperable()#

Whether the experiment is inoperable.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Experiment.getHasData()#

Whether the experiment contains data.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Experiment.getData()#

The data contained in this experiment.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.ScienceData

Game Scenes:

Flight

Experiment.getBiome()#

The name of the biome the experiment is currently in.

Property:

Read-only, cannot be set

Return type:

string

Game Scenes:

Flight

Experiment.getAvailable()#

Determines if the experiment is available given the current conditions.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Experiment.getScienceSubject()#

Containing information on the corresponding specific science result for the current conditions. Returns null if the experiment is unavailable.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ScienceSubject or null

Game Scenes:

Flight

class SpaceCenter.ScienceData(fields)#

Obtained by calling SpaceCenter.Experiment.getData().

ScienceData.dataAmount#

Data amount.

Type:

number

ScienceData.scienceValue#

Science value.

Type:

number

ScienceData.transmitValue#

Transmit value.

Type:

number

class SpaceCenter.ScienceSubject(fields)#

Obtained by calling SpaceCenter.Experiment.getScienceSubject().

ScienceSubject.id#

The identifier of the subject, e.g. crewReport@KerbinSrfLandedLaunchPad.

Type:

string

ScienceSubject.title#

The title of the subject, as shown in the science archives.

Type:

string

ScienceSubject.isComplete#

Whether the subject has been fully researched. This is true once the science banked for the subject reaches the science cap. As the banked science (see SpaceCenter.ScienceSubject.science) is only updated after transmission/recovery, this reflects fully mining the subject over repeated experiments, not whether a single run has produced data. To check whether a run has produced data, and how valuable it is, use SpaceCenter.Experiment.getHasData() and SpaceCenter.ScienceData.transmitValue.

Type:

boolean

ScienceSubject.science#

Amount of science already earned from this subject, not updated until after transmission/recovery.

Type:

number

ScienceSubject.scienceCap#

Total science allowable for this subject.

Type:

number

ScienceSubject.dataScale#

Multiply science value by this to determine data amount in mits.

Type:

number

ScienceSubject.subjectValue#

Multiplier for specific Celestial Body/Experiment Situation combination.

Type:

number

ScienceSubject.scientificValue#

Diminishing value multiplier for decreasing the science value returned from repeated experiments.

Type:

number

Fairing#

class SpaceCenter.Fairing()#

A fairing. Obtained by calling SpaceCenter.Part.getFairing().

Note

Includes the fairings of ProceduralFairings.

Fairing.getPart()#

The part object for this fairing.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Fairing.jettison()#

Jettison the fairing. Has no effect if it has already been jettisoned.

Game Scenes:

Flight

Fairing.getJettisoned()#

Whether the fairing has been jettisoned.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Intake#

class SpaceCenter.Intake()#

An air intake. Obtained by calling SpaceCenter.Part.getIntake().

Intake.getPart()#

The part object for this intake.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Intake.getOpen()#
Intake.setOpen(value)#

Whether the intake is open.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Intake.getSpeed()#

Speed of the flow into the intake, in \(\mathrm{m/s}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Intake.getFlow()#

The rate of flow into the intake, in units of resource per second.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Intake.getArea()#

The area of the intake’s opening, in \(\mathrm{m^{2}}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Leg#

class SpaceCenter.Leg()#

A landing leg. Obtained by calling SpaceCenter.Part.getLeg().

Leg.getPart()#

The part object for this landing leg.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Leg.getState()#

The current state of the landing leg.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DeployableState

Game Scenes:

Flight

Leg.getDeployable()#

Whether the leg is deployable.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Leg.getDeployed()#
Leg.setDeployed(value)#

Whether the landing leg is deployed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Note

Fixed landing legs are always deployed. Throws KRPC.InvalidOperationException if set on a fixed landing leg.

Leg.getIsGrounded()#

Returns whether the leg is touching the ground.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Leg.getLoad()#

The force pressing the leg’s foot into the ground, in \(\mathrm{kN}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The game raises the load of a grounded leg to at least 10 kN. SpaceCenter.Leg.getImpactTolerance() applies to the rise in this value.

Leg.contactPosition(referenceFrame)#

The position of the bottom of the leg’s foot, in the given reference frame. While the leg is grounded, this is where it touches the ground.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Leg.getSuspensionSpringStrength()#

Suspension spring strength, as set in the editor. Throws an exception if the leg has no suspension.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Leg.getSuspensionDamperStrength()#

Suspension damper strength, as set in the editor. Throws an exception if the leg has no suspension.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Leg.getSuspensionSpring()#

The spring constant of the suspension, in \(\mathrm{kN/m}\), or null while the leg is not grounded.

Property:

Read-only, cannot be set

Return type:

number or null

Game Scenes:

Flight

Note

The game updates it while the leg is grounded, from SpaceCenter.Leg.getSuspensionSpringStrength(), the vessel’s mass, the leg’s compression and the local gravity.

Leg.getSuspensionDamper()#

The damping constant of the suspension, in \(\mathrm{kN \cdot s/m}\), or null while the leg is not grounded.

Property:

Read-only, cannot be set

Return type:

number or null

Game Scenes:

Flight

Note

The game updates it while the leg is grounded, from SpaceCenter.Leg.getSuspensionDamperStrength() and SpaceCenter.Leg.getSuspensionSpring().

Leg.getSuspensionTravel()#

The travel of the suspension, in meters.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Leg.getImpactTolerance()#

The rise in SpaceCenter.Leg.getLoad() over one physics tick that breaks the leg, in \(\mathrm{kN}\). Throws an exception if the leg is not breakable.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Note

The game scales the rise by the local gravity divided by standard gravity before comparing it with this tolerance.

Leg.getExplodeMultiplier()#

The multiple of SpaceCenter.Leg.getImpactTolerance() that destroys the leg, in place of breaking it. Throws an exception if the leg is not breakable.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Launch Clamp#

class SpaceCenter.LaunchClamp()#

A launch clamp. Obtained by calling SpaceCenter.Part.getLaunchClamp().

LaunchClamp.getPart()#

The part object for this launch clamp.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

LaunchClamp.release()#

Releases the docking clamp. Has no effect if the clamp has already been released.

Game Scenes:

Flight

Light#

class SpaceCenter.Light()#

A light. Obtained by calling SpaceCenter.Part.getLight().

Light.getPart()#

The part object for this light.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Light.getActive()#
Light.setActive(value)#

Whether the light is switched on.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Light.getColor()#
Light.setColor(value)#

The color of the light.

Property:

Can be read or written

Return type:

StdLib.ColorRGB

Game Scenes:

Flight, Editor Vab, Editor Sph

Whether blinking is enabled.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Light.getBlinkRate()#
Light.setBlinkRate(value)#

The blink rate of the light.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Light.getPowerUsage()#

The current power usage, in units of charge per second.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Parachute#

class SpaceCenter.Parachute()#

A parachute. Obtained by calling SpaceCenter.Part.getParachute().

Note

Includes the parachutes of RealChute.

Parachute.getPart()#

The part object for this parachute.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Parachute.deploy()#

Deploys the parachute. This has no effect if the parachute has already been deployed.

Game Scenes:

Flight

Parachute.getDeployed()#

Whether the parachute has been deployed.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Parachute.arm()#

Deploys the parachute. This has no effect if the parachute has already been armed or deployed.

Game Scenes:

Flight

Parachute.getArmed()#

Whether the parachute has been armed or deployed.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Parachute.cut()#

Cuts the parachute.

Game Scenes:

Flight

Parachute.getState()#

The current state of the parachute.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ParachuteState

Game Scenes:

Flight

Parachute.getDeployAltitude()#
Parachute.setDeployAltitude(value)#

The altitude at which the parachute will full deploy, in meters. Only applicable to stock parachutes.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Parachute.getDeployMinPressure()#
Parachute.setDeployMinPressure(value)#

The minimum pressure at which the parachute will semi-deploy, in atmospheres. Only applicable to stock parachutes.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Parachute.getSafeState()#

Whether it is currently safe to deploy the parachute, given the vessel’s flight conditions. Computed by KSP from the current airspeed, pressure and temperature. Only applicable to stock parachutes. Note that KSP reports SpaceCenter.ParachuteSafeState.unsafe for the first second after the vessel unpacks, before its thermal data is valid.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ParachuteSafeState

Game Scenes:

Flight

class SpaceCenter.ParachuteState()#

The state of a parachute. See SpaceCenter.Parachute.getState().

ParachuteState.stowed#

The parachute is safely tucked away inside its housing.

ParachuteState.armed#

The parachute is armed for deployment.

ParachuteState.semiDeployed#

The parachute has been deployed and is providing some drag, but is not fully deployed yet. (Stock parachutes only)

ParachuteState.deployed#

The parachute is fully deployed.

ParachuteState.cut#

The parachute has been cut.

class SpaceCenter.ParachuteSafeState()#

The safety state of deploying a parachute. See SpaceCenter.Parachute.getSafeState().

ParachuteSafeState.safe#

The parachute is safe to deploy.

ParachuteSafeState.risky#

Deploying the parachute is risky, and it may break off.

ParachuteSafeState.unsafe#

The parachute is unsafe to deploy, and will break off.

ParachuteSafeState.none#

The safety state is not available, because the vessel is not in an atmosphere or the parachute has already been deployed or cut.

Radiator#

class SpaceCenter.Radiator()#

A radiator. Obtained by calling SpaceCenter.Part.getRadiator().

Radiator.getPart()#

The part object for this radiator.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Radiator.getDeployable()#

Whether the radiator is deployable.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

Radiator.getDeployed()#
Radiator.setDeployed(value)#

For a deployable radiator, true if the radiator is extended. If the radiator is not deployable, this is always true.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Radiator.getState()#

The current state of the radiator.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DeployableState

Game Scenes:

Flight

Note

A fixed radiator is always SpaceCenter.DeployableState.deployed.

Resource Converter#

class SpaceCenter.ResourceConverter()#

A resource converter. Obtained by calling SpaceCenter.Part.getResourceConverter().

ResourceConverter.getPart()#

The part object for this converter.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

ResourceConverter.getCount()#

The number of converters in the part.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ResourceConverter.name(index)#

The name of the specified converter.

Arguments:
  • index (number) – Index of the converter.

Return type:

string

Game Scenes:

Flight

ResourceConverter.active(index)#

True if the specified converter is active.

Arguments:
  • index (number) – Index of the converter.

Return type:

boolean

Game Scenes:

Flight

ResourceConverter.start(index)#

Start the specified converter.

Arguments:
  • index (number) – Index of the converter.

Game Scenes:

Flight

ResourceConverter.stop(index)#

Stop the specified converter.

Arguments:
  • index (number) – Index of the converter.

Game Scenes:

Flight

ResourceConverter.state(index)#

The state of the specified converter.

Arguments:
  • index (number) – Index of the converter.

Return type:

SpaceCenter.ResourceConverterState

Game Scenes:

Flight

ResourceConverter.statusInfo(index)#

Status information for the specified converter. This is the full status message shown in the in-game UI.

Arguments:
  • index (number) – Index of the converter.

Return type:

string

Game Scenes:

Flight

ResourceConverter.inputs(index)#

List of the names of resources consumed by the specified converter.

Arguments:
  • index (number) – Index of the converter.

Return type:

Array of string

Game Scenes:

Flight

ResourceConverter.outputs(index)#

List of the names of resources produced by the specified converter.

Arguments:
  • index (number) – Index of the converter.

Return type:

Array of string

Game Scenes:

Flight

ResourceConverter.getOptimumCoreTemperature()#

The core temperature at which the converter will operate with peak efficiency, in Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ResourceConverter.getCoreTemperature()#

The core temperature of the converter, in Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ResourceConverter.getThermalEfficiency()#

The thermal efficiency of the converter, as a percentage of its maximum.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

class SpaceCenter.ResourceConverterState()#

The state of a resource converter. See SpaceCenter.ResourceConverter.state().

ResourceConverterState.running#

Converter is running.

ResourceConverterState.idle#

Converter is idle.

ResourceConverterState.missingResource#

Converter is missing a required resource.

ResourceConverterState.storageFull#

No available storage for output resource.

ResourceConverterState.capacity#

At preset resource capacity.

ResourceConverterState.unknown#

Unknown state. Possible with modified resource converters. In this case, check SpaceCenter.ResourceConverter.statusInfo() for more information.

Resource Harvester#

class SpaceCenter.ResourceHarvester()#

A resource harvester (drill). Obtained by calling SpaceCenter.Part.getResourceHarvester().

ResourceHarvester.getPart()#

The part object for this harvester.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

ResourceHarvester.getState()#

The deployment state of the harvester. Whether it is drilling is reported separately by SpaceCenter.ResourceHarvester.getActive().

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DeployableState

Game Scenes:

Flight

Note

A harvester is never SpaceCenter.DeployableState.broken, as the game does not track damage for them.

ResourceHarvester.getDeployed()#
ResourceHarvester.setDeployed(value)#

Whether the harvester is deployed.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

ResourceHarvester.getActive()#
ResourceHarvester.setActive(value)#

Whether the harvester is actively drilling.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Note

A value set while the harvester is deploying is applied when the deploy completes, so it can be set immediately after setting SpaceCenter.ResourceHarvester.getDeployed() without waiting for the deploy animation. Setting it has no effect while the harvester is retracted or retracting.

ResourceHarvester.getExtractionRate()#

The rate at which the drill is extracting ore, in \(\mathrm{units/s}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ResourceHarvester.getThermalEfficiency()#

The thermal efficiency of the drill, as a percentage of its maximum.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ResourceHarvester.getCoreTemperature()#

The core temperature of the drill, in Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ResourceHarvester.getOptimumCoreTemperature()#

The core temperature at which the drill will operate with peak efficiency, in Kelvin.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Reaction Wheel#

class SpaceCenter.ReactionWheel()#

A reaction wheel. Obtained by calling SpaceCenter.Part.getReactionWheel().

ReactionWheel.getPart()#

The part object for this reaction wheel.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

ReactionWheel.getActive()#
ReactionWheel.setActive(value)#

Whether the reaction wheel is active.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

ReactionWheel.getBroken()#

Whether the reaction wheel is broken.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

ReactionWheel.getAvailableTorque()#

The available torque, in \(\mathrm{N \cdot m}\), that can be produced by this reaction wheel, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the SpaceCenter.Vessel.getReferenceFrame(). Returns zero if the reaction wheel is inactive or broken.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.AxisRange

Game Scenes:

Flight

ReactionWheel.getMaxTorque()#

The maximum torque, in \(\mathrm{N \cdot m}\), that can be produced by this reaction wheel, when it is active, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the SpaceCenter.Vessel.getReferenceFrame().

Property:

Read-only, cannot be set

Return type:

SpaceCenter.AxisRange

Game Scenes:

Flight, Editor Vab, Editor Sph

ReactionWheel.getAuthorityLimiter()#
ReactionWheel.setAuthorityLimiter(value)#

The authority limiter for the reaction wheel, as a percentage of maximum torque. A value between 0 and 1.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

Resource Drain#

class SpaceCenter.ResourceDrain()#

A resource drain. Obtained by calling SpaceCenter.Part.getResourceDrain().

ResourceDrain.getPart()#

The part object for this resource drain.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

ResourceDrain.getAvailableResources()#

List of available resources.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Resource

Game Scenes:

Flight

ResourceDrain.setResource(resource, enabled)#

Whether the given resource should be drained.

Arguments:
Game Scenes:

Flight

ResourceDrain.checkResource(resource)#

Whether the provided resource is enabled for draining.

Arguments:
Return type:

boolean

Game Scenes:

Flight

ResourceDrain.getDrainMode()#
ResourceDrain.setDrainMode(value)#

The drain mode.

Property:

Can be read or written

Return type:

SpaceCenter.DrainMode

Game Scenes:

Flight

ResourceDrain.getMinRate()#

Minimum possible drain rate

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ResourceDrain.getMaxRate()#

Maximum possible drain rate.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

ResourceDrain.getRate()#
ResourceDrain.setRate(value)#

Current drain rate.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

ResourceDrain.start()#

Activates resource draining for all enabled parts.

Game Scenes:

Flight

ResourceDrain.stop()#

Turns off resource draining.

Game Scenes:

Flight

class SpaceCenter.DrainMode()#

Resource drain mode. See SpaceCenter.ResourceDrain.getDrainMode().

DrainMode.part#

Drains from the parent part.

DrainMode.vessel#

Drains from all available parts.

Robotic Controller#

class SpaceCenter.RoboticController()#

A robotic controller. Obtained by calling SpaceCenter.Part.getRoboticController().

RoboticController.getPart()#

The part object for this controller.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

RoboticController.getEnabled()#
RoboticController.setEnabled(value)#

Whether the controller is enabled.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticController.getPlaying()#

Whether the controller’s sequence is currently playing.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

RoboticController.getPosition()#
RoboticController.setPosition(value)#

The current position along the sequence, in seconds.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticController.getLength()#

The length of the sequence, in seconds.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RoboticController.getPlaySpeed()#

The speed at which the sequence is played back, as a multiple of normal speed.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RoboticController.play()#

Start playing the controller’s sequence.

Game Scenes:

Flight

RoboticController.stop()#

Stop playing the controller’s sequence.

Game Scenes:

Flight

RoboticController.hasPart(part)#

Whether the controller has a part.

Arguments:
Return type:

boolean

Game Scenes:

Flight

RoboticController.axes()#

The axes for the controller.

Return type:

Array of SpaceCenter.RoboticAxis

Game Scenes:

Flight

RoboticController.addAxis(module, fieldName)#

Add an axis to the controller.

Arguments:
Returns:

Returns true if the axis is added successfully.

Return type:

boolean

Game Scenes:

Flight

RoboticController.addKeyFrame(module, fieldName, time, value)#

Add key frame value for controller axis.

Arguments:
  • module (SpaceCenter.Module) – The part module that the axis belongs to.

  • fieldName (string) – The name of the axis field, as returned by SpaceCenter.RoboticController.axes().

  • time (number) – The time of the key frame.

  • value (number) – The value of the key frame.

Returns:

Returns true if the key frame is added successfully.

Return type:

boolean

Game Scenes:

Flight

RoboticController.clearAxis(module, fieldName)#

Clear axis.

Arguments:
Returns:

Returns true if the axis is cleared successfully.

Return type:

boolean

Game Scenes:

Flight

class SpaceCenter.RoboticAxis(fields)#

An axis of a robotic controller.

RoboticAxis.module#

The part module the axis belongs to.

Type:

SpaceCenter.Module

RoboticAxis.fieldName#

The name of the field the axis controls.

Type:

string

Robotic Hinge#

class SpaceCenter.RoboticHinge()#

A robotic hinge. Obtained by calling SpaceCenter.Part.getRoboticHinge().

RoboticHinge.getPart()#

The part object for this robotic hinge.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

RoboticHinge.getTargetAngle()#
RoboticHinge.setTargetAngle(value)#

Target angle.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticHinge.getCurrentAngle()#

Current angle.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RoboticHinge.getMinAngle()#
RoboticHinge.setMinAngle(value)#

The minimum angle the hinge can move to, in degrees.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticHinge.getMaxAngle()#
RoboticHinge.setMaxAngle(value)#

The maximum angle the hinge can move to, in degrees.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticHinge.getRate()#
RoboticHinge.setRate(value)#

Target movement rate in \(\mathrm{{}^{\circ}/s}\).

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticHinge.getDamping()#
RoboticHinge.setDamping(value)#

Damping percentage.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticHinge.getLocked()#
RoboticHinge.setLocked(value)#

Lock movement.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticHinge.getMotorEngaged()#
RoboticHinge.setMotorEngaged(value)#

Whether the motor is engaged.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticHinge.getIsMoving()#

Whether the servo is currently moving.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

RoboticHinge.moveHome()#

Move hinge to its built position.

Game Scenes:

Flight

Robotic Piston#

class SpaceCenter.RoboticPiston()#

A robotic piston part. Obtained by calling SpaceCenter.Part.getRoboticPiston().

RoboticPiston.getPart()#

The part object for this robotic piston.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

RoboticPiston.getTargetExtension()#
RoboticPiston.setTargetExtension(value)#

Target extension of the piston.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticPiston.getCurrentExtension()#

Current extension of the piston.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RoboticPiston.getMinExtension()#
RoboticPiston.setMinExtension(value)#

The minimum extension of the piston, in meters.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticPiston.getMaxExtension()#
RoboticPiston.setMaxExtension(value)#

The maximum extension of the piston, in meters.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticPiston.getRate()#
RoboticPiston.setRate(value)#

Target movement rate in \(\mathrm{m/s}\).

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticPiston.getDamping()#
RoboticPiston.setDamping(value)#

Damping percentage.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticPiston.getLocked()#
RoboticPiston.setLocked(value)#

Lock movement.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticPiston.getMotorEngaged()#
RoboticPiston.setMotorEngaged(value)#

Whether the motor is engaged.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticPiston.getIsMoving()#

Whether the servo is currently moving.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

RoboticPiston.moveHome()#

Move piston to its built position.

Game Scenes:

Flight

Robotic Rotation#

class SpaceCenter.RoboticRotation()#

A robotic rotation servo. Obtained by calling SpaceCenter.Part.getRoboticRotation().

RoboticRotation.getPart()#

The part object for this robotic rotation servo.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

RoboticRotation.getTargetAngle()#
RoboticRotation.setTargetAngle(value)#

Target angle.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotation.getCurrentAngle()#

Current angle.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RoboticRotation.getMinAngle()#
RoboticRotation.setMinAngle(value)#

The minimum angle the servo can rotate to, in degrees.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotation.getMaxAngle()#
RoboticRotation.setMaxAngle(value)#

The maximum angle the servo can rotate to, in degrees.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotation.getAllowFullRotation()#
RoboticRotation.setAllowFullRotation(value)#

Whether the servo is allowed to rotate freely through a full revolution, ignoring the angle limits.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticRotation.getRate()#
RoboticRotation.setRate(value)#

Target movement rate in \(\mathrm{{}^{\circ}/s}\).

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotation.getDamping()#
RoboticRotation.setDamping(value)#

Damping percentage.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotation.getLocked()#
RoboticRotation.setLocked(value)#

Lock Movement

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticRotation.getMotorEngaged()#
RoboticRotation.setMotorEngaged(value)#

Whether the motor is engaged.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticRotation.getIsMoving()#

Whether the servo is currently moving.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

RoboticRotation.moveHome()#

Move rotation servo to its built position.

Game Scenes:

Flight

Robotic Rotor#

class SpaceCenter.RoboticRotor()#

A robotic rotor. Obtained by calling SpaceCenter.Part.getRoboticRotor().

RoboticRotor.getPart()#

The part object for this robotic rotor.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

RoboticRotor.getTargetRPM()#
RoboticRotor.setTargetRPM(value)#

Target RPM.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotor.getCurrentRPM()#

Current RPM.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RoboticRotor.getInverted()#
RoboticRotor.setInverted(value)#

Whether the rotor direction is inverted.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticRotor.getTorqueLimit()#
RoboticRotor.setTorqueLimit(value)#

Torque limit percentage.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotor.getMaxTorque()#
RoboticRotor.setMaxTorque(value)#

The maximum torque the rotor can generate, in kilonewtons.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotor.getBrakePercentage()#
RoboticRotor.setBrakePercentage(value)#

The percentage of braking force applied to the rotor.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight

RoboticRotor.getLocked()#
RoboticRotor.setLocked(value)#

Lock movement.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticRotor.getMotorEngaged()#
RoboticRotor.setMotorEngaged(value)#

Whether the motor is engaged.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RoboticRotor.getIsMoving()#

Whether the rotor is currently moving.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

RCS#

class SpaceCenter.RCS()#

An RCS block or thruster. Obtained by calling SpaceCenter.Part.getRCS().

RCS.getPart()#

The part object for this RCS.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getActive()#

Whether the RCS thrusters are active. An RCS thruster is inactive if the RCS action group is disabled (SpaceCenter.Control.getRCS()), the RCS thruster itself is not enabled (SpaceCenter.RCS.getEnabled()), or it is covered by a fairing (SpaceCenter.Part.getShielded()) and cannot thrust while shielded.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

RCS.getEnabled()#
RCS.setEnabled(value)#

Whether the RCS thrusters are enabled.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getPitchEnabled()#
RCS.setPitchEnabled(value)#

Whether the RCS thruster will fire when pitch control input is given.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getYawEnabled()#
RCS.setYawEnabled(value)#

Whether the RCS thruster will fire when yaw control input is given.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getRollEnabled()#
RCS.setRollEnabled(value)#

Whether the RCS thruster will fire when roll control input is given.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getForwardEnabled()#
RCS.setForwardEnabled(value)#

Whether the RCS thruster will fire when forward control input is given.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getUpEnabled()#
RCS.setUpEnabled(value)#

Whether the RCS thruster will fire when up control input is given.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getRightEnabled()#
RCS.setRightEnabled(value)#

Whether the RCS thruster will fire when right control input is given.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getInputOverride()#
RCS.setInputOverride(value)#

Whether the RCS control is being set directly, bypassing the vessel’s normal flight controls. When enabled, the rotation and translation demand is set by SpaceCenter.RCS.getRotationOverride() and SpaceCenter.RCS.getTranslationOverride() instead of the normal control inputs. The override is automatically released if the controlling client disconnects or the vessel changes. Precision mode leaves an overridden block at full thrust.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

RCS.getRotationOverride()#
RCS.setRotationOverride(value)#

The rotation demand applied when SpaceCenter.RCS.getInputOverride() is enabled, in the pitch, roll and yaw axes. Each component is a normalized control input between -1 and 1.

Property:

Can be read or written

Return type:

[number, number, number]

Game Scenes:

Flight

Note

The block ignores the component for an axis it is disabled for, such as pitch when SpaceCenter.RCS.getPitchEnabled() is false.

RCS.getTranslationOverride()#
RCS.setTranslationOverride(value)#

The translation demand applied when SpaceCenter.RCS.getInputOverride() is enabled, in the right, up and forward axes. Each component is a normalized control input between -1 and 1.

Property:

Can be read or written

Return type:

[number, number, number]

Game Scenes:

Flight

Note

The block ignores the component for an axis it is disabled for, such as right when SpaceCenter.RCS.getRightEnabled() is false.

RCS.getAvailableTorque()#

The available torque, in \(\mathrm{N \cdot m}\), that can be produced by this RCS, in the positive and negative pitch, roll and yaw axes of the vessel. These axes correspond to the coordinate axes of the SpaceCenter.Vessel.getReferenceFrame(). Returns zero if RCS is disable.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.AxisRange

Game Scenes:

Flight

Note

Precision mode weakens the block, and the available torque follows it. A block driven by SpaceCenter.RCS.getInputOverride() is exempt, so SpaceCenter.RCS.overrideWrench() can report the larger torque an override reaches.

RCS.getAvailableForce()#

The available force, in Newtons, that can be produced by this RCS, in the positive and negative x, y and z axes of the vessel. These axes correspond to the coordinate axes of the SpaceCenter.Vessel.getReferenceFrame(). Returns zero if RCS is disabled.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.AxisRange

Game Scenes:

Flight

Note

Precision mode weakens the block, and the available force follows it. A block driven by SpaceCenter.RCS.getInputOverride() is exempt, so SpaceCenter.RCS.overrideWrench() can report the larger force an override reaches.

RCS.getForce()#

The force being applied by the RCS thrusters, in Newtons. The vector is in the vessel’s reference frame (SpaceCenter.Vessel.getReferenceFrame()). Returns zero if the RCS is inactive.

Property:

Read-only, cannot be set

Return type:

[number, number, number]

Game Scenes:

Flight

RCS.getTorque()#

The torque being applied by the RCS thrusters about the vessel’s center of mass, in \(\mathrm{N \cdot m}\). The vector is in the vessel’s reference frame (SpaceCenter.Vessel.getReferenceFrame()). Returns zero if the RCS is inactive.

Property:

Read-only, cannot be set

Return type:

[number, number, number]

Game Scenes:

Flight

RCS.overrideWrench(rotation, translation)#

The force and torque the given demands would produce, in Newtons and \(\mathrm{N \cdot m}\).

Arguments:
Returns:

The force, and the torque about the vessel’s center of mass, in the vessel’s reference frame (SpaceCenter.Vessel.getReferenceFrame()), or zero if the RCS is inactive.

Return type:

SpaceCenter.Wrench

Game Scenes:

Flight

Note

The demands do not have to be applied. The prediction leaves out full thrust, which SpaceCenter.RCS.getForce() and SpaceCenter.RCS.getTorque() include.

RCS.getAvailableThrust()#

The amount of thrust, in Newtons, that would be produced by the thruster when activated. Returns zero if the thruster does not have any fuel. Takes the thrusters current SpaceCenter.RCS.getThrustLimit() and atmospheric conditions into account.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RCS.getMaxThrust()#

The maximum amount of thrust that can be produced by the RCS thrusters when active, in Newtons, with the SpaceCenter.RCS.getThrustLimit() set to 100%. Takes atmospheric conditions into account.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RCS.getMaxVacuumThrust()#

The maximum amount of thrust that can be produced by the RCS thrusters when active in a vacuum, in Newtons.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getThrustLimit()#
RCS.setThrustLimit(value)#

The thrust limiter of the thruster. A value between 0 and 1.

Property:

Can be read or written

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getThrusters()#

A list of thrusters, one of each nozzel in the RCS part.

Property:

Read-only, cannot be set

Return type:

Array of SpaceCenter.Thruster

Game Scenes:

Flight

RCS.getSpecificImpulse()#

The current specific impulse of the RCS, in seconds. Returns zero if the RCS is not active.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

RCS.getVacuumSpecificImpulse()#

The vacuum specific impulse of the RCS, in seconds.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getKerbinSeaLevelSpecificImpulse()#

The specific impulse of the RCS at sea level on Kerbin, in seconds.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getPropellants()#

The names of resources that the RCS consumes.

Property:

Read-only, cannot be set

Return type:

Array of string

Game Scenes:

Flight, Editor Vab, Editor Sph

RCS.getPropellantRatios()#

The ratios of resources that the RCS consumes. A dictionary mapping resource names to the ratios at which they are consumed by the RCS.

Property:

Read-only, cannot be set

Return type:

Map from string to number

Game Scenes:

Flight

RCS.getHasFuel()#

Whether the RCS has fuel available.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Sensor#

class SpaceCenter.Sensor()#

A sensor, such as a thermometer. Obtained by calling SpaceCenter.Part.getSensor().

Sensor.getPart()#

The part object for this sensor.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

Sensor.getActive()#
Sensor.setActive(value)#

Whether the sensor is active.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

Sensor.getValue()#

The current value of the sensor.

Property:

Read-only, cannot be set

Return type:

string

Game Scenes:

Flight

Note

This is the same readout string shown in the part’s right-click menu in-game, and is intended for display rather than for parsing. Both its units and the way it formats numbers follow the language the game is running in, so it is not stable across locales. For programmatic access to the underlying quantities, use SpaceCenter.Part.getTemperature() (temperature sensors), SpaceCenter.Flight.getGForce() (accelerometers) or SpaceCenter.Flight.getStaticPressure() (barometers).

Solar Panel#

class SpaceCenter.SolarPanel()#

A solar panel. Obtained by calling SpaceCenter.Part.getSolarPanel().

Note

Includes the curved solar panels of Near Future Solar.

SolarPanel.getPart()#

The part object for this solar panel.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight, Editor Vab, Editor Sph

SolarPanel.getDeployable()#

Whether the solar panel is deployable.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight, Editor Vab, Editor Sph

SolarPanel.getDeployed()#
SolarPanel.setDeployed(value)#

Whether the solar panel is extended.

Property:

Can be read or written

Return type:

boolean

Game Scenes:

Flight

SolarPanel.getState()#

The current state of the solar panel.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DeployableState

Game Scenes:

Flight

SolarPanel.getEnergyFlow()#

The current amount of energy being generated by the solar panel, in units of charge per second.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

SolarPanel.getSunExposure()#

The current amount of sunlight that is incident on the solar panel, as a percentage. A value between 0 and 1.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Thruster#

class SpaceCenter.Thruster()#

The component of an SpaceCenter.Engine or SpaceCenter.RCS part that generates thrust. Can obtained by calling SpaceCenter.Engine.getThrusters() or SpaceCenter.RCS.getThrusters().

Note

Engines can consist of multiple thrusters. For example, the S3 KS-25x4 “Mammoth” has four rocket nozzels, and so consists of four thrusters.

Thruster.getPart()#

The SpaceCenter.Thruster.getPart() that contains this thruster.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Game Scenes:

Flight

Thruster.getThrust()#

The thrust being produced by the thruster, in Newtons.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Thruster.thrustPosition(referenceFrame)#

The position at which the thruster generates thrust, in the given reference frame. For gimballed engines, this takes into account the current rotation of the gimbal.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Thruster.thrustDirection(referenceFrame)#

The direction of the force generated by the thruster, in the given reference frame. This is opposite to the direction in which the thruster expels propellant. For gimballed engines, this takes into account the current rotation of the gimbal.

Arguments:
Returns:

The direction as a unit vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Thruster.getThrustReferenceFrame()#

A reference frame that is fixed relative to the thruster and orientated with its thrust direction (SpaceCenter.Thruster.thrustDirection()). For gimballed engines, this takes into account the current rotation of the gimbal.

  • The origin is at the position of thrust for this thruster (SpaceCenter.Thruster.thrustPosition()).

  • The axes rotate with the thrust direction. This is the direction in which the thruster expels propellant, including any gimballing.

  • The y-axis points along the thrust direction.

  • The x-axis and z-axis are perpendicular to the thrust direction.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.ReferenceFrame

Game Scenes:

Flight

Thruster.getGimballed()#

Whether the thruster is gimballed.

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

Thruster.gimbalPosition(referenceFrame)#

Position around which the gimbal pivots.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Thruster.getGimbalAngle()#

The current gimbal angle in the pitch, roll and yaw axes, in degrees.

Property:

Read-only, cannot be set

Return type:

[number, number, number]

Game Scenes:

Flight

Thruster.initialThrustPosition(referenceFrame)#

The position at which the thruster generates thrust, when the engine is in its initial position (no gimballing), in the given reference frame.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Note

This position can move when the gimbal rotates. This is because the thrust position and gimbal position are not necessarily the same.

Thruster.initialThrustDirection(referenceFrame)#

The direction of the force generated by the thruster, when the engine is in its initial position (no gimballing), in the given reference frame. This is opposite to the direction in which the thruster expels propellant.

Arguments:
Returns:

The direction as a unit vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Wheel#

class SpaceCenter.Wheel()#

A wheel. Includes landing gear and rover wheels. Obtained by calling SpaceCenter.Part.getWheel(). Can be used to control the motors, steering and deployment of wheels, among other things.

Wheel.getPart()#

The part object for this wheel.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Part

Wheel.getState()#

The current state of the wheel.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.DeployableState

Wheel.getRadius()#

Radius of the wheel, in meters.

Property:

Read-only, cannot be set

Return type:

number

Wheel.getGrounded()#

Whether the wheel is touching the ground.

Property:

Read-only, cannot be set

Return type:

boolean

Wheel.getHasBrakes()#

Whether the wheel has brakes.

Property:

Read-only, cannot be set

Return type:

boolean

Wheel.getBrakes()#
Wheel.setBrakes(value)#

The braking force, as a percentage of maximum, when the brakes are applied.

Property:

Can be read or written

Return type:

number

Wheel.getAutoFrictionControl()#
Wheel.setAutoFrictionControl(value)#

Whether automatic friction control is enabled.

Property:

Can be read or written

Return type:

boolean

Wheel.getManualFrictionControl()#
Wheel.setManualFrictionControl(value)#

Manual friction control value. Only has an effect if automatic friction control is disabled. A value between 0 and 5 inclusive.

Property:

Can be read or written

Return type:

number

Wheel.getDeployable()#

Whether the wheel is deployable.

Property:

Read-only, cannot be set

Return type:

boolean

Wheel.getDeployed()#
Wheel.setDeployed(value)#

Whether the wheel is deployed.

Property:

Can be read or written

Return type:

boolean

Wheel.getPowered()#

Whether the wheel is powered by a motor.

Property:

Read-only, cannot be set

Return type:

boolean

Wheel.getMotorEnabled()#
Wheel.setMotorEnabled(value)#

Whether the motor is enabled.

Property:

Can be read or written

Return type:

boolean

Wheel.getMotorInverted()#
Wheel.setMotorInverted(value)#

Whether the direction of the motor is inverted.

Property:

Can be read or written

Return type:

boolean

Wheel.getMotorState()#

Whether the direction of the motor is inverted.

Property:

Read-only, cannot be set

Return type:

SpaceCenter.MotorState

Wheel.getMotorOutput()#

The output of the motor. This is the torque currently being generated, in \(\mathrm{N \cdot m}\).

Property:

Read-only, cannot be set

Return type:

number

Wheel.getTractionControlEnabled()#
Wheel.setTractionControlEnabled(value)#

Whether automatic traction control is enabled. A wheel only has traction control if it is powered.

Property:

Can be read or written

Return type:

boolean

Wheel.getTractionControl()#
Wheel.setTractionControl(value)#

Setting for the traction control. Only takes effect if the wheel has automatic traction control enabled. A value between 0 and 5 inclusive.

Property:

Can be read or written

Return type:

number

Wheel.getDriveLimiter()#
Wheel.setDriveLimiter(value)#

Manual setting for the motor limiter. Only takes effect if the wheel has automatic traction control disabled. A value between 0 and 100 inclusive.

Property:

Can be read or written

Return type:

number

Wheel.getSteerable()#

Whether the wheel has steering.

Property:

Read-only, cannot be set

Return type:

boolean

Wheel.getSteeringEnabled()#
Wheel.setSteeringEnabled(value)#

Whether the wheel steering is enabled.

Property:

Can be read or written

Return type:

boolean

Wheel.getSteeringInverted()#
Wheel.setSteeringInverted(value)#

Whether the wheel steering is inverted.

Property:

Can be read or written

Return type:

boolean

Wheel.getSteeringAngleAuto()#
Wheel.setSteeringAngleAuto(value)#

Whether the steering angle is automatically limited based on the vessel’s speed, reducing the maximum angle as the vessel moves faster. See also SpaceCenter.Wheel.getSteeringAngleLimit().

Property:

Can be read or written

Return type:

boolean

Wheel.getSteeringAngleLimit()#
Wheel.setSteeringAngleLimit(value)#

The steering angle limit.

Property:

Can be read or written

Return type:

number

Wheel.getSteeringResponseTime()#
Wheel.setSteeringResponseTime(value)#

Steering response time.

Property:

Can be read or written

Return type:

number

Wheel.getHasSuspension()#

Whether the wheel has suspension.

Property:

Read-only, cannot be set

Return type:

boolean

Wheel.getSuspensionSpringStrength()#

Suspension spring strength, as set in the editor.

Property:

Read-only, cannot be set

Return type:

number

Wheel.getSuspensionDamperStrength()#

Suspension damper strength, as set in the editor.

Property:

Read-only, cannot be set

Return type:

number

Wheel.getSuspensionSpring()#

The spring constant of the suspension, in \(\mathrm{kN/m}\), or null while the wheel is not grounded. Throws an exception if the wheel has no suspension.

Property:

Read-only, cannot be set

Return type:

number or null

Game Scenes:

Flight

Note

The game updates it while the wheel is grounded, from SpaceCenter.Wheel.getSuspensionSpringStrength(), the vessel’s mass, the wheel’s compression and the local gravity.

Wheel.getSuspensionDamper()#

The damping constant of the suspension, in \(\mathrm{kN \cdot s/m}\), or null while the wheel is not grounded. Throws an exception if the wheel has no suspension.

Property:

Read-only, cannot be set

Return type:

number or null

Game Scenes:

Flight

Note

The game updates it while the wheel is grounded, from SpaceCenter.Wheel.getSuspensionDamperStrength() and SpaceCenter.Wheel.getSuspensionSpring().

Wheel.getSuspensionTravel()#

The travel of the suspension, in meters.

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Wheel.getLoad()#

The force pressing the wheel into the ground, in \(\mathrm{kN}\).

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

Note

The game raises the load of a grounded wheel to at least 0.5 kN, or 10 kN for a wheel with the old friction model. SpaceCenter.Wheel.getImpactTolerance() applies to the rise in this value.

Wheel.contactPosition(referenceFrame)#

The position of the bottom of the wheel, in the given reference frame. While the wheel is grounded, this is where it touches the ground.

Arguments:
Returns:

The position as a vector.

Return type:

[number, number, number]

Game Scenes:

Flight

Wheel.getBroken()#

Whether the wheel is broken.

Property:

Read-only, cannot be set

Return type:

boolean

Wheel.getRepairable()#

Whether the wheel is repairable.

Property:

Read-only, cannot be set

Return type:

boolean

Wheel.getStress()#

Current stress on the wheel.

Property:

Read-only, cannot be set

Return type:

number

Wheel.getStressTolerance()#

Stress tolerance of the wheel.

Property:

Read-only, cannot be set

Return type:

number

Wheel.getImpactTolerance()#

The rise in SpaceCenter.Wheel.getLoad() over one physics tick that breaks the wheel, in \(\mathrm{kN}\). Throws an exception if the wheel is not breakable.

Property:

Read-only, cannot be set

Return type:

number

Note

The game scales the rise by the local gravity divided by standard gravity before comparing it with this tolerance.

Wheel.getExplodeMultiplier()#

The multiple of SpaceCenter.Wheel.getImpactTolerance() that destroys the wheel, in place of breaking it. Throws an exception if the wheel is not breakable.

Property:

Read-only, cannot be set

Return type:

number

Wheel.getStressPercentage()#

Current stress on the wheel as a percentage of its stress tolerance.

Property:

Read-only, cannot be set

Return type:

number

Wheel.getDeflection()#

Current deflection of the wheel.

Property:

Read-only, cannot be set

Return type:

number

Wheel.getSlip()#

Current slip of the wheel.

Property:

Read-only, cannot be set

Return type:

number

class SpaceCenter.MotorState()#

The state of the motor on a powered wheel. See SpaceCenter.Wheel.getMotorState().

MotorState.idle#

The motor is idle.

MotorState.running#

The motor is running.

MotorState.disabled#

The motor is disabled.

MotorState.inoperable#

The motor is inoperable.

MotorState.notEnoughResources#

The motor does not have enough resources to run.