.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.Debug Debug ===== .. type:: public class 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. .. method:: void setCircularOrbit(SpaceCenter.CelestialBody body, double altitude) Move the active vessel onto a circular orbit around a body. :param SpaceCenter.CelestialBody body: Body to orbit. :param double altitude: Altitude of the orbit, in meters above sea level. :Game Scenes: Flight .. method:: void setOrbit(SpaceCenter.CelestialBody 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 :type:`SpaceCenter.Orbit`. :param SpaceCenter.CelestialBody body: Body to orbit. :param double semiMajorAxis: Semi-major axis of the orbit, in meters. :param double eccentricity: Eccentricity of the orbit. :param double inclination: Inclination of the orbit, in radians. :param double longitudeOfAscendingNode: Longitude of the ascending node, in radians. :param double argumentOfPeriapsis: Argument of periapsis, in radians. :param double meanAnomalyAtEpoch: Mean anomaly at epoch, in radians. :param double epoch: Universal time of the epoch, in seconds. :Game Scenes: Flight .. method:: void setLanded(SpaceCenter.CelestialBody 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. :param SpaceCenter.CelestialBody body: Body to land on. :param double latitude: Latitude in degrees. :param double longitude: Longitude in degrees. :param double altitude: Height above the terrain to settle at, in meters. Defaults to 0, resting on the surface. :Game Scenes: Flight .. method:: void setFlight(SpaceCenter.CelestialBody 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. :param SpaceCenter.CelestialBody body: Body to fly over. :param double latitude: Latitude in degrees. :param double longitude: Longitude in degrees. :param double altitude: Altitude in meters above sea level. :param double speed: Airspeed in meters per second, relative to the surface. :param double heading: Compass heading to point along, in degrees (90 is east). :param double pitch: Pitch above the horizon, in degrees. Defaults to 0 (level). :param double roll: Roll, in degrees. Defaults to 0 (wings level). :param double 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 :type:`SpaceCenter.Flight`. .. method:: void setPosition(org.javatuples.Triplet position, SpaceCenter.ReferenceFrame 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. :param org.javatuples.Triplet position: Position of the vessel's center of mass, in meters. :param SpaceCenter.ReferenceFrame 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 :meth:`SpaceCenter.Vessel.position(SpaceCenter.ReferenceFrame)` in the same reference frame. .. method:: void setVelocity(org.javatuples.Triplet velocity, SpaceCenter.ReferenceFrame 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. :param org.javatuples.Triplet velocity: Velocity in meters per second. :param SpaceCenter.ReferenceFrame 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 :meth:`SpaceCenter.Vessel.velocity(SpaceCenter.ReferenceFrame)` in the same reference frame. .. method:: void setPitchHeadingRoll(double pitch, double heading, double roll, SpaceCenter.ReferenceFrame referenceFrame, SpaceCenter.Vessel 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. :param double pitch: Target pitch, in degrees. :param double heading: Target heading, in degrees. :param double roll: Target roll, in degrees. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame the angles are in. Defaults to the vessel's surface reference frame. :param SpaceCenter.Vessel vessel: Vessel to rotate. Defaults to the active vessel. :Game Scenes: Flight .. note:: The angles match those reported by the vessel's :type:`SpaceCenter.Flight`. .. method:: void setDirection(org.javatuples.Triplet direction, double roll, SpaceCenter.ReferenceFrame referenceFrame, SpaceCenter.Vessel vessel) Point a vessel along the given direction in the given reference frame, and stop it rotating. This is :meth:`setPitchHeadingRoll(double, double, double, SpaceCenter.ReferenceFrame, SpaceCenter.Vessel)` with a pointing vector instead of a pitch and heading, matching the attitude the autopilot holds for the same target direction and roll. :param org.javatuples.Triplet direction: Direction to point the nose of the vessel in. :param double roll: Target roll, in degrees, or ``NaN`` to leave the roll uncontrolled. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame the direction and roll are in. Defaults to the vessel's surface reference frame. :param SpaceCenter.Vessel vessel: Vessel to rotate. Defaults to the active vessel. :Game Scenes: Flight .. method:: void applyRotation(double angle, org.javatuples.Triplet axis, SpaceCenter.Vessel vessel) Rotate a vessel about the given axis, in its own reference frame, by the given angle. :param double angle: Angle to rotate by, in degrees. :param org.javatuples.Triplet axis: Axis to rotate about. :param SpaceCenter.Vessel vessel: Vessel to rotate. Defaults to the active vessel. :Game Scenes: Flight .. method:: void setAngularVelocity(org.javatuples.Triplet angularVelocity, SpaceCenter.ReferenceFrame referenceFrame, SpaceCenter.Vessel vessel) Set the angular velocity of a vessel, expressed in the given reference frame. Pass a zero vector to stop the vessel rotating. :param org.javatuples.Triplet angularVelocity: Angular velocity, in radians per second. The direction is the axis of rotation and the magnitude is the rate. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame the angular velocity is in. Defaults to the vessel's surface reference frame. :param SpaceCenter.Vessel 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. .. method:: SpaceCenter.Force addForce(SpaceCenter.Part part, org.javatuples.Triplet force, org.javatuples.Triplet position, SpaceCenter.ReferenceFrame referenceFrame) Exert a constant force on a part, acting at the given position. :param SpaceCenter.Part part: The part to apply the force to. :param org.javatuples.Triplet force: A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons. :param org.javatuples.Triplet position: The position at which the force acts, as a vector. :param SpaceCenter.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. :Game Scenes: Flight .. note:: The force is removed when the client that added it disconnects. .. method:: void instantaneousForce(SpaceCenter.Part part, org.javatuples.Triplet force, org.javatuples.Triplet position, SpaceCenter.ReferenceFrame referenceFrame) Exert an instantaneous force on a part, acting at the given position. :param SpaceCenter.Part part: The part to apply the force to. :param org.javatuples.Triplet force: A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons. :param org.javatuples.Triplet position: The position at which the force acts, as a vector. :param SpaceCenter.ReferenceFrame 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. .. method:: void fillAllResources(SpaceCenter.Vessel vessel) Fill every resource tank on a vessel to its maximum capacity. :param SpaceCenter.Vessel vessel: Vessel to fill. Defaults to the active vessel. :Game Scenes: Flight .. method:: void fillResources(String resourceName, SpaceCenter.Vessel vessel) Fill the tanks of a single resource on a vessel to their maximum capacity. :param String resourceName: Name of the resource to fill, for example ``"LiquidFuel"``. :param SpaceCenter.Vessel vessel: Vessel to fill. Defaults to the active vessel. :Game Scenes: Flight .. method:: boolean getInfinitePropellant() .. method:: void setInfinitePropellant(boolean value) Whether engines and RCS thrusters draw no propellant. .. method:: boolean getInfiniteElectricity() .. method:: void setInfiniteElectricity(boolean value) Whether parts draw no electric charge. .. method:: boolean getNoCrashDamage() .. method:: void setNoCrashDamage(boolean value) Whether parts survive collisions that would otherwise destroy them. .. method:: boolean getUnbreakableJoints() .. method:: void setUnbreakableJoints(boolean value) Whether the joints between parts are rigid and cannot break. .. method:: boolean getIgnoreMaxTemperature() .. method:: void setIgnoreMaxTemperature(boolean value) Whether parts survive temperatures above their maximum, instead of exploding. .. method:: boolean getAllowPartClipping() .. method:: void setAllowPartClipping(boolean value) Whether parts may be placed so that they intersect one another in the editor. .. method:: boolean getNonStrictAttachmentOrientation() .. method:: void setNonStrictAttachmentOrientation(boolean value) Whether parts may be attached in any orientation, rather than only the ones their attachment nodes allow. .. method:: boolean getIgnoreKerbalInventoryLimits() .. method:: void setIgnoreKerbalInventoryLimits(boolean value) Whether a kerbal's inventory may hold more than its slot and mass limits allow. .. method:: boolean getIgnoreEVAConstructionMassLimit() .. method:: void setIgnoreEVAConstructionMassLimit(boolean value) Whether EVA construction may move parts heavier than a kerbal can normally carry. .. method:: boolean getIgnoreAgencyMindsetOnContracts() .. method:: void setIgnoreAgencyMindsetOnContracts(boolean value) Whether contracts are offered regardless of the agency mindset that normally restricts which ones appear. .. method:: boolean getPauseOnVesselUnpack() .. method:: void setPauseOnVesselUnpack(boolean value) Whether the game pauses whenever a vessel comes off rails. .. method:: boolean getBiomesVisible() .. method:: void setBiomesVisible(boolean value) Whether biome boundaries are drawn on the surface of bodies. .. method:: double getGravityMultiplier() .. method:: void setGravityMultiplier(double value) Multiplier applied to the force of gravity on every vessel. 1 is normal gravity, 0 is weightlessness. .. method:: double getFunds() .. method:: void setFunds(double value) The number of funds the player has. Only available in career mode. .. method:: float getScience() .. method:: void setScience(float value) The amount of science the player has. Only available in career and science mode. .. method:: float getReputation() .. method:: void setReputation(float value) The player's reputation. Only available in career mode. .. method:: void unlockTechnologyTree() Research every node in the technology tree and purchase every part in it. Only available in career and science mode. .. method:: void upgradeFacilities() Upgrade every building at the space center to its highest level. Only available in career mode. .. method:: void maxKerbalExperience() Raise every kerbal in the roster to the highest experience level.