Debug#
-
type krpc_KSA_Debug_t#
Changes the state of the simulation directly, as the game’s debug windows and console commands do: teleporting a vehicle, setting its attitude, refilling its tanks.
-
krpc_error_t krpc_KSA_Debug_SetCircularOrbit(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, krpc_KSA_Body_t body, double altitude)#
Move a vehicle onto a circular orbit around a body, and return once it is there.
- Parameters:
vehicle – The vehicle.
body – The body to orbit.
altitude – The altitude of the orbit above the mean radius, in meters.
Note
Throws an exception if the game cannot compute the vehicle’s trajectory on the orbit.
-
krpc_error_t krpc_KSA_Debug_SetOrbit(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, krpc_KSA_Body_t body, double semiMajorAxis, double eccentricity, double inclination, double longitudeOfAscendingNode, double argumentOfPeriapsis, double meanAnomalyAtEpoch, double epoch)#
Move a vehicle onto the orbit with the given elements, and return once it is there. The angles are those of
krpc_KSA_Orbit_t.- Parameters:
vehicle – The vehicle.
body – The body to orbit.
semiMajorAxis – The semi-major axis, in meters.
eccentricity – The eccentricity.
inclination – The inclination, in radians.
longitudeOfAscendingNode – The longitude of the ascending node, in radians.
argumentOfPeriapsis – The argument of periapsis, in radians.
meanAnomalyAtEpoch – The mean anomaly at the epoch, in radians.
epoch – The universal time of the epoch, in seconds.
Note
Throws an exception if the game cannot compute the vehicle’s trajectory on the orbit.
-
krpc_error_t krpc_KSA_Debug_SetLanded(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, krpc_KSA_Body_t body, double latitude, double longitude)#
Place a vehicle on the surface of a body, as the game’s teleport window does, and return once it is there.
- Parameters:
vehicle – The vehicle.
body – The body to land on.
latitude – The latitude, in degrees.
longitude – The longitude, in degrees.
Note
Throws an exception if the body has no surface.
-
krpc_error_t krpc_KSA_Debug_SetPosition(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, const krpc_tuple_double_double_double_t *position, krpc_KSA_ReferenceFrame_t referenceFrame)#
Move a vehicle to the given position, keeping its velocity, and return once it is there.
- Parameters:
vehicle – The vehicle.
position – The position of the vehicle, in meters.
referenceFrame – The reference frame of the position.
Note
This is the inverse of
krpc_KSA_Vehicle_Position(). The vehicle keeps orbiting the same body.
-
krpc_error_t krpc_KSA_Debug_SetVelocity(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, const krpc_tuple_double_double_double_t *velocity, krpc_KSA_ReferenceFrame_t referenceFrame)#
Set the velocity of a vehicle, keeping its position, and return once it is set.
- Parameters:
vehicle – The vehicle.
velocity – The velocity of the vehicle, in meters per second.
referenceFrame – The reference frame of the velocity.
Note
This is the inverse of
krpc_KSA_Vehicle_Velocity(). The vehicle keeps orbiting the same body.
-
krpc_error_t krpc_KSA_Debug_SetRotation(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, const krpc_tuple_double_double_double_double_t *rotation, krpc_KSA_ReferenceFrame_t referenceFrame)#
Set the rotation of a vehicle, and return once it is set.
- Parameters:
vehicle – The vehicle.
rotation – The rotation of the vehicle, as a quaternion of the form
(x, y, z, w).referenceFrame – The reference frame of the rotation.
Note
This is the inverse of
krpc_KSA_Vehicle_Rotation().
-
krpc_error_t krpc_KSA_Debug_SetAngularVelocity(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, const krpc_tuple_double_double_double_t *angularVelocity, krpc_KSA_ReferenceFrame_t referenceFrame)#
Set the angular velocity of a vehicle, and return once it is set.
- Parameters:
vehicle – The vehicle.
angularVelocity – The angular velocity, in radians per second. The vector points along the axis of rotation, and its length is the rate.
referenceFrame – The reference frame of the angular velocity.
Note
This is the inverse of
krpc_KSA_Vehicle_AngularVelocity().
-
krpc_error_t krpc_KSA_Debug_FillResources(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle)#
Fill the propellant, batteries and other consumables of a vehicle, as the game’s refill command does.
- Parameters:
vehicle – The vehicle.
-
krpc_error_t krpc_KSA_Debug_EmptyResources(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle)#
Empty the propellant, batteries and other consumables of a vehicle, as the game’s empty command does.
- Parameters:
vehicle – The vehicle.
-
krpc_error_t krpc_KSA_Debug_DuplicateVehicle(krpc_connection_t connection, krpc_KSA_Vehicle_t *returnValue, krpc_KSA_Vehicle_t vehicle, const char *name)#
Create a copy of a vehicle beside it, as the game’s duplicate command does, and return once it is created.
- Parameters:
vehicle – The vehicle to copy.
name – The name of the copy.
- Returns:
The copy.
Note
Throws an exception if the name is in use.
-
krpc_error_t krpc_KSA_Debug_ExplodeVehicle(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle)#
Destroy a vehicle in an explosion, as the game’s explode command does, and return once the vehicle is gone. Its crew are killed.
- Parameters:
vehicle – The vehicle.
-
krpc_error_t krpc_KSA_Debug_ShowVelocityArrows(krpc_connection_t connection, bool visible)#
Show or hide the game’s debug arrows for the velocities of the vehicles.
- Parameters:
visible – Whether to show the arrows.
-
krpc_error_t krpc_KSA_Debug_RunCommand(krpc_connection_t connection, krpc_list_string_t *returnValue, const char *command)#
Run a command in the game’s console, as typed in the console.
- Parameters:
command – The command and its arguments.
- Returns:
The console output of the command, one line per message.
Note
Most commands write their messages to the game’s log, not the returned output. Throws an exception if the console has no such command, or the arguments are not valid.
-
krpc_error_t krpc_KSA_Debug_SetCircularOrbit(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, krpc_KSA_Body_t body, double altitude)#