Parts#
The following classes allow interaction with a vessels individual parts.
Parts#
- public class Parts#
Instances of this class are used to interact with the parts of a vessel. An instance can be obtained by calling
Vessel.getParts().- Part getRoot()#
The vessels root part.
Note
See the discussion on Trees of Parts.
- java.util.List<Part> withName(String name)#
A list of parts whose
Part.getName()is name.- Parameters:
name (
String)
- java.util.List<Part> withTitle(String title)#
A list of all parts whose
Part.getTitle()is title.- Parameters:
title (
String)
- java.util.List<Part> withTag(String tag)#
A list of all parts whose
Part.getTag()is tag.- Parameters:
tag (
String)
- java.util.List<Part> withModule(String moduleName)#
A list of all parts that contain a
ModulewhoseModule.getName()is moduleName.- Parameters:
moduleName (
String)
- java.util.List<Part> inStage(int stage)#
Warning
Deprecated. Use
Stage.getParts()from the object returned byVessel.stageAt(int)instead.A list of all parts that are activated in the given stage.
- Parameters:
stage (
int)
Note
Deprecated. Use
Vessel.stageAt(int)andStage.getParts()instead. See the discussion on Staging.
- java.util.List<Part> inDecoupleStage(int stage)#
Warning
Deprecated. Use
Stage.getParts()from the object returned byVessel.decoupleStageAt(int)instead.A list of all parts that are decoupled in the given stage.
- Parameters:
stage (
int)
Note
Deprecated. Use
Vessel.decoupleStageAt(int)andStage.getParts()instead. See the discussion on Staging.
- java.util.List<Module> modulesWithName(String moduleName)#
A list of modules (combined across all parts in the vessel) whose
Module.getName()is moduleName.- Parameters:
moduleName (
String)
- java.util.List<Antenna> getAntennas()#
A list of all antennas in the vessel.
Note
If RemoteTech is installed, this will always return an empty list. To interact with RemoteTech antennas, use the RemoteTech service APIs.
- java.util.List<ControlSurface> getControlSurfaces()#
A list of all control surfaces in the vessel.
- java.util.List<DockingPort> getDockingPorts()#
A list of all docking ports in the vessel.
- java.util.List<Engine> getEngines()#
A list of all engines in the vessel.
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.
- java.util.List<Experiment> getExperiments()#
A list of all science experiments in the vessel.
- java.util.List<LaunchClamp> getLaunchClamps()#
A list of all launch clamps attached to the vessel.
- java.util.List<ResourceDrain> getResourceDrains()#
A list of all resource drains in the vessel.
- java.util.List<ReactionWheel> getReactionWheels()#
A list of all reaction wheels in the vessel.
- java.util.List<ResourceConverter> getResourceConverters()#
A list of all resource converters in the vessel.
- java.util.List<ResourceHarvester> getResourceHarvesters()#
A list of all resource harvesters in the vessel.
- java.util.List<RoboticController> getRoboticControllers()#
A list of all robotic controllers in the vessel.
- java.util.List<RoboticHinge> getRoboticHinges()#
A list of all robotic hinges in the vessel.
- java.util.List<RoboticPiston> getRoboticPistons()#
A list of all robotic pistons in the vessel.
- java.util.List<RoboticRotation> getRoboticRotations()#
A list of all robotic rotations in the vessel.
- java.util.List<RoboticRotor> getRoboticRotors()#
A list of all robotic rotors in the vessel.
- java.util.List<SolarPanel> getSolarPanels()#
A list of all solar panels in the vessel.
Part#
- public class Part#
Represents an individual part. Vessels are made up of multiple parts. Instances of this class can be obtained by several methods in
Parts.- String getName()#
Internal name of the part, as used in part cfg files. For example “Mark1-2Pod”.
- String getTitle()#
Title of the part, as shown when the part is right clicked in-game. For example “Mk1-2 Command Pod”.
- ConfigNode 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
nullif the part has no associated configuration node.
- void setTag(String value)#
The name tag for the part. Can be set to a custom string using the in-game user interface.
Note
This string is shared with kOS if it is installed.
- boolean getHighlighted()#
- void setHighlighted(boolean value)#
Whether the part is highlighted.
Note
The highlighting is removed when the client that enabled it disconnects.
- void setHighlightColor(org.javatuples.Triplet<Double, Double, Double> value)#
The color used to highlight the part, as an RGB triple.
- double getCost()#
The cost of the part, in units of funds.
- Part getParent()#
The parts parent. Returns
nullif the part does not have a parent. This, in combination withPart.getChildren(), can be used to traverse the vessels parts tree.Note
See the discussion on Trees of Parts.
- java.util.List<Part> getChildren()#
The parts children. Returns an empty list if the part has no children. This, in combination with
Part.getParent(), can be used to traverse the vessels parts tree.Note
See the discussion on Trees of Parts.
- boolean 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.Note
See the discussion on Attachment Modes.
- boolean 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.Note
See the discussion on Attachment Modes.
- int getStage()#
The stage in which this part will be activated. Returns -1 if the part is not activated by staging.
Note
See the discussion on Staging.
- int getDecoupleStage()#
The stage in which this part will be decoupled. Returns -1 if the part is never decoupled from the vessel.
Note
See the discussion on Staging.
- double getMass()#
The current mass of the part, including resources it contains, in kilograms. Returns zero if the part is massless.
- double getDryMass()#
The mass of the part, not including any resources it contains, in kilograms. Returns zero if the part is massless.
- boolean getShielded()#
Whether the part is shielded from the exterior of the vessel, for example by a fairing.
- float getDynamicPressure()#
The dynamic pressure acting on the part, in Pascals.
- double getImpactTolerance()#
The impact tolerance of the part, in meters per second.
- double getTemperature()#
Temperature of the part, in Kelvin.
- double getSkinTemperature()#
Temperature of the skin of the part, in Kelvin.
- double getMaxTemperature()#
Maximum temperature that the part can survive, in Kelvin.
- double getMaxSkinTemperature()#
Maximum temperature that the skin of the part can survive, in Kelvin.
- float getThermalMass()#
A measure of how much energy it takes to increase the internal temperature of the part, in Joules per Kelvin.
- float getThermalSkinMass()#
A measure of how much energy it takes to increase the skin temperature of the part, in Joules per Kelvin.
- float getThermalResourceMass()#
A measure of how much energy it takes to increase the temperature of the resources contained in the part, in Joules per Kelvin.
- float 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.
- float 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.
- float 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.
- float 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.
- float 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.
- int getCrewCapacity()#
The number of crew members that can occupy the part.
- java.util.List<CrewMember> getCrew()#
The crew members occupying the part.
- int getAvailableSeats()#
How many open seats the part has.
- Resources getResources()#
A
Part.getResources()object for the part.
- boolean getCrossfeed()#
Whether this part is crossfeed capable.
- boolean getIsFuelLine()#
Whether this part is a fuel line.
- java.util.List<Part> getFuelLinesFrom()#
The parts that are connected to this part via fuel lines, where the direction of the fuel line is into this part.
Note
See the discussion on Fuel Lines.
- java.util.List<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.
Note
See the discussion on Fuel Lines.
- Antenna getAntenna()#
An
Part.getAntenna()if the part is an antenna, otherwisenull.Note
If RemoteTech is installed, this will always return
null. To interact with RemoteTech antennas, use the RemoteTech service APIs.
- CargoBay getCargoBay()#
A
Part.getCargoBay()if the part is a cargo bay, otherwisenull.
- ControlSurface getControlSurface()#
A
Part.getControlSurface()if the part is an aerodynamic control surface, otherwisenull.
- Decoupler getDecoupler()#
A
Part.getDecoupler()if the part is a decoupler, otherwisenull.
- DockingPort getDockingPort()#
A
Part.getDockingPort()if the part is a docking port, otherwisenull.
- Engine getEngine()#
An
Part.getEngine()if the part is an engine, otherwisenull.
- Experiment getExperiment()#
An
Part.getExperiment()if the part contains a single science experiment, otherwisenull.Note
Throws an exception if the part contains more than one experiment. In that case, use
Part.getExperiments()to get the list of experiments in the part.
- java.util.List<Experiment> getExperiments()#
A list of
Part.getExperiment()objects that the part contains.
- Fairing getFairing()#
A
Part.getFairing()if the part is a fairing, otherwisenull.
- Intake getIntake()#
An
Part.getIntake()if the part is an intake, otherwisenull.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
Part.getRCS().
- Leg getLeg()#
A
Part.getLeg()if the part is a landing leg, otherwisenull.
- LaunchClamp getLaunchClamp()#
A
Part.getLaunchClamp()if the part is a launch clamp, otherwisenull.
- Light getLight()#
A
Part.getLight()if the part is a light, otherwisenull.
- Parachute getParachute()#
A
Part.getParachute()if the part is a parachute, otherwisenull.
- Radiator getRadiator()#
A
Part.getRadiator()if the part is a radiator, otherwisenull.
- ResourceDrain getResourceDrain()#
A
Part.getResourceDrain()if the part is a resource drain, otherwisenull.
- RCS getRCS()#
A
Part.getRCS()if the part is an RCS block/thruster, otherwisenull.
- ReactionWheel getReactionWheel()#
A
Part.getReactionWheel()if the part is a reaction wheel, otherwisenull.
- ResourceConverter getResourceConverter()#
A
Part.getResourceConverter()if the part is a resource converter, otherwisenull.
- ResourceHarvester getResourceHarvester()#
A
Part.getResourceHarvester()if the part is a resource harvester, otherwisenull.
- RoboticController getRoboticController()#
A
Part.getRoboticController()if the part is a robotic controller, otherwisenull.
- RoboticHinge getRoboticHinge()#
A
Part.getRoboticHinge()if the part is a robotic hinge, otherwisenull.
- RoboticPiston getRoboticPiston()#
A
Part.getRoboticPiston()if the part is a robotic piston, otherwisenull.
- RoboticRotation getRoboticRotation()#
A
Part.getRoboticRotation()if the part is a robotic rotation servo, otherwisenull.
- RoboticRotor getRoboticRotor()#
A
Part.getRoboticRotor()if the part is a robotic rotor, otherwisenull.
- Sensor getSensor()#
A
Part.getSensor()if the part is a sensor, otherwisenull.
- SolarPanel getSolarPanel()#
A
Part.getSolarPanel()if the part is a solar panel, otherwisenull.
- Wheel getWheel()#
A
Part.getWheel()if the part is a wheel, otherwisenull.
- org.javatuples.Triplet<Double, Double, Double> position(ReferenceFrame referenceFrame)#
The position of the part in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned position vector is in.
- Returns:
The position as a vector.
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
Part.centerOfMass(ReferenceFrame)to get the parts center of mass.
- org.javatuples.Triplet<Double, Double, Double> centerOfMass(ReferenceFrame referenceFrame)#
The position of the parts center of mass in the given reference frame. If the part is physicsless, this is equivalent to
Part.position(ReferenceFrame).- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned position vector is in.
- Returns:
The position as a vector.
- org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> boundingBox(ReferenceFrame referenceFrame)#
The axis-aligned bounding box of the part in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned position vectors are in.
- Returns:
The positions of the minimum and maximum vertices of the box, as position vectors.
Note
This is computed from the collision mesh of the part. If the part is not collidable, the box has zero volume and is centered on the
Part.position(ReferenceFrame)of the part.
- org.javatuples.Triplet<Double, Double, Double> direction(ReferenceFrame referenceFrame)#
The direction the part points in, in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned direction is in.
- Returns:
The direction as a unit vector.
- org.javatuples.Triplet<Double, Double, Double> velocity(ReferenceFrame referenceFrame)#
The linear velocity of the part in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned velocity vector is in.
- Returns:
The velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed of the body in meters per second.
- org.javatuples.Quartet<Double, Double, Double, Double> rotation(ReferenceFrame referenceFrame)#
The rotation of the part, in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned rotation is in.
- Returns:
The rotation as a quaternion of the form \((x, y, z, w)\).
- org.javatuples.Triplet<Double, Double, Double> lift(ReferenceFrame referenceFrame)#
The aerodynamic lift currently acting on the part.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned vector is in.
- Returns:
A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.
Note
Not available when the Ferram Aerospace Research mod is installed.
- org.javatuples.Triplet<Double, Double, Double> drag(ReferenceFrame referenceFrame)#
The aerodynamic drag currently acting on the part.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned vector is in.
- Returns:
A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.
Note
Not available when the Ferram Aerospace Research mod is installed.
- org.javatuples.Triplet<Double, Double, Double> getMomentOfInertia()#
The moment of inertia of the part in \(kg.m^2\) around its center of mass in the parts reference frame (
Part.getReferenceFrame()).
- java.util.List<Double> getInertiaTensor()#
The inertia tensor of the part in the parts reference frame (
Part.getReferenceFrame()). Returns the 3x3 matrix as a list of elements, in row-major order.
- ReferenceFrame 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
Part.position(ReferenceFrame).The axes rotate with the part.
The x, y and z axis directions depend on the design of the part.
Note
For docking port parts, this reference frame is not necessarily equivalent to the reference frame for the docking port, returned by
DockingPort.getReferenceFrame().
Mk1 Command Pod reference frame origin and axes#
- ReferenceFrame 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
Part.centerOfMass(ReferenceFrame).The axes rotate with the part.
The x, y and z axis directions depend on the design of the part.
Note
For docking port parts, this reference frame is not necessarily equivalent to the reference frame for the docking port, returned by
DockingPort.getReferenceFrame().
- Force addForce(org.javatuples.Triplet<Double, Double, Double> force, org.javatuples.Triplet<Double, Double, Double> position, ReferenceFrame referenceFrame)#
Exert a constant force on the part, acting at the given position.
- Parameters:
force (
org.javatuples.Triplet) – A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.position (
org.javatuples.Triplet) – The position at which the force acts, as a vector.referenceFrame (
ReferenceFrame) – The reference frame that the force and position are in.
- Returns:
An object that can be used to remove or modify the force.
Note
The force is removed when the client that added it disconnects.
- void instantaneousForce(org.javatuples.Triplet<Double, Double, Double> force, org.javatuples.Triplet<Double, Double, Double> position, ReferenceFrame referenceFrame)#
Exert an instantaneous force on the part, acting at the given position.
- Parameters:
force (
org.javatuples.Triplet) – A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.position (
org.javatuples.Triplet) – The position at which the force acts, as a vector.referenceFrame (
ReferenceFrame) – The reference frame that the force and position are in.
Note
The force is applied instantaneously in a single physics update.
- void setGlow(boolean value)#
Whether the part is glowing.
- AutoStrutMode getAutoStrutMode()#
Auto-strut mode.
- public enum AutoStrutMode#
The state of an auto-strut.
Part.getAutoStrutMode()- public AutoStrutMode OFF#
Off
- public AutoStrutMode ROOT#
Root
- public AutoStrutMode HEAVIEST#
Heaviest
- public AutoStrutMode GRANDPARENT#
Grandparent
- public AutoStrutMode FORCE_ROOT#
ForceRoot
- public AutoStrutMode FORCE_HEAVIEST#
ForceHeaviest
- public AutoStrutMode FORCE_GRANDPARENT#
ForceGrandparent
- public class Force#
Obtained by calling
Part.addForce(org.javatuples.Triplet<Double,Double,Double>, org.javatuples.Triplet<Double,Double,Double>, ReferenceFrame).- void setForceVector(org.javatuples.Triplet<Double, Double, Double> value)#
The force vector, in Newtons.
- Returns:
A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.
- void setPosition(org.javatuples.Triplet<Double, Double, Double> value)#
The position at which the force acts, in reference frame
Force.getReferenceFrame().- Returns:
The position as a vector.
- ReferenceFrame getReferenceFrame()#
- void setReferenceFrame(ReferenceFrame value)#
The reference frame of the force vector and position.
- void remove()#
Remove the force.
Module#
- public class 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.
- ConfigNode 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
nullif the module’s configuration node cannot be found.
- java.util.List<PartField> getFieldList()#
A list of all the fields of the module, including those not visible in the right-click menu of the part. Filter by
PartField.getVisible()to get just the visible ones.
- java.util.List<PartEvent> 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
PartEvent.getVisible()andPartEvent.getActive()to get just the ones shown in the menu.
- java.util.List<PartAction> 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.
- java.util.Map<String, String> getFields()#
Warning
Deprecated. Use
Module.getFieldList()instead, filtering byPartField.getVisible().The modules field names and their associated values, as a dictionary. These are the values visible in the right-click menu of the part.
Note
Throws an exception if there is more than one field with the same name. In that case, use
Module.getFieldsById()to get the fields by identifier.
- java.util.Map<String, String> getFieldsById()#
Warning
Deprecated. Use
Module.getFieldList()instead, filtering byPartField.getVisible().The modules field identifiers and their associated values, as a dictionary. These are the values visible in the right-click menu of the part.
- boolean hasField(String name)#
Warning
Deprecated. Filter
Module.getFieldList()byPartField.getGuiName()instead.Returns
trueif the module has a field with the given name.- Parameters:
name (
String) – Name of the field.
- boolean hasFieldWithId(String id)#
Warning
Deprecated. Filter
Module.getFieldList()byPartField.getName()instead.Returns
trueif the module has a field with the given identifier.- Parameters:
id (
String) – Identifier of the field.
- String getField(String name)#
Warning
Deprecated. Filter
Module.getFieldList()byPartField.getGuiName()and readPartField.getValue()instead.Returns the value of a field with the given name.
- Parameters:
name (
String) – Name of the field.
- String getFieldById(String id)#
Warning
Deprecated. Filter
Module.getFieldList()byPartField.getName()and readPartField.getValue()instead.Returns the value of a field with the given identifier.
- Parameters:
id (
String) – Identifier of the field.
- void setFieldInt(String name, int value)#
Warning
Deprecated. Set
PartField.getIntValue()instead.Set the value of a field to the given integer number.
- Parameters:
name (
String) – Name of the field.value (
int) – Value to set.
- void setFieldIntById(String id, int value)#
Warning
Deprecated. Set
PartField.getIntValue()instead.Set the value of a field to the given integer number.
- Parameters:
id (
String) – Identifier of the field.value (
int) – Value to set.
- void setFieldFloat(String name, float value)#
Warning
Deprecated. Set
PartField.getFloatValue()instead.Set the value of a field to the given floating point number.
- Parameters:
name (
String) – Name of the field.value (
float) – Value to set.
- void setFieldFloatById(String id, float value)#
Warning
Deprecated. Set
PartField.getFloatValue()instead.Set the value of a field to the given floating point number.
- Parameters:
id (
String) – Identifier of the field.value (
float) – Value to set.
- void setFieldString(String name, String value)#
Warning
Deprecated. Set
PartField.getValue()instead.Set the value of a field to the given string.
- void setFieldStringById(String id, String value)#
Warning
Deprecated. Set
PartField.getValue()instead.Set the value of a field to the given string.
- void setFieldBool(String name, boolean value)#
Warning
Deprecated. Set
PartField.getBoolValue()instead.Set the value of a field to true or false.
- Parameters:
name (
String) – Name of the field.value (
boolean) – Value to set.
- void setFieldBoolById(String id, boolean value)#
Warning
Deprecated. Set
PartField.getBoolValue()instead.Set the value of a field to true or false.
- Parameters:
id (
String) – Identifier of the field.value (
boolean) – Value to set.
- void resetField(String name)#
Warning
Deprecated. Use
PartField.reset()instead.Set the value of a field to its original value.
- Parameters:
name (
String) – Name of the field.
- void resetFieldById(String id)#
Warning
Deprecated. Use
PartField.reset()instead.Set the value of a field to its original value.
- Parameters:
id (
String) – Identifier of the field.
Note
The original value is the value the field had when the part was loaded.
- java.util.List<String> getEvents()#
Warning
Deprecated. Use
Module.getEventList()instead, filtering byPartEvent.getVisible()andPartEvent.getActive().A list of the names of all of the modules events. Events are the clickable buttons visible in the right-click menu of the part.
- java.util.List<String> getEventsById()#
Warning
Deprecated. Use
Module.getEventList()instead, filtering byPartEvent.getVisible()andPartEvent.getActive().A list of the identifiers of all of the modules events. Events are the clickable buttons visible in the right-click menu of the part.
- boolean hasEvent(String name)#
Warning
Deprecated. Filter
Module.getEventList()byPartEvent.getGuiName()instead.trueif the module has an event with the given name.- Parameters:
name (
String)
- boolean hasEventWithId(String id)#
Warning
Deprecated. Filter
Module.getEventList()byPartEvent.getName()instead.trueif the module has an event with the given identifier.- Parameters:
id (
String)
- void triggerEvent(String name)#
Warning
Deprecated. Filter
Module.getEventList()byPartEvent.getGuiName()and callPartEvent.trigger()instead.Trigger the named event. Equivalent to clicking the button in the right-click menu of the part.
- Parameters:
name (
String)
- void triggerEventById(String id)#
Warning
Deprecated. Filter
Module.getEventList()byPartEvent.getName()and callPartEvent.trigger()instead.Trigger the event with the given identifier. Equivalent to clicking the button in the right-click menu of the part.
- Parameters:
id (
String)
- java.util.List<String> getActions()#
Warning
Deprecated. Use
Module.getActionList()instead.A list of all the names of the modules actions. These are the parts actions that can be assigned to action groups in the in-game editor.
- java.util.List<String> getActionsById()#
Warning
Deprecated. Use
Module.getActionList()instead.A list of all the identifiers of the modules actions. These are the parts actions that can be assigned to action groups in the in-game editor.
- boolean hasAction(String name)#
Warning
Deprecated. Filter
Module.getActionList()byPartAction.getGuiName()instead.trueif the part has an action with the given name.- Parameters:
name (
String)
- boolean hasActionWithId(String id)#
Warning
Deprecated. Filter
Module.getActionList()byPartAction.getName()instead.trueif the part has an action with the given identifier.- Parameters:
id (
String)
- void setAction(String name, boolean value)#
Warning
Deprecated. Filter
Module.getActionList()byPartAction.getGuiName()and setPartAction.setActivated(boolean)instead.Set the value of an action with the given name.
- Parameters:
name (
String)value (
boolean)
- void setActionById(String id, boolean value)#
Warning
Deprecated. Filter
Module.getActionList()byPartAction.getName()and setPartAction.setActivated(boolean)instead.Set the value of an action with the given identifier.
- Parameters:
id (
String)value (
boolean)
- public class PartField#
A field of a part module. Obtained by calling
Module.getFieldList().- String getName()#
The identifier of the field. This is stable and does not change between game versions, unlike
PartField.getGuiName().
- String 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.
- boolean getVisible()#
Whether the field is visible in the right-click menu of the part, in the current scene (flight or editor).
- void setValue(String 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.
Note
Setting the value using this property is only permitted for string fields. Use the typed properties (
PartField.getBoolValue(),PartField.getIntValue(),PartField.getFloatValue(),PartField.getDoubleValue()) to set fields of other types.
- boolean getBoolValue()#
- void setBoolValue(boolean value)#
The value of a boolean field.
Note
The getter throws an exception if the field is not a boolean field (see
PartField.getType()).
- int getIntValue()#
- void setIntValue(int value)#
The value of an integer field.
Note
The getter throws an exception if the field is not an integer field (see
PartField.getType()).
- float getFloatValue()#
- void setFloatValue(float value)#
The value of a single precision floating point field.
Note
The getter throws an exception if the field is not a single precision floating point field (see
PartField.getType()).
- double getDoubleValue()#
- void setDoubleValue(double value)#
The value of a double precision floating point field.
Note
The getter throws an exception if the field is not a double precision floating point field (see
PartField.getType()).
- void 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.
- public enum FieldType#
The type of a part module field. See
PartField.getType().- public FieldType BOOLEAN#
A boolean field. Access using
PartField.getBoolValue().
- public FieldType INTEGER#
An integer field. Access using
PartField.getIntValue().
- public FieldType FLOAT#
A single precision floating point field. Access using
PartField.getFloatValue().
- public FieldType DOUBLE#
A double precision floating point field. Access using
PartField.getDoubleValue().
- public FieldType STRING#
A string field. Access using
PartField.getValue().
- public FieldType UNKNOWN#
A field whose type is not one of the above. Its value can still be read as a string using
PartField.getValue().
- public class PartEvent#
An event of a part module. Events are the clickable buttons visible in the right-click menu of the part. Obtained by calling
Module.getEventList().- String getName()#
The identifier of the event. This is stable and does not change between game versions, unlike
PartEvent.getGuiName().
- boolean getVisible()#
Whether the event is visible in the right-click menu of the part, in the current scene (flight or editor).
- boolean getActive()#
Whether the event is currently active.
- void trigger()#
Trigger the event. Equivalent to clicking the button in the right-click menu of the part.
- public class 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
Module.getActionList().- String getName()#
The identifier of the action. This is stable and does not change between game versions, unlike
PartAction.getGuiName().
- void setActivated(boolean value)#
Activate or deactivate the action. Equivalent to triggering the action from an action group. Set to
trueto activate the action, orfalseto deactivate it.
Config Node#
- public class 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
Part.getConfig()andModule.getConfig().- java.util.Map<String, String> getValues()#
The values stored in the node, as a dictionary mapping names to values.
Note
If a name appears more than once, only the first value is included. Use
ConfigNode.getValues(String)to get all of the values with a given name.
- boolean hasValue(String name)#
Returns
trueif the node has a value with the given name.- Parameters:
name (
String) – Name of the value.
- String getValue(String 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.
- Parameters:
name (
String) – Name of the value.
- java.util.List<String> getValues(String name)#
Returns all of the values with the given name, as a list.
- Parameters:
name (
String) – Name of the values.
- java.util.List<ConfigNode> getNodes()#
The child nodes contained in this node.
- boolean hasNode(String name)#
Returns
trueif the node has a child node with the given name.- Parameters:
name (
String) – Name of the child node.
- ConfigNode getNode(String 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.
- Parameters:
name (
String) – Name of the child node.
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 is only for stock KSP antennas.
- public class Antenna#
An antenna. Obtained by calling
Part.getAntenna().- DeployableState getState()#
The current state of the antenna.
- boolean getDeployable()#
Whether the antenna is deployable.
- boolean getDeployed()#
- void setDeployed(boolean value)#
Whether the antenna is deployed.
Note
Fixed antennas are always deployed. Returns an error if you try to deploy a fixed antenna.
- boolean getCanTransmit()#
Whether data can be transmitted by this antenna.
- void transmit()#
Transmit data.
- void cancel()#
Cancel current transmission of data.
- boolean getAllowPartial()#
- void setAllowPartial(boolean value)#
Whether partial data transmission is permitted.
- double getPower()#
The power of the antenna.
- boolean getCombinable()#
Whether the antenna can be combined with other antennae on the vessel to boost the power.
- double getCombinableExponent()#
Exponent used to calculate the combined power of multiple antennae on a vessel.
- float getPacketInterval()#
Interval between sending packets in seconds.
- float getPacketSize()#
Amount of data sent per packet in Mits.
- double getPacketResourceCost()#
Units of electric charge consumed per packet sent.
Cargo Bay#
- public class CargoBay#
A cargo bay. Obtained by calling
Part.getCargoBay().- DeployableState getState()#
The state of the cargo bay.
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
Part.getShielded()for that.A cargo bay is never
DeployableState.BROKEN, as the game does not track damage for them.
- boolean getOpen()#
- void setOpen(boolean value)#
Whether the cargo bay is open.
Control Surface#
- public class ControlSurface#
An aerodynamic control surface. Obtained by calling
Part.getControlSurface().- boolean getPitchEnabled()#
- void setPitchEnabled(boolean value)#
Whether the control surface has pitch control enabled.
- boolean getYawEnabled()#
- void setYawEnabled(boolean value)#
Whether the control surface has yaw control enabled.
- boolean getRollEnabled()#
- void setRollEnabled(boolean value)#
Whether the control surface has roll control enabled.
- float getAuthorityLimiter()#
- void setAuthorityLimiter(float value)#
The authority limiter for the control surface, which controls how far the control surface will move.
- boolean getInverted()#
- void setInverted(boolean value)#
Whether the control surface movement is inverted.
- boolean getDeployed()#
- void setDeployed(boolean value)#
Whether the control surface has been fully deployed.
- boolean getDeflectionOverride()#
- void setDeflectionOverride(boolean 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
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.
- float getDeflection()#
- void setDeflection(float value)#
The deflection command applied when
ControlSurface.getDeflectionOverride()is enabled, as a value between -1 and 1, mapped onto the surface’s deploy angle range.
- float getSurfaceArea()#
Surface area of the control surface in \(m^2\).
- org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getAvailableTorque()#
The available torque, in Newton meters, 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
Vessel.getReferenceFrame().
Decoupler#
- public class Decoupler#
A decoupler. Obtained by calling
Part.getDecoupler()- Vessel decouple()#
Fires the decoupler. Returns the new vessel created when the decoupler fires. Throws an exception if the decoupler has already fired.
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
getActiveVessel()no longer refer to the active vessel.
- boolean getDecoupled()#
Whether the decoupler has fired.
- boolean getStaged()#
Whether the decoupler is enabled in the staging sequence.
- float getImpulse()#
The impulse that the decoupler imparts when it is fired, in Newton seconds.
- boolean getIsOmniDecoupler()#
Whether the decoupler is an omni-decoupler (e.g. stack separator)
Deployable State#
The deployment state shared by antennas, cargo bays, landing legs, radiators, resource harvesters, solar panels and wheels.
- public enum DeployableState#
The state of a deployable part.
Antenna.getState(),CargoBay.getState(),Leg.getState(),Radiator.getState(),ResourceHarvester.getState(),SolarPanel.getState(),Wheel.getState()- public 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.
- public DeployableState RETRACTED#
The part is fully retracted. A cargo bay in this state is closed and locked.
- public DeployableState DEPLOYING#
The part is being deployed. A cargo bay in this state is opening.
- public DeployableState RETRACTING#
The part is being retracted. A cargo bay in this state is closing.
- public 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#
- public class DockingPort#
A docking port. Obtained by calling
Part.getDockingPort()- DockingPortState getState()#
The current state of the docking port.
- Part getDockedPart()#
The part that this docking port is docked to. Returns
nullif this docking port is not docked to anything.
- Vessel undock()#
Undocks the docking port and returns the new
Vesselthat 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.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
getActiveVessel()no longer refer to the active vessel.
- float getReengageDistance()#
The distance a docking port must move away when it undocks before it becomes ready to dock with another port, in meters.
- boolean getHasShield()#
Whether the docking port has a shield.
- boolean getShielded()#
- void setShielded(boolean value)#
The state of the docking ports shield, if it has one.
Returns
trueif the docking port has a shield, and the shield is closed. Otherwise returnsfalse. When set totrue, the shield is closed, and when set tofalsethe shield is opened. If the docking port does not have a shield, setting this attribute has no effect.
- boolean getCanRotate()#
Whether the docking port can be commanded to rotate while docked.
- float getMaximumRotation()#
Maximum rotation angle in degrees.
- float getMinimumRotation()#
Minimum rotation angle in degrees.
- float getRotationTarget()#
- void setRotationTarget(float value)#
Rotation target angle in degrees.
- boolean getRotationLocked()#
- void setRotationLocked(boolean value)#
Lock rotation. When locked, allows auto-strut to work across the joint.
- org.javatuples.Triplet<Double, Double, Double> position(ReferenceFrame referenceFrame)#
The position of the docking port, in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned position vector is in.
- Returns:
The position as a vector.
- org.javatuples.Triplet<Double, Double, Double> direction(ReferenceFrame referenceFrame)#
The direction that docking port points in, in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned direction is in.
- Returns:
The direction as a unit vector.
- org.javatuples.Quartet<Double, Double, Double, Double> rotation(ReferenceFrame referenceFrame)#
The rotation of the docking port, in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned rotation is in.
- Returns:
The rotation as a quaternion of the form \((x, y, z, w)\).
- ReferenceFrame 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.
Note
This reference frame is not necessarily equivalent to the reference frame for the part, returned by
Part.getReferenceFrame().
Docking port reference frame origin and axes#
Inline docking port reference frame origin and axes#
- public enum DockingPortState#
The state of a docking port. See
DockingPort.getState().- public DockingPortState READY#
The docking port is ready to dock to another docking port.
- public DockingPortState DOCKED#
The docking port is docked to another docking port, or docked to another part (from the VAB/SPH).
- public 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.
- public DockingPortState UNDOCKING#
The docking port has just been undocked from another docking port, and is disabled until it moves away by a sufficient distance (
DockingPort.getReengageDistance()).
- public DockingPortState SHIELDED#
The docking port has a shield, and the shield is closed.
- public DockingPortState MOVING#
The docking ports shield is currently opening/closing.
Engine#
- public class Engine#
An engine, including ones of various types. For example liquid fuelled gimballed engines, solid rocket boosters and jet engines. Obtained by calling
Part.getEngine().Note
For RCS thrusters
Part.getRCS().- boolean getActive()#
- void setActive(boolean value)#
Whether the engine is active. Setting this attribute may have no effect, depending on
Engine.getCanShutdown()andEngine.getCanRestart().
- float getThrust()#
The current amount of thrust being produced by the engine, in Newtons.
- float 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
Engine.getThrustLimit()and atmospheric conditions into account.
- float availableThrustAt(double 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.
- Parameters:
pressure (
double) – Atmospheric pressure in atmospheres
- float 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%.
- float maxThrustAt(double 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.
- Parameters:
pressure (
double) – Atmospheric pressure in atmospheres
- float 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,
Engine.getThrustLimit()is set to 100%, the main vessel’s throttle is set to 100% and the engine is in a vacuum.
- float getThrustLimit()#
- void setThrustLimit(float 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.
- java.util.List<Thruster> getThrusters()#
The components of the engine that generate thrust.
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
Engine.getAvailableThrust(),Engine.getMaxThrust()and others, is the sum of the thrust generated by each thruster.
- float getSpecificImpulse()#
The current specific impulse of the engine, in seconds. Returns zero if the engine is not active.
- float specificImpulseAt(double pressure)#
The specific impulse of the engine under the given pressure, in seconds. Returns zero if the engine is not active.
- Parameters:
pressure (
double) – Atmospheric pressure in atmospheres
- float getVacuumSpecificImpulse()#
The vacuum specific impulse of the engine, in seconds.
- float getKerbinSeaLevelSpecificImpulse()#
The specific impulse of the engine at sea level on Kerbin, in seconds.
- java.util.Map<String, Float> 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.
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.
- java.util.List<Propellant> getPropellants()#
The propellants that the engine consumes.
- boolean getHasFuel()#
Whether the engine has any fuel available.
- boolean 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.
- float getThrottle()#
- void setThrottle(float 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
Engine.getIndependentThrottle()), can be used to set the throttle percentage.
- boolean getThrottleLocked()#
Whether the
Control.getThrottle()affects the engine. For example, this istruefor liquid fueled rockets, andfalsefor solid rocket boosters.
- boolean getIndependentThrottle()#
- void setIndependentThrottle(boolean value)#
Whether the independent throttle is enabled for the engine.
- boolean getCanRestart()#
Whether the engine can be restarted once shutdown. If the engine cannot be shutdown, returns
false. For example, this istruefor liquid fueled rockets andfalsefor solid rocket boosters.
- boolean getCanShutdown()#
Whether the engine can be shutdown once activated. For example, this is
truefor liquid fueled rockets andfalsefor solid rocket boosters.
- boolean getHasModes()#
Whether the engine has multiple modes of operation.
- java.util.Map<String, Engine> getModes()#
The available modes for the engine. A dictionary mapping mode names to
Engineobjects.
- void toggleMode()#
Toggle the current engine mode.
- boolean getAutoModeSwitch()#
- void setAutoModeSwitch(boolean value)#
Whether the engine will automatically switch modes.
- boolean getGimballed()#
Whether the engine is gimballed.
- float getGimbalRange()#
The range over which the gimbal can move, in degrees. Returns 0 if the engine is not gimballed.
- boolean getGimbalLocked()#
- void setGimbalLocked(boolean value)#
Whether the engines gimbal is locked in place. Setting this attribute has no effect if the engine is not gimballed.
- float getGimbalLimit()#
- void setGimbalLimit(float value)#
The gimbal limiter of the engine. A value between 0 and 1. Returns 0 if the gimbal is locked.
- boolean getGimbalOverride()#
- void setGimbalOverride(boolean value)#
Whether the gimbal is being controlled directly, bypassing the vessel’s normal flight controls. When enabled, the gimbal deflection is set by
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.
- void setGimbalActuation(org.javatuples.Triplet<Double, Double, Double> value)#
The gimbal actuation command applied when
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 byEngine.getGimbalRange()andEngine.getGimbalLimit(). When the gimbal is not being overridden, returns the current actuation.
- org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getAvailableTorque()#
The available torque, in Newton meters, 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
Vessel.getReferenceFrame(). Returns zero if the engine is inactive, or not gimballed.
- boolean getCanReverseThrust()#
Whether the engine has a recognized thrust reverser. This is
truefor stock engines with a thrust reverser (such as the J-33 “Wheesley” and J-90 “Goliath” turbofan engines) and for selected mod engines. It isfalsefor engines whose reverser is not recognized, as KSP provides no standard way to detect one.
- boolean getThrustReversed()#
- void setThrustReversed(boolean 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. Raises an exception if the engine does not have a thrust reverser (see
Engine.getCanReverseThrust()).
- void toggleThrustReversal()#
Toggle the engine’s thrust reverser. Raises an exception if the engine does not have a thrust reverser (see
Engine.getCanReverseThrust()).
- public class Propellant#
A propellant for an engine. Obtains by calling
Engine.getPropellants().- double getCurrentAmount()#
The current amount of propellant consumed in the current physics update.
- double getCurrentRequirement()#
The required amount of propellant for the current physics update.
- double getTotalResourceAvailable()#
The total amount of the underlying resource currently reachable given resource flow rules.
- double getTotalResourceCapacity()#
The total vehicle capacity for the underlying propellant resource, restricted by resource flow rules.
- boolean getIgnoreForIsp()#
If this propellant should be ignored when calculating required mass flow given specific impulse.
- boolean getIgnoreForThrustCurve()#
If this propellant should be ignored for thrust curve calculations.
- boolean getDrawStackGauge()#
If this propellant has a stack gauge or not.
- boolean getIsDeprived()#
If this propellant is deprived.
- float getRatio()#
The propellant ratio.
Experiment#
- public class Experiment#
Obtained by calling
Part.getExperiment().- String getName()#
Internal name of the experiment, as used in part cfg files.
- void run()#
Run the experiment.
- void transmit()#
Transmit all experimental data contained by this part.
- void dump()#
Dump the experimental data contained by the experiment.
- void reset()#
Reset the experiment.
- boolean getDeployed()#
Whether the experiment has been deployed.
- boolean getRerunnable()#
Whether the experiment can be re-run.
- boolean getInoperable()#
Whether the experiment is inoperable.
- boolean getHasData()#
Whether the experiment contains data.
- java.util.List<ScienceData> getData()#
The data contained in this experiment.
- boolean getAvailable()#
Determines if the experiment is available given the current conditions.
- ScienceSubject getScienceSubject()#
Containing information on the corresponding specific science result for the current conditions. Returns
nullif the experiment is unavailable.
- public class ScienceData#
Obtained by calling
Experiment.getData().- float getDataAmount()#
Data amount.
- float getScienceValue()#
Science value.
- float getTransmitValue()#
Transmit value.
- public class ScienceSubject#
Obtained by calling
Experiment.getScienceSubject().- boolean getIsComplete()#
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
ScienceSubject.getScience()) 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, useExperiment.getHasData()andScienceData.getTransmitValue().
- float getScience()#
Amount of science already earned from this subject, not updated until after transmission/recovery.
- float getScienceCap()#
Total science allowable for this subject.
- float getDataScale()#
Multiply science value by this to determine data amount in mits.
- float getSubjectValue()#
Multiplier for specific Celestial Body/Experiment Situation combination.
- float getScientificValue()#
Diminishing value multiplier for decreasing the science value returned from repeated experiments.
Fairing#
- public class Fairing#
A fairing. Obtained by calling
Part.getFairing(). Supports both stock fairings, and those from the ProceduralFairings mod.- void jettison()#
Jettison the fairing. Has no effect if it has already been jettisoned.
- boolean getJettisoned()#
Whether the fairing has been jettisoned.
Intake#
- public class Intake#
An air intake. Obtained by calling
Part.getIntake().- boolean getOpen()#
- void setOpen(boolean value)#
Whether the intake is open.
- float getSpeed()#
Speed of the flow into the intake, in \(m/s\).
- float getFlow()#
The rate of flow into the intake, in units of resource per second.
- float getArea()#
The area of the intake’s opening, in square meters.
Leg#
- public class Leg#
A landing leg. Obtained by calling
Part.getLeg().- DeployableState getState()#
The current state of the landing leg.
- boolean getDeployable()#
Whether the leg is deployable.
- boolean getDeployed()#
- void setDeployed(boolean value)#
Whether the landing leg is deployed.
Note
Fixed landing legs are always deployed. Returns an error if you try to deploy fixed landing gear.
- boolean getIsGrounded()#
Returns whether the leg is touching the ground.
Launch Clamp#
- public class LaunchClamp#
A launch clamp. Obtained by calling
Part.getLaunchClamp().- void release()#
Releases the docking clamp. Has no effect if the clamp has already been released.
Light#
- public class Light#
A light. Obtained by calling
Part.getLight().- boolean getActive()#
- void setActive(boolean value)#
Whether the light is switched on.
- void setColor(org.javatuples.Triplet<Float, Float, Float> value)#
The color of the light, as an RGB triple.
- boolean getBlink()#
- void setBlink(boolean value)#
Whether blinking is enabled.
- float getBlinkRate()#
- void setBlinkRate(float value)#
The blink rate of the light.
- float getPowerUsage()#
The current power usage, in units of charge per second.
Parachute#
- public class Parachute#
A parachute. Obtained by calling
Part.getParachute().- void deploy()#
Deploys the parachute. This has no effect if the parachute has already been deployed.
- boolean getDeployed()#
Whether the parachute has been deployed.
- void arm()#
Deploys the parachute. This has no effect if the parachute has already been armed or deployed.
- boolean getArmed()#
Whether the parachute has been armed or deployed.
- void cut()#
Cuts the parachute.
- ParachuteState getState()#
The current state of the parachute.
- float getDeployAltitude()#
- void setDeployAltitude(float value)#
The altitude at which the parachute will full deploy, in meters. Only applicable to stock parachutes.
- float getDeployMinPressure()#
- void setDeployMinPressure(float value)#
The minimum pressure at which the parachute will semi-deploy, in atmospheres. Only applicable to stock parachutes.
- ParachuteSafeState 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
ParachuteSafeState.UNSAFEfor the first second after the vessel unpacks, before its thermal data is valid.
- public enum ParachuteState#
The state of a parachute. See
Parachute.getState().- public ParachuteState STOWED#
The parachute is safely tucked away inside its housing.
- public ParachuteState ARMED#
The parachute is armed for deployment.
- public ParachuteState SEMI_DEPLOYED#
The parachute has been deployed and is providing some drag, but is not fully deployed yet. (Stock parachutes only)
- public ParachuteState DEPLOYED#
The parachute is fully deployed.
- public ParachuteState CUT#
The parachute has been cut.
- public enum ParachuteSafeState#
The safety state of deploying a parachute. See
Parachute.getSafeState().- public ParachuteSafeState SAFE#
The parachute is safe to deploy.
- public ParachuteSafeState RISKY#
Deploying the parachute is risky, and it may break off.
- public ParachuteSafeState UNSAFE#
The parachute is unsafe to deploy, and will break off.
- public 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#
- public class Radiator#
A radiator. Obtained by calling
Part.getRadiator().- boolean getDeployable()#
Whether the radiator is deployable.
- boolean getDeployed()#
- void setDeployed(boolean value)#
For a deployable radiator,
trueif the radiator is extended. If the radiator is not deployable, this is alwaystrue.
- DeployableState getState()#
The current state of the radiator.
Note
A fixed radiator is always
DeployableState.DEPLOYED.
Resource Converter#
- public class ResourceConverter#
A resource converter. Obtained by calling
Part.getResourceConverter().- int getCount()#
The number of converters in the part.
- String name(int index)#
The name of the specified converter.
- Parameters:
index (
int) – Index of the converter.
- boolean active(int index)#
True if the specified converter is active.
- Parameters:
index (
int) – Index of the converter.
- void start(int index)#
Start the specified converter.
- Parameters:
index (
int) – Index of the converter.
- void stop(int index)#
Stop the specified converter.
- Parameters:
index (
int) – Index of the converter.
- ResourceConverterState state(int index)#
The state of the specified converter.
- Parameters:
index (
int) – Index of the converter.
- String statusInfo(int index)#
Status information for the specified converter. This is the full status message shown in the in-game UI.
- Parameters:
index (
int) – Index of the converter.
- java.util.List<String> inputs(int index)#
List of the names of resources consumed by the specified converter.
- Parameters:
index (
int) – Index of the converter.
- java.util.List<String> outputs(int index)#
List of the names of resources produced by the specified converter.
- Parameters:
index (
int) – Index of the converter.
- float getOptimumCoreTemperature()#
The core temperature at which the converter will operate with peak efficiency, in Kelvin.
- float getCoreTemperature()#
The core temperature of the converter, in Kelvin.
- float getThermalEfficiency()#
The thermal efficiency of the converter, as a percentage of its maximum.
- public enum ResourceConverterState#
The state of a resource converter. See
ResourceConverter.state(int).- public ResourceConverterState RUNNING#
Converter is running.
- public ResourceConverterState IDLE#
Converter is idle.
- public ResourceConverterState MISSING_RESOURCE#
Converter is missing a required resource.
- public ResourceConverterState STORAGE_FULL#
No available storage for output resource.
- public ResourceConverterState CAPACITY#
At preset resource capacity.
- public ResourceConverterState UNKNOWN#
Unknown state. Possible with modified resource converters. In this case, check
ResourceConverter.statusInfo(int)for more information.
Resource Harvester#
- public class ResourceHarvester#
A resource harvester (drill). Obtained by calling
Part.getResourceHarvester().- DeployableState getState()#
The deployment state of the harvester. Whether it is drilling is reported separately by
ResourceHarvester.getActive().Note
A harvester is never
DeployableState.BROKEN, as the game does not track damage for them.
- boolean getDeployed()#
- void setDeployed(boolean value)#
Whether the harvester is deployed.
- boolean getActive()#
- void setActive(boolean value)#
Whether the harvester is actively drilling.
Note
A value set while the harvester is deploying is applied when the deploy completes, so it can be set immediately after setting
ResourceHarvester.getDeployed()without waiting for the deploy animation. Setting it has no effect while the harvester is retracted or retracting.
- float getExtractionRate()#
The rate at which the drill is extracting ore, in units per second.
- float getThermalEfficiency()#
The thermal efficiency of the drill, as a percentage of its maximum.
- float getCoreTemperature()#
The core temperature of the drill, in Kelvin.
- float getOptimumCoreTemperature()#
The core temperature at which the drill will operate with peak efficiency, in Kelvin.
Reaction Wheel#
- public class ReactionWheel#
A reaction wheel. Obtained by calling
Part.getReactionWheel().- boolean getActive()#
- void setActive(boolean value)#
Whether the reaction wheel is active.
- boolean getBroken()#
Whether the reaction wheel is broken.
- org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getAvailableTorque()#
The available torque, in Newton meters, 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
Vessel.getReferenceFrame(). Returns zero if the reaction wheel is inactive or broken.
- org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getMaxTorque()#
The maximum torque, in Newton meters, 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
Vessel.getReferenceFrame().
- float getAuthorityLimiter()#
- void setAuthorityLimiter(float value)#
The authority limiter for the reaction wheel, as a percentage of maximum torque. A value between 0 and 1.
Resource Drain#
- public class ResourceDrain#
A resource drain. Obtained by calling
Part.getResourceDrain().- void setResource(Resource resource, boolean enabled)#
Whether the given resource should be drained.
- Parameters:
resource (
Resource)enabled (
boolean)
- boolean checkResource(Resource resource)#
Whether the provided resource is enabled for draining.
- Parameters:
resource (
Resource)
- float getMinRate()#
Minimum possible drain rate
- float getMaxRate()#
Maximum possible drain rate.
- float getRate()#
- void setRate(float value)#
Current drain rate.
- void start()#
Activates resource draining for all enabled parts.
- void stop()#
Turns off resource draining.
Robotic Controller#
- public class RoboticController#
A robotic controller. Obtained by calling
Part.getRoboticController().- boolean getEnabled()#
- void setEnabled(boolean value)#
Whether the controller is enabled.
- boolean getPlaying()#
Whether the controller’s sequence is currently playing.
- float getPosition()#
- void setPosition(float value)#
The current position along the sequence, in seconds.
- float getLength()#
The length of the sequence, in seconds.
- float getPlaySpeed()#
The speed at which the sequence is played back, as a multiple of normal speed.
- void play()#
Start playing the controller’s sequence.
- void stop()#
Stop playing the controller’s sequence.
- boolean addAxis(Module module, String fieldName)#
Add an axis to the controller.
- Parameters:
module (
Module) – The part module that the axis belongs to.fieldName (
String) – The name of the axis field, as returned byRoboticController.axes().
- Returns:
Returns
trueif the axis is added successfully.
- boolean addKeyFrame(Module module, String fieldName, float time, float value)#
Add key frame value for controller axis.
- Parameters:
module (
Module) – The part module that the axis belongs to.fieldName (
String) – The name of the axis field, as returned byRoboticController.axes().time (
float) – The time of the key frame.value (
float) – The value of the key frame.
- Returns:
Returns
trueif the key frame is added successfully.
Robotic Hinge#
- public class RoboticHinge#
A robotic hinge. Obtained by calling
Part.getRoboticHinge().- float getTargetAngle()#
- void setTargetAngle(float value)#
Target angle.
- float getCurrentAngle()#
Current angle.
- float getMinAngle()#
- void setMinAngle(float value)#
The minimum angle the hinge can move to, in degrees.
- float getMaxAngle()#
- void setMaxAngle(float value)#
The maximum angle the hinge can move to, in degrees.
- float getRate()#
- void setRate(float value)#
Target movement rate in degrees per second.
- float getDamping()#
- void setDamping(float value)#
Damping percentage.
- boolean getLocked()#
- void setLocked(boolean value)#
Lock movement.
- boolean getMotorEngaged()#
- void setMotorEngaged(boolean value)#
Whether the motor is engaged.
- boolean getIsMoving()#
Whether the servo is currently moving.
- void moveHome()#
Move hinge to its built position.
Robotic Piston#
- public class RoboticPiston#
A robotic piston part. Obtained by calling
Part.getRoboticPiston().- float getTargetExtension()#
- void setTargetExtension(float value)#
Target extension of the piston.
- float getCurrentExtension()#
Current extension of the piston.
- float getMinExtension()#
- void setMinExtension(float value)#
The minimum extension of the piston, in meters.
- float getMaxExtension()#
- void setMaxExtension(float value)#
The maximum extension of the piston, in meters.
- float getRate()#
- void setRate(float value)#
Target movement rate in meters per second.
- float getDamping()#
- void setDamping(float value)#
Damping percentage.
- boolean getLocked()#
- void setLocked(boolean value)#
Lock movement.
- boolean getMotorEngaged()#
- void setMotorEngaged(boolean value)#
Whether the motor is engaged.
- boolean getIsMoving()#
Whether the servo is currently moving.
- void moveHome()#
Move piston to its built position.
Robotic Rotation#
- public class RoboticRotation#
A robotic rotation servo. Obtained by calling
Part.getRoboticRotation().- float getTargetAngle()#
- void setTargetAngle(float value)#
Target angle.
- float getCurrentAngle()#
Current angle.
- float getMinAngle()#
- void setMinAngle(float value)#
The minimum angle the servo can rotate to, in degrees.
- float getMaxAngle()#
- void setMaxAngle(float value)#
The maximum angle the servo can rotate to, in degrees.
- boolean getAllowFullRotation()#
- void setAllowFullRotation(boolean value)#
Whether the servo is allowed to rotate freely through a full revolution, ignoring the angle limits.
- float getRate()#
- void setRate(float value)#
Target movement rate in degrees per second.
- float getDamping()#
- void setDamping(float value)#
Damping percentage.
- boolean getLocked()#
- void setLocked(boolean value)#
Lock Movement
- boolean getMotorEngaged()#
- void setMotorEngaged(boolean value)#
Whether the motor is engaged.
- boolean getIsMoving()#
Whether the servo is currently moving.
- void moveHome()#
Move rotation servo to its built position.
Robotic Rotor#
- public class RoboticRotor#
A robotic rotor. Obtained by calling
Part.getRoboticRotor().- float getTargetRPM()#
- void setTargetRPM(float value)#
Target RPM.
- float getCurrentRPM()#
Current RPM.
- boolean getInverted()#
- void setInverted(boolean value)#
Whether the rotor direction is inverted.
- float getTorqueLimit()#
- void setTorqueLimit(float value)#
Torque limit percentage.
- float getMaxTorque()#
- void setMaxTorque(float value)#
The maximum torque the rotor can generate, in kilonewtons.
- float getBrakePercentage()#
- void setBrakePercentage(float value)#
The percentage of braking force applied to the rotor.
- boolean getLocked()#
- void setLocked(boolean value)#
Lock movement.
- boolean getMotorEngaged()#
- void setMotorEngaged(boolean value)#
Whether the motor is engaged.
- boolean getIsMoving()#
Whether the rotor is currently moving.
RCS#
- public class RCS#
An RCS block or thruster. Obtained by calling
Part.getRCS().- boolean getActive()#
Whether the RCS thrusters are active. An RCS thruster is inactive if the RCS action group is disabled (
Control.getRCS()), the RCS thruster itself is not enabled (RCS.getEnabled()), or it is covered by a fairing (Part.getShielded()) and cannot thrust while shielded.
- boolean getEnabled()#
- void setEnabled(boolean value)#
Whether the RCS thrusters are enabled.
- boolean getPitchEnabled()#
- void setPitchEnabled(boolean value)#
Whether the RCS thruster will fire when pitch control input is given.
- boolean getYawEnabled()#
- void setYawEnabled(boolean value)#
Whether the RCS thruster will fire when yaw control input is given.
- boolean getRollEnabled()#
- void setRollEnabled(boolean value)#
Whether the RCS thruster will fire when roll control input is given.
- boolean getForwardEnabled()#
- void setForwardEnabled(boolean value)#
Whether the RCS thruster will fire when pitch control input is given.
- boolean getUpEnabled()#
- void setUpEnabled(boolean value)#
Whether the RCS thruster will fire when yaw control input is given.
- boolean getRightEnabled()#
- void setRightEnabled(boolean value)#
Whether the RCS thruster will fire when roll control input is given.
- boolean getInputOverride()#
- void setInputOverride(boolean 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
RCS.getRotationOverride()andRCS.getTranslationOverride()instead of the normal control inputs. The override is automatically released if the controlling client disconnects or the vessel changes.
- void setRotationOverride(org.javatuples.Triplet<Double, Double, Double> value)#
The rotation demand applied when
RCS.getInputOverride()is enabled, in the pitch, roll and yaw axes. Each component is a normalized control input between -1 and 1.
- void setTranslationOverride(org.javatuples.Triplet<Double, Double, Double> value)#
The translation demand applied when
RCS.getInputOverride()is enabled, in the right, up and forward axes. Each component is a normalized control input between -1 and 1.
- org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> getAvailableTorque()#
The available torque, in Newton meters, 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
Vessel.getReferenceFrame(). Returns zero if RCS is disable.
- org.javatuples.Pair<org.javatuples.Triplet<Double, Double, Double>, org.javatuples.Triplet<Double, Double, Double>> 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
Vessel.getReferenceFrame(). Returns zero if RCS is disabled.
- float 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
RCS.getThrustLimit()and atmospheric conditions into account.
- float getMaxThrust()#
The maximum amount of thrust that can be produced by the RCS thrusters when active, in Newtons, with the
RCS.getThrustLimit()set to 100%. Takes atmospheric conditions into account.
- float getMaxVacuumThrust()#
The maximum amount of thrust that can be produced by the RCS thrusters when active in a vacuum, in Newtons.
- float getThrustLimit()#
- void setThrustLimit(float value)#
The thrust limiter of the thruster. A value between 0 and 1.
- float getSpecificImpulse()#
The current specific impulse of the RCS, in seconds. Returns zero if the RCS is not active.
- float getVacuumSpecificImpulse()#
The vacuum specific impulse of the RCS, in seconds.
- float getKerbinSeaLevelSpecificImpulse()#
The specific impulse of the RCS at sea level on Kerbin, in seconds.
- java.util.Map<String, Float> 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.
- boolean getHasFuel()#
Whether the RCS has fuel available.
Sensor#
- public class Sensor#
A sensor, such as a thermometer. Obtained by calling
Part.getSensor().- boolean getActive()#
- void setActive(boolean value)#
Whether the sensor is active.
- String getValue()#
The current value of the sensor.
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
Part.getTemperature()(temperature sensors),Flight.getGForce()(accelerometers) orFlight.getStaticPressure()(barometers).
Solar Panel#
- public class SolarPanel#
A solar panel. Obtained by calling
Part.getSolarPanel().- boolean getDeployable()#
Whether the solar panel is deployable.
- boolean getDeployed()#
- void setDeployed(boolean value)#
Whether the solar panel is extended.
- DeployableState getState()#
The current state of the solar panel.
- float getEnergyFlow()#
The current amount of energy being generated by the solar panel, in units of charge per second.
- float getSunExposure()#
The current amount of sunlight that is incident on the solar panel, as a percentage. A value between 0 and 1.
Thruster#
- public class Thruster#
The component of an
EngineorRCSpart that generates thrust. Can obtained by callingEngine.getThrusters()orRCS.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.
- Part getPart()#
The
Thruster.getPart()that contains this thruster.
- org.javatuples.Triplet<Double, Double, Double> thrustPosition(ReferenceFrame 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.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned position vector is in.
- Returns:
The position as a vector.
- org.javatuples.Triplet<Double, Double, Double> thrustDirection(ReferenceFrame 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.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned direction is in.
- Returns:
The direction as a unit vector.
- ReferenceFrame getThrustReferenceFrame()#
A reference frame that is fixed relative to the thruster and orientated with its thrust direction (
Thruster.thrustDirection(ReferenceFrame)). For gimballed engines, this takes into account the current rotation of the gimbal.The origin is at the position of thrust for this thruster (
Thruster.thrustPosition(ReferenceFrame)).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.
- boolean getGimballed()#
Whether the thruster is gimballed.
- org.javatuples.Triplet<Double, Double, Double> gimbalPosition(ReferenceFrame referenceFrame)#
Position around which the gimbal pivots.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned position vector is in.
- Returns:
The position as a vector.
- org.javatuples.Triplet<Double, Double, Double> getGimbalAngle()#
The current gimbal angle in the pitch, roll and yaw axes, in degrees.
- org.javatuples.Triplet<Double, Double, Double> initialThrustPosition(ReferenceFrame referenceFrame)#
The position at which the thruster generates thrust, when the engine is in its initial position (no gimballing), in the given reference frame.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned position vector is in.
- Returns:
The position as a vector.
Note
This position can move when the gimbal rotates. This is because the thrust position and gimbal position are not necessarily the same.
- org.javatuples.Triplet<Double, Double, Double> initialThrustDirection(ReferenceFrame 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.
- Parameters:
referenceFrame (
ReferenceFrame) – The reference frame that the returned direction is in.
- Returns:
The direction as a unit vector.
Wheel#
- public class Wheel#
A wheel. Includes landing gear and rover wheels. Obtained by calling
Part.getWheel(). Can be used to control the motors, steering and deployment of wheels, among other things.- DeployableState getState()#
The current state of the wheel.
- float getRadius()#
Radius of the wheel, in meters.
- boolean getGrounded()#
Whether the wheel is touching the ground.
- boolean getHasBrakes()#
Whether the wheel has brakes.
- float getBrakes()#
- void setBrakes(float value)#
The braking force, as a percentage of maximum, when the brakes are applied.
- boolean getAutoFrictionControl()#
- void setAutoFrictionControl(boolean value)#
Whether automatic friction control is enabled.
- float getManualFrictionControl()#
- void setManualFrictionControl(float value)#
Manual friction control value. Only has an effect if automatic friction control is disabled. A value between 0 and 5 inclusive.
- boolean getDeployable()#
Whether the wheel is deployable.
- boolean getDeployed()#
- void setDeployed(boolean value)#
Whether the wheel is deployed.
- boolean getPowered()#
Whether the wheel is powered by a motor.
- boolean getMotorEnabled()#
- void setMotorEnabled(boolean value)#
Whether the motor is enabled.
- boolean getMotorInverted()#
- void setMotorInverted(boolean value)#
Whether the direction of the motor is inverted.
- MotorState getMotorState()#
Whether the direction of the motor is inverted.
- float getMotorOutput()#
The output of the motor. This is the torque currently being generated, in Newton meters.
- boolean getTractionControlEnabled()#
- void setTractionControlEnabled(boolean value)#
Whether automatic traction control is enabled. A wheel only has traction control if it is powered.
- float getTractionControl()#
- void setTractionControl(float value)#
Setting for the traction control. Only takes effect if the wheel has automatic traction control enabled. A value between 0 and 5 inclusive.
- float getDriveLimiter()#
- void setDriveLimiter(float 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.
- boolean getSteerable()#
Whether the wheel has steering.
- boolean getSteeringEnabled()#
- void setSteeringEnabled(boolean value)#
Whether the wheel steering is enabled.
- boolean getSteeringInverted()#
- void setSteeringInverted(boolean value)#
Whether the wheel steering is inverted.
- boolean getSteeringAngleAuto()#
- void setSteeringAngleAuto(boolean 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
Wheel.getSteeringAngleLimit().
- float getSteeringAngleLimit()#
- void setSteeringAngleLimit(float value)#
The steering angle limit.
- float getSteeringResponseTime()#
- void setSteeringResponseTime(float value)#
Steering response time.
- boolean getHasSuspension()#
Whether the wheel has suspension.
- float getSuspensionSpringStrength()#
Suspension spring strength, as set in the editor.
- float getSuspensionDamperStrength()#
Suspension damper strength, as set in the editor.
- boolean getBroken()#
Whether the wheel is broken.
- boolean getRepairable()#
Whether the wheel is repairable.
- float getStress()#
Current stress on the wheel.
- float getStressTolerance()#
Stress tolerance of the wheel.
- float getStressPercentage()#
Current stress on the wheel as a percentage of its stress tolerance.
- float getDeflection()#
Current deflection of the wheel.
- float getSlip()#
Current slip of the wheel.
- public enum MotorState#
The state of the motor on a powered wheel. See
Wheel.getMotorState().- public MotorState IDLE#
The motor is idle.
- public MotorState RUNNING#
The motor is running.
- public MotorState DISABLED#
The motor is disabled.
- public MotorState INOPERABLE#
The motor is inoperable.
- public MotorState NOT_ENOUGH_RESOURCES#
The motor does not have enough resources to run.
Trees of Parts#
Vessels in KSP are comprised of a number of parts, connected to one another in a
tree structure. An example vessel is shown in Figure 1, and the corresponding
tree of parts in Figure 2. The craft file for this example can also be
downloaded here.
Figure 1 – Example parts making up a vessel.#
Figure 2 – Tree of parts for the vessel in Figure 1. Arrows point from the parent part to the child part.#
Traversing the Tree#
The tree of parts can be traversed using the attributes Parts.getRoot(),
Part.getParent() and Part.getChildren().
The root of the tree is the same as the vessels root part (part number 1 in
the example above) and can be obtained by calling Parts.getRoot().
A parts children can be obtained by calling Part.getChildren().
If the part does not have any children, Part.getChildren()
returns an empty list. A parts parent can be obtained by calling
Part.getParent(). If the part does not have a parent
(as is the case for the root part), Part.getParent()
returns null.
The following Java example uses these attributes to perform a depth-first traversal over all of the parts in a vessel:
import krpc.client.Connection;
import krpc.client.RPCException;
import krpc.client.services.SpaceCenter;
import krpc.client.services.SpaceCenter.Part;
import krpc.client.services.SpaceCenter.Vessel;
import org.javatuples.Pair;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
public class TreeTraversal {
public static void main(String[] args) throws IOException, RPCException {
Connection connection = Connection.newInstance();
Vessel vessel = SpaceCenter.newInstance(connection).getActiveVessel();
Part root = vessel.getParts().getRoot();
Deque<Pair<Part, Integer>> stack = new ArrayDeque<Pair<Part, Integer>>();
stack.push(new Pair<Part, Integer>(root, 0));
while (stack.size() > 0) {
Pair<Part, Integer> item = stack.pop();
Part part = item.getValue0();
int depth = item.getValue1();
String prefix = "";
for (int i = 0; i < depth; i++) {
prefix += " ";
}
System.out.println(prefix + part.getTitle());
for (Part child : part.getChildren()) {
stack.push(new Pair<Part, Integer>(child, depth + 1));
}
}
connection.close();
}
}
When this code is execute using the craft file for the example vessel pictured above, the following is printed out:
Command Pod Mk1
TR-18A Stack Decoupler
FL-T400 Fuel Tank
LV-909 Liquid Fuel Engine
TR-18A Stack Decoupler
FL-T800 Fuel Tank
LV-909 Liquid Fuel Engine
TT-70 Radial Decoupler
FL-T400 Fuel Tank
TT18-A Launch Stability Enhancer
FTX-2 External Fuel Duct
LV-909 Liquid Fuel Engine
Aerodynamic Nose Cone
TT-70 Radial Decoupler
FL-T400 Fuel Tank
TT18-A Launch Stability Enhancer
FTX-2 External Fuel Duct
LV-909 Liquid Fuel Engine
Aerodynamic Nose Cone
LT-1 Landing Struts
LT-1 Landing Struts
Mk16 Parachute
Attachment Modes#
Parts can be attached to other parts either radially (on the side of the parent part) or axially (on the end of the parent part, to form a stack).
For example, in the vessel pictured above, the parachute (part 2) is axially connected to its parent (the command pod – part 1), and the landing leg (part 5) is radially connected to its parent (the fuel tank – part 4).
The root part of a vessel (for example the command pod – part 1) does not have a parent part, so does not have an attachment mode. However, the part is consider to be axially attached to nothing.
The following Java example does a depth-first traversal as before, but also prints out the attachment mode used by the part:
import krpc.client.Connection;
import krpc.client.RPCException;
import krpc.client.services.SpaceCenter;
import krpc.client.services.SpaceCenter.Part;
import krpc.client.services.SpaceCenter.Vessel;
import org.javatuples.Pair;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
public class AttachmentModes {
public static void main(String[] args) throws IOException, RPCException {
Connection connection = Connection.newInstance();
Vessel vessel = SpaceCenter.newInstance(connection).getActiveVessel();
Part root = vessel.getParts().getRoot();
Deque<Pair<Part, Integer>> stack = new ArrayDeque<Pair<Part, Integer>>();
stack.push(new Pair<Part, Integer>(root, 0));
while (stack.size() > 0) {
Pair<Part, Integer> item = stack.pop();
Part part = item.getValue0();
int depth = item.getValue1();
String prefix = "";
for (int i = 0; i < depth; i++) {
prefix += " ";
}
String attachMode = part.getAxiallyAttached() ? "axial" : "radial";
System.out.println(prefix + part.getTitle() + " - " + attachMode);
for (Part child : part.getChildren()) {
stack.push(new Pair<Part, Integer>(child, depth + 1));
}
}
connection.close();
}
}
When this code is execute using the craft file for the example vessel pictured above, the following is printed out:
Command Pod Mk1 - axial
TR-18A Stack Decoupler - axial
FL-T400 Fuel Tank - axial
LV-909 Liquid Fuel Engine - axial
TR-18A Stack Decoupler - axial
FL-T800 Fuel Tank - axial
LV-909 Liquid Fuel Engine - axial
TT-70 Radial Decoupler - radial
FL-T400 Fuel Tank - radial
TT18-A Launch Stability Enhancer - radial
FTX-2 External Fuel Duct - radial
LV-909 Liquid Fuel Engine - axial
Aerodynamic Nose Cone - axial
TT-70 Radial Decoupler - radial
FL-T400 Fuel Tank - radial
TT18-A Launch Stability Enhancer - radial
FTX-2 External Fuel Duct - radial
LV-909 Liquid Fuel Engine - axial
Aerodynamic Nose Cone - axial
LT-1 Landing Struts - radial
LT-1 Landing Struts - radial
Mk16 Parachute - axial
Fuel Lines#
Figure 5 – Fuel lines from the example in Figure 1. Fuel flows from the parts highlighted in green, into the part highlighted in blue.#
Figure 4 – A subset of the parts tree from Figure 2 above.#
Fuel lines are considered parts, and are included in the parts tree (for example, as pictured in Figure 4). However, the parts tree does not contain information about which parts fuel lines connect to. The parent part of a fuel line is the part from which it will take fuel (as shown in Figure 4) however the part that it will send fuel to is not represented in the parts tree.
Figure 5 shows the fuel lines from the example vessel pictured earlier. Fuel line part 15 (in red) takes fuel from a fuel tank (part 11 – in green) and feeds it into another fuel tank (part 9 – in blue). The fuel line is therefore a child of part 11, but its connection to part 9 is not represented in the tree.
The attributes Part.getFuelLinesFrom() and
Part.getFuelLinesTo() can be used to discover these
connections. In the example in Figure 5, when
Part.getFuelLinesTo() is called on fuel tank part
11, it will return a list of parts containing just fuel tank part 9 (the blue
part). When Part.getFuelLinesFrom() is called on
fuel tank part 9, it will return a list containing fuel tank parts 11 and 17
(the parts colored green).
Staging#
For vessel-level summaries (delta-v, thrust, fuel, and resources grouped per
stage), use the Stage class via
Vessel.getStages() and
Vessel.getDecoupleStages(). Legacy helpers
Parts.inStage(int),
Parts.inDecoupleStage(int), and
Vessel.resourcesInDecoupleStage(int, boolean) remain available but
are deprecated.
Figure 6 – Example vessel from Figure 1 with a staging sequence.#
Each part has two staging numbers associated with it: the stage in which the
part is activated and the stage in which the part is decoupled. These values
can be obtained using Part.getStage() and
Part.getDecoupleStage() respectively. For parts that
are not activated by staging, Part.getStage() returns
-1. For parts that are never decoupled,
Part.getDecoupleStage() returns a value of -1.
Figure 6 shows an example staging sequence for a vessel. Figure 7 shows the stages in which each part of the vessel will be activated. Figure 8 shows the stages in which each part of the vessel will be decoupled.
Figure 7 – The stage in which each part is activated.#
Figure 8 – The stage in which each part is decoupled.#