Debug#

Provides functionality to modify the state of the simulation directly, in ways the game normally does not allow: teleporting a vessel, setting its attitude, applying forces to its parts, refilling its tanks and enabling the game’s cheat options.

Note

Everything in this service is cheating. It has the same effect on a save as the game’s own debug menu (Alt+F12), and the same consequences: contracts, records and career progress made with it are not earned. It is intended for setting up a scenario to fly or a script to test, without flying there first.

krpc_error_t krpc_Debug_SetCircularOrbit(krpc_connection_t connection, krpc_SpaceCenter_CelestialBody_t body, double altitude)#

Move the active vessel onto a circular orbit around a body.

Parameters:
  • body – Body to orbit.

  • altitude – Altitude of the orbit, in meters above sea level.

Game Scenes:

Flight

krpc_error_t krpc_Debug_SetOrbit(krpc_connection_t connection, krpc_SpaceCenter_CelestialBody_t body, double semiMajorAxis, double eccentricity, double inclination, double longitudeOfAscendingNode, double argumentOfPeriapsis, double meanAnomalyAtEpoch, double epoch)#

Move the active vessel onto the orbit with the given orbital elements. The angles use the same units and conventions as krpc_SpaceCenter_Orbit_t.

Parameters:
  • body – Body to orbit.

  • semiMajorAxis – Semi-major axis of the orbit, in meters.

  • eccentricity – Eccentricity of the orbit.

  • inclination – Inclination of the orbit, in radians.

  • longitudeOfAscendingNode – Longitude of the ascending node, in radians.

  • argumentOfPeriapsis – Argument of periapsis, in radians.

  • meanAnomalyAtEpoch – Mean anomaly at epoch, in radians.

  • epoch – Universal time of the epoch, in seconds.

Game Scenes:

Flight

krpc_error_t krpc_Debug_SetLanded(krpc_connection_t connection, krpc_SpaceCenter_CelestialBody_t body, double latitude, double longitude, double altitude)#

Place the active vessel on the surface of a body at the given latitude and longitude, and wait for it to come to rest.

Parameters:
  • body – Body to land on.

  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • altitude – Height above the terrain to settle at, in meters. Defaults to 0, resting on the surface.

Game Scenes:

Flight

krpc_error_t krpc_Debug_SetFlight(krpc_connection_t connection, krpc_SpaceCenter_CelestialBody_t body, double latitude, double longitude, double altitude, double speed, double heading, double pitch, double roll, double angleOfAttack)#

Place the active vessel in atmospheric flight over the given point: at the given altitude and airspeed, pointing along the given heading at the given pitch and roll, and let physics resume so that it is flying. Use this to set up an in-air scenario without flying the craft up from the runway.

Parameters:
  • body – Body to fly over.

  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • altitude – Altitude in meters above sea level.

  • speed – Airspeed in meters per second, relative to the surface.

  • heading – Compass heading to point along, in degrees (90 is east).

  • pitch – Pitch above the horizon, in degrees. Defaults to 0 (level).

  • roll – Roll, in degrees. Defaults to 0 (wings level).

  • angleOfAttack – Angle of attack in degrees: how far the airspeed vector sits below the nose, in the pitch plane. 0 (the default) puts the airspeed along the nose; a positive value gives a nose-up attitude relative to the flight path, so the flight-path angle is pitch minus this.

Game Scenes:

Flight

Note

The pitch, heading and roll match those reported by the vessel’s krpc_SpaceCenter_Flight_t.

