Skip to content

Latest commit

 

History

History
102 lines (98 loc) · 9.01 KB

Ship.md

File metadata and controls

102 lines (98 loc) · 9.01 KB

Ship

Active vessel

Instance Properties:

  • native: Vessel - [Unsafe] Native Vessel for unrestricted access to KSP API. Same as FlightGlobals.ActiveVessel if accessed through global ship.
  • name: string - Name of the ship (vehicle/vessel).
  • target: Object - [WIP] Target of active ship. Null if none.
  • autopilot: Autopilot - Autopilot of this ship (vehicle/vessel).
  • throttle: float - Current throttle (assign redirects to Autopilot, reads control state if autopilot disabled)
  • controllable: bool - Indicator that ship is controllable.
  • parts: ShipPartSet - All parts of this ship/vessel/vehicle.
  • root: Part - Root part (same as parts.root).
  • controlPart: Part - Controlling part (same as parts.control).
  • nextDecoupler: LinkPart - One of the decouplers that will get activated by nearest stage. (Same as Parts.NextDecoupler.)
  • nextDecouplerStage: int - Stage number of the nearest decoupler or -1. (Same as Parts.NextDecouplerStage.)
  • currentStage: int - Current stage number. (Same as stage.number if active ship.)
  • stages: Stages - [WIP] Parts per stage (by decoupledin+1).
  • decouplers: ReadOnlyList[LinkPart] - List of all decouplers, separators, launch clamps and docks with staging. (Docking ports without staging enabled not included.)
  • dockingports: ReadOnlyList[DockingPort] - List of all docking ports (regardless of staging).
  • engines: EngineSet - All engines (regardless of state).
  • sensors: ReadOnlyList[Sensor] - All sensors.
  • science: ReadOnlyList[PartScience] - [WIP] All science modules.
  • id: Guid - Unique identifier of the ship (vehicle/vessel). Can change when docking/undocking.
  • persistentId: uint - Unique identifier of the ship (vehicle/vessel). Should be same as it was before docking (after undocking).
  • vesseltype: VesselType - KSP API. Vessel type as selected by user (or automatically).
  • mass: double - Total mass of the ship (vehicle/vessel). [tons = 1000 kg]
  • packed: bool - Wheter the ship is still packed (reduced physics).
  • landed: bool - Wheter the ship is landed (on the ground or on/in water).
  • splashed: bool - Wheter the ship is in water.
  • prelaunch: bool - Ship is on launch-pad.
  • situation: Situations - KSP API. Current situation.
  • longitude: double - Longitude of current position in degrees.
  • latitude: double - Latitude of current position in degrees.
  • altitude: double - Altitude of current position (above sea level) in meters.
  • radarAltitude: double - True height above ground in meters.
  • dynamicPressure: double - Dynamic pressure [atm = 101.325kPa]
  • q: double - Dynamic pressure [atm = 101.325kPa]
  • body: SpaceBody - Orbited body.
  • orbit: OrbitInfo - [WIP] Orbit parameters.
  • period: TimeDelta - Period of current orbit in seconds. Alias to orbit.period.
  • timeToAp: TimeDelta - Eta to apoapsis in seconds. Alias to orbit.timeToAp.
  • timeToPe: TimeDelta - Eta to periapsis in seconds. Alias to orbit.timeToPe.
  • timeAtAp: TimeStamp - Time at apoapsis. Alias to orbit.timeAtAp.
  • timeAtPe: TimeStamp - Time at periapsis. Alias to orbit.timeAtPe.
  • eccentricity: double - Eccentricity of current orbit. [0, +inf)
  • inclination: double - Inclination of current orbit. [0, 180)
  • semiMajorAxis: double - Semi-major axis of current orbit.
  • semiMinorAxis: double - Semi-minor axis of current orbit.
  • apoapsis: double - Height above ground of highest point of current orbit.
  • periapsis: double - Height above ground of lowest point of current orbit.
  • apocenter: double - Highest distance between center of orbited body and any point of current orbit. (1 + eccentricity) * semiMajorAxis
  • pericenter: double - Lowest distance between center of orbited body and any point of current orbit. (1 - eccentricity) * semiMajorAxis
  • trueAnomaly: double - Angle in degrees between the direction of periapsis and the current position. Zero at periapsis, 180 at apoapsis.
  • meanAnomaly: double - Angle in degrees between the direction of periapsis and the current position extrapolated on circular orbit.
  • lan: double - Longitude of ascending node.
  • argumentOfPeriapsis: double - Argument of periapsis. Angle from ascending node to periapsis.
  • aop: double - Argument of periapsis. Angle from ascending node to periapsis.
  • position: Vector - Center of mass relative to (CoM of) active ship (zero for active ship).
  • velocity: Vector - Current orbital velocity.
  • surfaceVelocity: Vector - Current surface velocity.
  • srfVelocity: Vector - Current surface velocity (Alias to surfaceVelocity).
  • srfvel: Vector - Current surface velocity (Alias to surfaceVelocity).
  • forward: Vector - Vector pointing forward (from cockpit - in the direction of the 'nose').
  • back: Vector - Vector pointing backward (from cockpit - in the direction of the 'tail').
  • up: Vector - Vector pointing up (from cockpit).
  • down: Vector - Vector pointing down (from cockpit).
  • left: Vector - Vector pointing left (from cockpit).
  • right: Vector - Vector pointing right (from cockpit).
  • north: Vector - Vector pointing north in the plane that is tangent to sphere centered in orbited body.
  • east: Vector - Vector pointing east (tangent to sphere centered in orbited body).
  • away: Vector - Vector pointing away from orbited body (aka up, but we use up for cockpit-up).
  • pitch: double - Current pitch / elevation (the angle between forward vector and tangent plane) [-90..+90]
  • heading: double - Current heading / yaw (the angle between forward and north vectors in tangent plane) [0..360]. Note that it can change violently around the poles.
  • roll: double - Current roll / bank (the angle between up and away vectors in the plane perpendicular to forward vector) [-180..+180]. Note that it can change violently when facing up or down.
  • angularVelocity: Vector - Angular velocity [ω, deg/s], how fast the ship rotates
  • angularMomentum: Vector - Angular momentum [L = Iω, kg⋅m²⋅deg/s=N⋅m⋅s⋅deg] aka moment of momentum or rotational momentum.
  • momentOfInertia: Vector - Moment of inertia [I, kg⋅m²=N⋅m⋅s²] aka angular mass or rotational inertia.
  • maxTorque: Vector - Maximal ship torque [N⋅m⋅deg=deg⋅kg⋅m²/s²] (aka moment of force or turning effect, maximum of positive and negative).
  • maxVacuumTorque: Vector - Maximal ship torque in vacuum [N⋅m⋅deg=deg⋅kg⋅m²/s²] (ignoring control surfaces).
  • maxAngular: Vector - Maximal angular acceleration. [deg/s²]
  • maxVacuumAngular: Vector - Maximal angular acceleration in vacuum (ignoring control surfaces).
  • sas: bool - SAS: Stability Assist System.
  • rcs: bool - RCS: Reaction Control System.

Instance Methods:

  • orbitAt(): OrbitInfo, time TimeStamp
    • [WIP] Get orbit info relevant for given time. See orbit.png.
  • positionAt(): Vector, time TimeStamp
    • [WIP] Predicted position at specified time. Includes the movement of bodies (e.g. Mun or Ike) when ship is currently orbiting the (grand)parent (e.g. Kerbin or Sun/Kerbol). This method is trying to be reasonably smooth/continuous, use orbitAt(time).positionAt(time) if that is not desired. See orbit.png.
  • velocityAt(): Vector, time TimeStamp
    • [WIP] Predicted velocity at specified time. Includes the movement of bodies (e.g. Mun or Ike) when ship is currently orbiting the (grand)parent (e.g. Kerbin or Sun/Kerbol). This method is trying to be reasonably smooth/continuous, use orbitAt(time).velocityAt(time) if that is not desired. See orbit.png.
  • local(): Vector, v Vector
    • Translate vector/direction into ship-local coordinates (like looking at it from the cockpit - or rather from the controlling part).
  • world(): Vector, v Vector
    • Translate vector/direction into world coordinates (reverse the local transformation).
  • timeAtTrueAnomaly(): TimeStamp, trueAnomaly double
    • [WIP] Get time at true anomaly (absolute time of angle from direction of periapsis).
  • timeToTrueAnomaly(): TimeDelta, trueAnomaly double
    • [WIP] Get time to true anomaly (relative time of angle from direction of periapsis). [0, period)