krpc_error_t krpc_Debug_SetPosition(krpc_connection_t connection, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

Move the active vessel to the given position, leaving its velocity as it is. To put it alongside another vessel, pass a position in that vessel’s reference frame.

Parameters:
  • position – Position of the vessel’s center of mass, in meters.

  • referenceFrame – Reference frame the position is in. Defaults to the reference frame of the body being orbited.

Game Scenes:

Flight

Note

This is the inverse of krpc_SpaceCenter_Vessel_Position() in the same reference frame.

krpc_error_t krpc_Debug_SetVelocity(krpc_connection_t connection, const krpc_tuple_double_double_double_t *velocity, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

Set the velocity of the active vessel, leaving it where it is. The vessel is moved onto the orbit that passes through its current position at the new velocity, so this works in orbit and in the atmosphere alike.

Parameters:
  • velocity – Velocity in meters per second.

  • referenceFrame – Reference frame the velocity is in. Defaults to the reference frame of the body being orbited, which rotates with it, so a zero velocity leaves the vessel at rest relative to the ground.

Game Scenes:

Flight

Note

This is the inverse of krpc_SpaceCenter_Vessel_Velocity() in the same reference frame.

krpc_error_t krpc_Debug_SetPitchHeadingRoll(krpc_connection_t connection, double pitch, double heading, double roll, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, krpc_SpaceCenter_Vessel_t vessel)#

Set the attitude of a vessel to the given pitch, heading and roll in the given reference frame, and stop it rotating. Lets a script start from a fixed, still pose without first flying the autopilot there.

Parameters:
  • pitch – Target pitch, in degrees.

  • heading – Target heading, in degrees.

  • roll – Target roll, in degrees.

  • referenceFrame – Reference frame the angles are in. Defaults to the vessel’s surface reference frame.

  • vessel – Vessel to rotate. Defaults to the active vessel.

Game Scenes:

Flight

Note

The angles match those reported by the vessel’s krpc_SpaceCenter_Flight_t.

krpc_error_t krpc_Debug_SetDirection(krpc_connection_t connection, const krpc_tuple_double_double_double_t *direction, double roll, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, krpc_SpaceCenter_Vessel_t vessel)#

Point a vessel along the given direction in the given reference frame, and stop it rotating. This is krpc_Debug_SetPitchHeadingRoll() with a pointing vector instead of a pitch and heading, matching the attitude the autopilot holds for the same target direction and roll.

Parameters:
  • direction – Direction to point the nose of the vessel in.

  • roll – Target roll, in degrees, or NaN to leave the roll uncontrolled.

  • referenceFrame – Reference frame the direction and roll are in. Defaults to the vessel’s surface reference frame.

  • vessel – Vessel to rotate. Defaults to the active vessel.

Game Scenes:

Flight

krpc_error_t krpc_Debug_ApplyRotation(krpc_connection_t connection, double angle, const krpc_tuple_double_double_double_t *axis, krpc_SpaceCenter_Vessel_t vessel)#

Rotate a vessel about the given axis, in its own reference frame, by the given angle.

Parameters:
  • angle – Angle to rotate by, in degrees.

  • axis – Axis to rotate about.

  • vessel – Vessel to rotate. Defaults to the active vessel.

Game Scenes:

Flight

krpc_error_t krpc_Debug_SetAngularVelocity(krpc_connection_t connection, const krpc_tuple_double_double_double_t *angularVelocity, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, krpc_SpaceCenter_Vessel_t vessel)#

Set the angular velocity of a vessel, expressed in the given reference frame. Pass a zero vector to stop the vessel rotating.

Parameters:
  • angularVelocity – Angular velocity, in radians per second. The direction is the axis of rotation and the magnitude is the rate.

  • referenceFrame – Reference frame the angular velocity is in. Defaults to the vessel’s surface reference frame.

  • vessel – Vessel to rotate. Defaults to the active vessel.

Game Scenes:

Flight

Note

The whole vessel is put into a rigid rotation about its center of mass, so it spins in place rather than shearing apart or translating.

krpc_error_t krpc_Debug_AddForce(krpc_connection_t connection, krpc_SpaceCenter_Force_t *returnValue, krpc_SpaceCenter_Part_t part, const krpc_tuple_double_double_double_t *force, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

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

Parameters:
  • part – The part to apply the force to.

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

  • position – The position at which the force acts, as a vector.

  • referenceFrame – The reference frame that the force and position are in.

Returns:

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

Game Scenes:

Flight

Note

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

krpc_error_t krpc_Debug_InstantaneousForce(krpc_connection_t connection, krpc_SpaceCenter_Part_t part, const krpc_tuple_double_double_double_t *force, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

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

Parameters:
  • part – The part to apply the force to.

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

  • position – The position at which the force acts, as a vector.

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

krpc_error_t krpc_Debug_FillAllResources(krpc_connection_t connection, krpc_SpaceCenter_Vessel_t vessel)#

Fill every resource tank on a vessel to its maximum capacity.

Parameters:
  • vessel – Vessel to fill. Defaults to the active vessel.

Game Scenes:

Flight

krpc_error_t krpc_Debug_FillResources(krpc_connection_t connection, const char *resourceName, krpc_SpaceCenter_Vessel_t vessel)#

Fill the tanks of a single resource on a vessel to their maximum capacity.

Parameters:
  • resourceName – Name of the resource to fill, for example "LiquidFuel".

  • vessel – Vessel to fill. Defaults to the active vessel.

Game Scenes:

Flight

krpc_error_t krpc_Debug_InfinitePropellant(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_InfinitePropellant(krpc_connection_t connection, bool value)#

Whether engines and RCS thrusters draw no propellant.

krpc_error_t krpc_Debug_InfiniteElectricity(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_InfiniteElectricity(krpc_connection_t connection, bool value)#

Whether parts draw no electric charge.

krpc_error_t krpc_Debug_NoCrashDamage(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_NoCrashDamage(krpc_connection_t connection, bool value)#

Whether parts survive collisions that would otherwise destroy them.

krpc_error_t krpc_Debug_UnbreakableJoints(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_UnbreakableJoints(krpc_connection_t connection, bool value)#

Whether the joints between parts are rigid and cannot break.

krpc_error_t krpc_Debug_IgnoreMaxTemperature(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_IgnoreMaxTemperature(krpc_connection_t connection, bool value)#

Whether parts survive temperatures above their maximum, instead of exploding.

krpc_error_t krpc_Debug_AllowPartClipping(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_AllowPartClipping(krpc_connection_t connection, bool value)#

Whether parts may be placed so that they intersect one another in the editor.

krpc_error_t krpc_Debug_NonStrictAttachmentOrientation(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_NonStrictAttachmentOrientation(krpc_connection_t connection, bool value)#

Whether parts may be attached in any orientation, rather than only the ones their attachment nodes allow.

krpc_error_t krpc_Debug_IgnoreKerbalInventoryLimits(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_IgnoreKerbalInventoryLimits(krpc_connection_t connection, bool value)#

Whether a kerbal’s inventory may hold more than its slot and mass limits allow.

krpc_error_t krpc_Debug_IgnoreEVAConstructionMassLimit(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_IgnoreEVAConstructionMassLimit(krpc_connection_t connection, bool value)#

Whether EVA construction may move parts heavier than a kerbal can normally carry.

krpc_error_t krpc_Debug_IgnoreAgencyMindsetOnContracts(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_IgnoreAgencyMindsetOnContracts(krpc_connection_t connection, bool value)#

Whether contracts are offered regardless of the agency mindset that normally restricts which ones appear.

krpc_error_t krpc_Debug_PauseOnVesselUnpack(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_PauseOnVesselUnpack(krpc_connection_t connection, bool value)#

Whether the game pauses whenever a vessel comes off rails.

krpc_error_t krpc_Debug_BiomesVisible(krpc_connection_t connection, bool *returnValue)#
krpc_error_t krpc_Debug_set_BiomesVisible(krpc_connection_t connection, bool value)#

Whether biome boundaries are drawn on the surface of bodies.

krpc_error_t krpc_Debug_GravityMultiplier(krpc_connection_t connection, double *returnValue)#
krpc_error_t krpc_Debug_set_GravityMultiplier(krpc_connection_t connection, double value)#

Multiplier applied to the force of gravity on every vessel. 1 is normal gravity, 0 is weightlessness.

krpc_error_t krpc_Debug_Funds(krpc_connection_t connection, double *returnValue)#
krpc_error_t krpc_Debug_set_Funds(krpc_connection_t connection, double value)#

The number of funds the player has. Only available in career mode.

krpc_error_t krpc_Debug_Science(krpc_connection_t connection, float *returnValue)#
krpc_error_t krpc_Debug_set_Science(krpc_connection_t connection, float value)#

The amount of science the player has. Only available in career and science mode.

krpc_error_t krpc_Debug_Reputation(krpc_connection_t connection, float *returnValue)#
krpc_error_t krpc_Debug_set_Reputation(krpc_connection_t connection, float value)#

The player’s reputation. Only available in career mode.

krpc_error_t krpc_Debug_UnlockTechnologyTree(krpc_connection_t connection)#

Research every node in the technology tree and purchase every part in it. Only available in career and science mode.

krpc_error_t krpc_Debug_UpgradeFacilities(krpc_connection_t connection)#

Upgrade every building at the space center to its highest level. Only available in career mode.

krpc_error_t krpc_Debug_MaxKerbalExperience(krpc_connection_t connection)#

Raise every kerbal in the roster to the highest experience level.