Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
Vessel Class Reference

Vessels define individual ships in flight. They work essentially as a header for the set of parts that make up the ship. More...

Inheritance diagram for Vessel:
IShipconstruct ITargetable IDiscoverable

Public Types

enum  ControlLevel { ControlLevel.NONE, ControlLevel.PARTIAL_UNMANNED, ControlLevel.PARTIAL_MANNED, ControlLevel.FULL }
 
enum  Situations {
  Situations.LANDED = 1, Situations.SPLASHED = 2, Situations.PRELAUNCH = 4, Situations.FLYING = 8,
  Situations.SUB_ORBITAL = 16, Situations.ORBITING = 32, Situations.ESCAPING = 64, Situations.DOCKED = 128
}
 
enum  State { State.INACTIVE, State.ACTIVE, State.DEAD }
 

Public Member Functions

bool ActionControlBlocked (KSPActionGroup actionGroup)
 Check if a default vessel control action (staging, RCS, SAS) is blocked More...
 
void AttachPatchedConicsSolver ()
 
bool AxisControlBlocked (KSPAxisGroup axisGroup)
 Check if a default vessel control axis (throttle, PYR, etc) is blocked More...
 
ProtoVessel BackupVessel ()
 
void BuildCrossfeedPartSets ()
 
void ChangeWorldVelocity (Vector3d velOffset)
 change the worldspace velocity of this vessel More...
 
void CheckAirstreamShields ()
 Will check shielding on all parts in the vessel. More...
 
bool CheckGroundCollision ()
 
void CheckKill ()
 
bool checkLanded ()
 
bool checkSplashed ()
 
bool checkVisibility ()
 Returns true if this vessel is within the visible range of any commandable (focusable) vessel, false otherwise. More...
 
void Clean (string reason="")
 
void ClearActiveInternalSpace ()
 Sets all internal spaces in the vessel invisible More...
 
void ClearStaging ()
 
bool ContainsCollider (Collider c)
 Checks colliders on all parts to see if the given one belongs to any of them. More...
 
void CopyOverrides (Vessel v)
 
void CrewListSetDirty ()
 
void CycleAllAutoStrut ()
 
void DespawnCrew ()
 
void DestroyVesselComponents ()
 
void DetachPatchedConicsSolver ()
 
void Die ()
 
void FallBackReferenceTransform ()
 
void FeedInputFeed ()
 
VesselType FindDefaultVesselType ()
 
FindPartModuleImplementing< T > ()
 
List< T > FindPartModulesImplementing< T > ()
 
FindVesselModuleImplementing< T > ()
 Find the vesselmodule on this vessel of the supplied type More...
 
List< PartGetActiveParts ()
 
bool GetActiveTargetable ()
 
void GetConnectedResourceTotals (int id, out double amount, out double maxAmount, bool pulling=true)
 Gets the amount and maxamount of the given resource in the partset More...
 
void GetConnectedResourceTotals (int id, bool simulate, out double amount, out double maxAmount, bool pulling=true)
 Gets the amount and maxamount of the given resource in the partset More...
 
void GetConnectedResourceTotals (int id, out double amount, out double maxAmount, double threshold, bool pulling=true)
 Gets the amount and maxamount of the given resource in the partset, obeying threshold More...
 
void GetConnectedResourceTotals (int id, bool simulate, out double amount, out double maxAmount, double threshold, bool pulling=true)
 Gets the amount and maxamount of the given resource in the partset, obeying threshold More...
 
void GetControlState (FlightCtrlState state)
 
int GetCrewCapacity ()
 
int GetCrewCount ()
 
Orbit GetCurrentOrbit ()
 
string GetDisplayName ()
 Returns the localized string of the vesselName. More...
 
Vector3 GetFwdVector ()
 
virtual void GetGroundLevelAngle ()
 Calculates the angle of the surface the vessel is in More...
 
float GetHeightFromSurface ()
 Get the Vessel height from the surface. Similar to GetHeightFromTerrain but checks against all surfaces. Sets heightFromSurface to the vessel height as well. Or -1 if not found. More...
 
float GetHeightFromTerrain (bool overRidePacked=false)
 Get the height of the vesselTransform from the terrain. Should only be done when vessel is loaded and unpacked. Will set heightFromTerrain to the vessel height. Or -1 if not found. More...
 
RaycastHit GetHitFromSurface ()
 Obtains the raycast hit from the vessel to the surface. More...
 
string GetName ()
 
Vector3 GetObtVelocity ()
 
Orbit GetOrbit ()
 
OrbitDriver GetOrbitDriver ()
 
Part GetReferenceTransformPart ()
 
Vector3 GetSrfVelocity ()
 
VesselTargetModes GetTargetingMode ()
 
float GetTotalMass ()
 Get the sum of the mass of all (physical) parts on this vessel More...
 
Transform GetTransform ()
 
Vessel GetVessel ()
 
List< ProtoCrewMemberGetVesselCrew ()
 
Vector3d GetWorldPos3D ()
 Get a double precision vector for the vessel's worldspace position (for when transform.position isn't accurate enough) More...
 
void GoOffRails ()
 puts the ship back into a simulated orbit and reenables physics More...
 
void GoOnRails ()
 disables physics and puts the ship into a propagated orbit More...
 
bool HasValidContractObjectives (params string[] objectiveTypes)
 
bool HasValidContractObjectives (List< string > objectiveTypes, bool copy=true)
 
void IgnoreGForces (int frames)
 Set the number of FixedUpdate Frames to ignore GeeForce Calcs. More...
 
void IgnoreSpeed (int frames)
 Set the number of FixedUpdate Frames to ignore Speed Calcs. More...
 
bool Initialize (bool fromShipAssembly=false)
 Initialize is used in cases where the Vessel component is added to a ship that already exists. More...
 
ClearToSaveStatus IsClearToSave ()
 
bool IsFirstFrame ()
 
void KillPermanentGroundContact ()
 
void Load ()
 
void LoadVesselModules (ConfigNode node)
 
void MakeActive ()
 
void MakeInactive ()
 
void MurderCrew ()
 
void OffsetVelocity (Vector3d correction)
 
void OnDestroy ()
 
void OnLoadFlightState (Dictionary< string, KSPParseable > dataPool)
 
void OnSaveFlightState (Dictionary< string, KSPParseable > dataPool)
 
Part PartsContain (uint partPersistentId)
 Will search the parts in this vessel for a matching part persistentId. If found will return the part reference. Otherwise will return null. More...
 
double PQSAltitude ()
 
void printCollisions ()
 
void printGroundContacts ()
 
void RebuildCrewList ()
 
void RecallReferenceTransform ()
 
bool RemoveCrew (ProtoCrewMember pcm)
 
bool RemoveCrew (string name)
 
void RemoveCrewList (List< ProtoCrewMember > pcmList, bool updatePartCount)
 
void RenameVessel ()
 
double RequestResource (Part part, int id, double demand, bool usePriority)
 Request a resource from across the vessel. More...
 
double RequestResource (Part part, int id, double demand, bool usePriority, bool simulate)
 Request a resource from across the vessel. More...
 
void ResetCollisionIgnores ()
 
void ResetGroundContact ()
 
void ResetRBAnchor ()
 Destroys the joint that holds the vessel anchored in place More...
 
void ResumeNavigation ()
 Method called when vessel goes active, we need to start a coroutine while we wait for the contractsystem to be loaded More...
 
void ResumeStaging ()
 
void ResumeTarget ()
 
double RevealAltitude ()
 
string RevealDisplayName ()
 
float RevealMass ()
 
string RevealName ()
 
string RevealSituationString ()
 
double RevealSpeed ()
 
string RevealType ()
 
void SetActiveInternalSpace (Part visiblePart)
 Sets the internal space for the given part visible (and all others invisible) More...
 
void SetActiveInternalSpaces (HashSet< Part > visibleParts)
 Sets the internal spaces for the given parts visible, other IVA spaces in the same vesesl become invisible More...
 
void SetAutoClean (string reason="")
 
void SetControlState (FlightCtrlState state)
 
void SetGroupOverride (int newGroup)
 
void SetLandedAt (string landedAt, GameObject gO=null, string inputdisplaylandedAt="")
 Set the LandedAt and displaylandedAt variables. an optional GameObject and an optional inputdisplaylandedAt string can be passed in. The landedAt field will be set to the passed in landedAt string. If an inputdisplaylandedAt string is passed in then the displaylandedAt string is set to this string (Usually localized language). If the inputdisplaylandedAt is empty and a GameObject is supplied the GameObject Unity Tag will be used to lookup a MiniBiome name. If no inputdisplaylandedAt or GameObject are passed in the displaylandedAt field is set to the landedAt field. More...
 
void SetLoaded (bool loaded)
 
void SetPosition (Vector3d position)
 
void SetPosition (Vector3d position, bool usePristineCoords)
 Sets the worldspace position of this vessel, and all its parts More...
 
void SetReferenceTransform (Part p, bool storeRecall=true)
 
void SetRotation (Quaternion rotation)
 Sets the worldspace rotation of this vessel, and all its parts More...
 
void SetRotation (Quaternion rotation, bool setPos)
 Sets the worldspace rotation of this vessel, and all its parts. Accepts bool on whether to reset pos (leave false if pos is set elsewhere) More...
 
void SetWorldVelocity (Vector3d vel)
 set the absolute world velocity of this vessel More...
 
void SpawnCrew ()
 
void StartFromBackup (ProtoVessel pv)
 Start from backup is used when the scene is being resumed, and the Vessel component is added before the parts themselves. Note that this method won't load the parts. It only creates the vessel object. To load parts, use the Vessel.Load() method. More...
 
void StartFromBackup (ProtoVessel pv, FlightState st)
 Start from backup is used when the scene is being resumed, and the Vessel component is added before the parts themselves. Note that this method won't load the parts. It only creates the vessel object. To load parts, use the Vessel.Load() method. More...
 
void Translate (Vector3d offset)
 
void Unload ()
 
void UpdateAcceleration (double fdtRecip, bool fromUpdate)
 
void UpdateCaches ()
 
void UpdateDistanceTraveled ()
 Updates the distance traveled of this vessel More...
 
void UpdateLandedSplashed ()
 
void UpdatePosVel ()
 
void UpdateResourceSets ()
 Clears dirty flag and updates the vessel and the crossfeed sets More...
 
void UpdateResourceSetsIfDirty ()
 Will update only if dirty. More...
 
void UpdateVesselModuleActivation ()
 
void UpdateVesselSize ()
 Update the bounds of the vessel. More...
 

Static Public Member Functions

static string AutoRename (Vessel v, string baseName)
 
static void CrewWasModified (Vessel vessel)
 
static void CrewWasModified (Vessel vessel1, Vessel vessel2)
 
static Vessel GetDominantVessel (Vessel v1, Vessel v2)
 Find the dominant vessel on a dock situation. The dominant vessel will have the secondary merged into it. More...
 
static string GetLandedAtString (string landedAt)
 Get the landedAt string in English More...
 
static string GetMETString (Vessel v)
 
static double GetNextManeuverTime (Vessel v, out bool hasManeuver)
 
static string GetSituationString (Situations situation)
 
static string GetSituationString (Vessel v)
 Get the Situation String, Will be Localized More...
 
static bool IsValidVesselName (string name)
 

Public Attributes

Vector3d acceleration
 
AltimeterDisplayState altimeterDisplayState = AltimeterDisplayState.DEFAULT
 
double altitude
 
Vector3 angularMomentum = Vector3.zero
 
Vector3 angularVelocity = Vector3.zero
 
Vector3d angularVelocityD = Vector3d.zero
 
Vector3 CoM
 
Vector3d CoMD
 
CommNetVessel connection
 
double convectiveMachFlux
 
int crewableParts = 0
 
int crewedParts = 0
 
List< PartSetcrossfeedSets = new List<PartSet>()
 all the crossfeed (i.e. non-vessel-wide) sets on the vessel More...
 
FlightCtrlState ctrlState
 
int currentStage
 
bool directSunlight
 
string displaylandedAt = ""
 A string of where the vessel is landed in Localized language. More...
 
double distanceTraveled
 Protopart snapshot Dictionary (keyed by part persistentId) of the parts that will get drained when vessel is packed More...
 
List< PartModuledockingPorts = new List<PartModule>()
 
bool easingInToSurface
 
bool EditableNodes
 
KerbalEVA evaController
 
ConfigNode flightPlanNode
 
RUI.Algorithms.StackFlowGraph flowGraph
 a holder for the flowgraph More...
 
bool frameWasRotating = false
 
double geeForce
 
Vector3d graviticAcceleration
 
List< PartGroundContacts
 
int GroupOverride
 Action/axis group override selector More...
 
float gThresh
 
double heightFromPartOffsetLocal = 0d
 
float heightFromSurface = -1f
 
float heightFromTerrain = -1f
 
Guid id
 Unique identifier for each vessel. More...
 
Vector3d krakensbaneAcc
 
bool Landed
 
string landedAt = ""
 A string of where the vessel is landed in English. More...
 
string landedAtLast = ""
 
CelestialBody lastBody
 
double lastUT = -1
 for use in FI when checking if vessel has spent time unloaded. More...
 
Vector3d lastVel
 
double latitude
 
string launchedFrom = ""
 Will contain the Launch Site Name that this vessel launched from. If indeed it did launch from a launch site. More...
 
double launchTime
 
bool loaded = false
 
Vector3 localCoM
 This is used for persistence purposes. Use findLocalCenterOfMass() if you just want the center of mass. More...
 
double longitude
 
double mach
 
MapObject mapObject
 
ControlLevel maxControlLevel = ControlLevel.FULL
 
double missionTime
 
Waypoint navigationWaypoint
 the active navigation waypoint for this vessel More...
 
GameObject objectUnderVessel
 
double obt_speed
 
Vector3d obt_velocity
 
FlightInputCallback OnAutopilotUpdate = (FlightCtrlState st) => { }
 
FlightInputCallback OnFlyByWire = (FlightCtrlState st) => { }
 pass the control state from the scene handler to this vessel. More...
 
Callback OnJustAboutToBeDestroyed = () => { }
 
FlightInputCallback OnPostAutopilotUpdate = (FlightCtrlState st) => { }
 
FlightInputCallback OnPreAutopilotUpdate = (FlightCtrlState st) => { }
 
OrbitDriver orbitDriver
 
OrbitRenderer orbitRenderer
 
OrbitTargeter orbitTargeter
 
KSPActionGroup[] OverrideActionControl
 
KSPAxisGroup[] OverrideAxisControl
 
bool[] OverrideDefault
 
string[] OverrideGroupNames
 
bool packed
 landing / splashdown detection More...
 
double partMaxGThresh
 
List< Partparts
 
PatchedConicRenderer patchedConicRenderer
 
PatchedConicSolver patchedConicSolver
 
bool permanentGroundContact
 
uint persistentId
 A unique identifier for each vessel including from when it was Shipconstruct More...
 
Vector3d perturbation
 
double pqsAltitude
 
int PQSmaxLevel = 0
 
int PQSminLevel = 0
 
VesselPrecalculate precalc
 
float presThresh
 
ProtoVessel protoVessel
 
ProtoTargetInfo pTI = null
 
double radarAltitude
 
Vector3 rb_velocity
 
Vector3d rb_velocityD
 
uint referenceTransformId
 
uint referenceTransformIdRecall
 
PartSet resourcePartSet
 The vessel partset. More...
 
bool resourcesDirty = false
 We set the dirty flag if we're waiting. More...
 
Part rootPart
 
FlightCtrlState[] setControlStates
 
List< PartSetsimulationCrossfeedSets = new List<PartSet>()
 all the Delta-V simulation crossfeed (i.e. non-vessel-wide) sets on the vessel More...
 
PartSet simulationResourcePartSet
 The vessel Delta-V simulation partset. More...
 
Situations situation
 
bool skipGroundPositioning = false
 True if this Vessel is to skip vessel ground checks. Will also be set true if the vessel was launched from a LaunchSite. If true Vessel will skip ground repositioning when coming off rails. More...
 
bool skipGroundPositioningForDroppedPart = false
 True if this Vessel is a single part vessel and should skip vessel ground checks. skipGroundPositioning will overridden a single part vessel if this is false If true Vessel will skip ground repositioning when coming off rails. More...
 
double specificAcceleration
 Specific acceleration is the vessel's potential acceleration per unit of throttle. Used to estimate burn times and such. NOTE: this value is calculated based on smoothed acceleration, so it isn't completely accurate. It will also change as the vessel's mass is reduced as fuel burns away. (it does get pretty accurate after burning for a few seconds) More...
 
Quaternion srfRelRotation
 
State state = State.INACTIVE
 
ITargetable targetObject
 
double terrainAltitude
 
Vector3 terrainNormal
 
double totalMass
 
Vector3d up
 
Vector3d upAxis
 
bool updateResourcesOnEvent = true
 do we update immediately on event, or wait until the end of a series of modify events (i.e. vessel instantiation or decoupling) More...
 
Vector3d velocityD
 
double verticalSpeed
 
VesselDeltaV VesselDeltaV
 This is the VesselDeltaV instance for this ShipConstruct. More...
 
List< VesselModulevesselModules = new List<VesselModule>()
 
string vesselName
 Beware this could be a localization Tag - Not localized. It's better to use GetDisplayName() to get the localized displayable vessel name for UI purposes. More...
 
VesselRanges vesselRanges
 
Vector3 vesselSize
 Bounds for the vessel More...
 
bool vesselSpawning = true
 True if this Vessel has just spawned into the game and hasn't had ground checks done. More...
 
Transform vesselTransform
 
VesselType vesselType = VesselType.Debris
 
double waterOffset = 0d
 

Static Public Attributes

static double HeightFromPartOffsetGlobal = 0.5d
 
static int NumOverrideGroups = 4
 Number of override groups available (does not include the default group) More...
 
static bool PartialControlHasSASRCS = true
 
static List< string > VesselAnchorExceptions
 List of module classes that should not be anchored More...
 
static double warningThresholdG = 0.8d
 

Protected Member Functions

void onCrewTransferred (GameEvents.HostedFromToAction< ProtoCrewMember, Part > data)
 

Protected Attributes

List< ProtoCrewMembercrew = new List<ProtoCrewMember>()
 
int crewCachedPartCount = -1
 

Properties

ActionGroupList ActionGroups [get]
 
bool AutoClean [get]
 
string AutoCleanReason [get]
 
VesselAutopilot Autopilot [get]
 
Situations BestSituation [get]
 
CometVessel Comet [get, set]
 
CommNetVessel Connection [get, set]
 
Vector3 CurrentCoM [get]
 
ControlLevel CurrentControlLevel [get]
 
DiscoveryInfo DiscoveryInfo [get]
 
float distanceLandedPackThreshold [get, set]
 
float distanceLandedUnpackThreshold [get, set]
 
float distancePackThreshold [get, set]
 
float distanceUnpackThreshold [get, set]
 
Vessel EVALadderVessel [get]
 
float GroundLevelAngle [get]
 Angle of surface the Vessel is at currently, a negative value means it is initialized More...
 
RaycastHit HeightFromSurfaceHit [get]
 
bool HoldPhysics [get]
 
int IgnoreCollisionsFrames [get]
 
bool IgnoreSpeedActive [get]
 Returns True if the vessel is ignoring Speed calcs. - Used after Set Position cheat is fired. More...
 
bool isActiveVessel [get]
 
bool IsAnchored [get]
 
bool isCommandable [get]
 
bool IsControllable [get]
 True if the vessel has at least one operational control source and is active (focused). More...
 
bool isEVA [get]
 
bool isPersistent [get, set]
 
bool IsRecoverable [get]
 
bool LandedInKSC [get]
 Returns true if vessel is landed at the KSC Launchpad or Runway. More...
 
bool LandedInStockLaunchSite [get]
 Returns true if vessel is landed at one of the stock Launch Sites. More...
 
bool LandedOrSplashed [get]
 
static float loadDistance [get, set]
 
CelestialBody mainBody [get]
 
Orbit orbit [get]
 
List< PartParts [get]
 
bool PatchedConicsAttached [get, set]
 
Transform ReferenceTransform [get]
 The reference transform is used to define the orientation of a vessel for controls and gauges. It defines which way is 'up' or 'forward' or which way pitch rotates, for instance. Read only. Use SetReferenceTransform to set. Defaults to vessel transform if no other transform is set. More...
 
string SituationString [get]
 Returns the Localized Vessel situation String More...
 
SuspensionLoadBalancer suspensionLoadBalancer [get, set]
 This is the Vessel Module that distributes the vessels mass across all suspension/wheels on the vessel. More...
 
Part this[int index] [get]
 
Part this[uint flightID] [get]
 
static float unloadDistance [get, set]
 
Vessel VesselSurface [get, set]
 If this vessel is over another vessel, this property will be set More...
 
VesselValues VesselValues [get]
 
- Properties inherited from IShipconstruct
List< PartParts [get]
 
- Properties inherited from IDiscoverable
DiscoveryInfo DiscoveryInfo [get]
 

Detailed Description

Vessels define individual ships in flight. They work essentially as a header for the set of parts that make up the ship.

Member Enumeration Documentation

Enumerator
NONE 
PARTIAL_UNMANNED 
PARTIAL_MANNED 
FULL 
Enumerator
LANDED 
SPLASHED 
PRELAUNCH 
FLYING 
SUB_ORBITAL 
ORBITING 
ESCAPING 
DOCKED 
Enumerator
INACTIVE 
ACTIVE 
DEAD 

Member Function Documentation

bool Vessel.ActionControlBlocked ( KSPActionGroup  actionGroup)
inline

Check if a default vessel control action (staging, RCS, SAS) is blocked

void Vessel.AttachPatchedConicsSolver ( )
inline
static string Vessel.AutoRename ( Vessel  v,
string  baseName 
)
inlinestatic
bool Vessel.AxisControlBlocked ( KSPAxisGroup  axisGroup)
inline

Check if a default vessel control axis (throttle, PYR, etc) is blocked

ProtoVessel Vessel.BackupVessel ( )
inline
void Vessel.BuildCrossfeedPartSets ( )
inline
void Vessel.ChangeWorldVelocity ( Vector3d  velOffset)
inline

change the worldspace velocity of this vessel

Parameters
vel
void Vessel.CheckAirstreamShields ( )
inline

Will check shielding on all parts in the vessel.

bool Vessel.CheckGroundCollision ( )
inline
void Vessel.CheckKill ( )
inline
bool Vessel.checkLanded ( )
inline
bool Vessel.checkSplashed ( )
inline
bool Vessel.checkVisibility ( )
inline

Returns true if this vessel is within the visible range of any commandable (focusable) vessel, false otherwise.

void Vessel.Clean ( string  reason = "")
inline
void Vessel.ClearActiveInternalSpace ( )
inline

Sets all internal spaces in the vessel invisible

void Vessel.ClearStaging ( )
inline
bool Vessel.ContainsCollider ( Collider  c)
inline

Checks colliders on all parts to see if the given one belongs to any of them.

Parameters
c
Returns
void Vessel.CopyOverrides ( Vessel  v)
inline
void Vessel.CrewListSetDirty ( )
inline
static void Vessel.CrewWasModified ( Vessel  vessel)
inlinestatic
static void Vessel.CrewWasModified ( Vessel  vessel1,
Vessel  vessel2 
)
inlinestatic
void Vessel.CycleAllAutoStrut ( )
inline

< Cycle any auto-struts

void Vessel.DespawnCrew ( )
inline
void Vessel.DestroyVesselComponents ( )
inline
void Vessel.DetachPatchedConicsSolver ( )
inline
void Vessel.Die ( )
inline
void Vessel.FallBackReferenceTransform ( )
inline
void Vessel.FeedInputFeed ( )
inline
VesselType Vessel.FindDefaultVesselType ( )
inline
T Vessel.FindPartModuleImplementing< T > ( )
inline
Type Constraints
T :class 
List<T> Vessel.FindPartModulesImplementing< T > ( )
inline
Type Constraints
T :class 
T Vessel.FindVesselModuleImplementing< T > ( )
inline

Find the vesselmodule on this vessel of the supplied type

Template Parameters
TType to find
Returns
The vesselModule
Type Constraints
T :class 
List<Part> Vessel.GetActiveParts ( )
inline
bool Vessel.GetActiveTargetable ( )
inline

Implements ITargetable.

void Vessel.GetConnectedResourceTotals ( int  id,
out double  amount,
out double  maxAmount,
bool  pulling = true 
)
inline

Gets the amount and maxamount of the given resource in the partset

Parameters
idthe hash of the resource
amountavailable amount will be stored here (will be headroom if pulling==false)
maxAmountmax possible amount will be stored here
pullingare we planning to push or pull resources from the parts
void Vessel.GetConnectedResourceTotals ( int  id,
bool  simulate,
out double  amount,
out double  maxAmount,
bool  pulling = true 
)
inline

Gets the amount and maxamount of the given resource in the partset

Parameters
idthe hash of the resource
simulateSet to true to use the simulationResourcePartSet
amountavailable amount will be stored here (will be headroom if pulling==false)
maxAmountmax possible amount will be stored here
pullingare we planning to push or pull resources from the parts
void Vessel.GetConnectedResourceTotals ( int  id,
out double  amount,
out double  maxAmount,
double  threshold,
bool  pulling = true 
)
inline

Gets the amount and maxamount of the given resource in the partset, obeying threshold

Parameters
idthe hash of the resource
amountavailable amount will be stored here (will be headroom if pulling==false)
maxAmount>max possible amount will be stored here
threshold
pullingare we planning to push or pull resources from the parts
void Vessel.GetConnectedResourceTotals ( int  id,
bool  simulate,
out double  amount,
out double  maxAmount,
double  threshold,
bool  pulling = true 
)
inline

Gets the amount and maxamount of the given resource in the partset, obeying threshold

Parameters
idthe hash of the resource
simulateSet to true to use the simulationResourcePartSet
amountavailable amount will be stored here (will be headroom if pulling==false)
maxAmount>max possible amount will be stored here
threshold
pullingare we planning to push or pull resources from the parts
void Vessel.GetControlState ( FlightCtrlState  state)
inline
int Vessel.GetCrewCapacity ( )
inline
int Vessel.GetCrewCount ( )
inline
Orbit Vessel.GetCurrentOrbit ( )
inline
string Vessel.GetDisplayName ( )
inline

Returns the localized string of the vesselName.

Returns

Implements ITargetable.

static Vessel Vessel.GetDominantVessel ( Vessel  v1,
Vessel  v2 
)
inlinestatic

Find the dominant vessel on a dock situation. The dominant vessel will have the secondary merged into it.

Parameters
v1
v2
Returns
Vector3 Vessel.GetFwdVector ( )
inline

Implements ITargetable.

virtual void Vessel.GetGroundLevelAngle ( )
inlinevirtual

Calculates the angle of the surface the vessel is in

float Vessel.GetHeightFromSurface ( )
inline

Get the Vessel height from the surface. Similar to GetHeightFromTerrain but checks against all surfaces. Sets heightFromSurface to the vessel height as well. Or -1 if not found.

Returns
the vessel height from the surface
float Vessel.GetHeightFromTerrain ( bool  overRidePacked = false)
inline

Get the height of the vesselTransform from the terrain. Should only be done when vessel is loaded and unpacked. Will set heightFromTerrain to the vessel height. Or -1 if not found.

Parameters
overRidePackedIf true will override the Vessel.packed check.
Returns
the vessel height
RaycastHit Vessel.GetHitFromSurface ( )
inline

Obtains the raycast hit from the vessel to the surface.

Returns
The raycast hit from the vessel to the surface
static string Vessel.GetLandedAtString ( string  landedAt)
inlinestatic

Get the landedAt string in English

Parameters
landedAt
Returns
LandedAt string in English with spaces
static string Vessel.GetMETString ( Vessel  v)
inlinestatic
string Vessel.GetName ( )
inline

Implements ITargetable.

static double Vessel.GetNextManeuverTime ( Vessel  v,
out bool  hasManeuver 
)
inlinestatic

< Generally this is only loaded vessels, but just check for the presence of a solver to allow it to fallback on the flightPlanNode.

Vector3 Vessel.GetObtVelocity ( )
inline

Implements ITargetable.

Orbit Vessel.GetOrbit ( )
inline

Implements ITargetable.

OrbitDriver Vessel.GetOrbitDriver ( )
inline

Implements ITargetable.

Part Vessel.GetReferenceTransformPart ( )
inline
static string Vessel.GetSituationString ( Situations  situation)
inlinestatic
static string Vessel.GetSituationString ( Vessel  v)
inlinestatic

Get the Situation String, Will be Localized

Parameters
v
Returns
Vector3 Vessel.GetSrfVelocity ( )
inline

Implements ITargetable.

VesselTargetModes Vessel.GetTargetingMode ( )
inline

Implements ITargetable.

float Vessel.GetTotalMass ( )
inline

Get the sum of the mass of all (physical) parts on this vessel

Returns

< if (p.physicalSignificance != Part.PhysicalSignificance.FULL) continue;

< CJ Adding resources Support

Transform Vessel.GetTransform ( )
inline

Implements ITargetable.

Vessel Vessel.GetVessel ( )
inline

Implements ITargetable.

List<ProtoCrewMember> Vessel.GetVesselCrew ( )
inline
Vector3d Vessel.GetWorldPos3D ( )
inline

Get a double precision vector for the vessel's worldspace position (for when transform.position isn't accurate enough)

Returns
void Vessel.GoOffRails ( )
inline

puts the ship back into a simulated orbit and reenables physics

< can't unpack unloaded vessels

< don't unpack landed vessels if the planet is actually spinning.

void Vessel.GoOnRails ( )
inline

disables physics and puts the ship into a propagated orbit

bool Vessel.HasValidContractObjectives ( params string[]  objectiveTypes)
inline
bool Vessel.HasValidContractObjectives ( List< string >  objectiveTypes,
bool  copy = true 
)
inline
void Vessel.IgnoreGForces ( int  frames)
inline

Set the number of FixedUpdate Frames to ignore GeeForce Calcs.

Parameters
frames
void Vessel.IgnoreSpeed ( int  frames)
inline

Set the number of FixedUpdate Frames to ignore Speed Calcs.

Parameters
frames
bool Vessel.Initialize ( bool  fromShipAssembly = false)
inline

Initialize is used in cases where the Vessel component is added to a ship that already exists.

Parameters
fromShipAssemblyset to true if Vessel is being initialized from a ShipAssembly (ShipConstruct) to Launch. Sets vessel position and orbit differently
ClearToSaveStatus Vessel.IsClearToSave ( )
inline
bool Vessel.IsFirstFrame ( )
inline
static bool Vessel.IsValidVesselName ( string  name)
inlinestatic
void Vessel.KillPermanentGroundContact ( )
inline
void Vessel.Load ( )
inline

< correct altitude based on PQS nominal height for the current lat/lon

void Vessel.LoadVesselModules ( ConfigNode  node)
inline
void Vessel.MakeActive ( )
inline
void Vessel.MakeInactive ( )
inline

< Kill any targeting.

void Vessel.MurderCrew ( )
inline
void Vessel.OffsetVelocity ( Vector3d  correction)
inline
void Vessel.onCrewTransferred ( GameEvents.HostedFromToAction< ProtoCrewMember, Part data)
inlineprotected
void Vessel.OnDestroy ( )
inline
void Vessel.OnLoadFlightState ( Dictionary< string, KSPParseable dataPool)
inline
void Vessel.OnSaveFlightState ( Dictionary< string, KSPParseable dataPool)
inline
Part Vessel.PartsContain ( uint  partPersistentId)
inline

Will search the parts in this vessel for a matching part persistentId. If found will return the part reference. Otherwise will return null.

Parameters
partPersistentId
Returns
double Vessel.PQSAltitude ( )
inline
void Vessel.printCollisions ( )
inline
void Vessel.printGroundContacts ( )
inline
void Vessel.RebuildCrewList ( )
inline
void Vessel.RecallReferenceTransform ( )
inline
bool Vessel.RemoveCrew ( ProtoCrewMember  pcm)
inline
bool Vessel.RemoveCrew ( string  name)
inline
void Vessel.RemoveCrewList ( List< ProtoCrewMember pcmList,
bool  updatePartCount 
)
inline

< We'll track how many crew we remove from the main list

void Vessel.RenameVessel ( )
inline
double Vessel.RequestResource ( Part  part,
int  id,
double  demand,
bool  usePriority 
)
inline

Request a resource from across the vessel.

Parameters
partThe part requesting the pull/push of the resource
idthe hash of the resource
demandthe demand in units, positive means draw (pull), negative means push
usePrioritydraw in staging order
Returns
double Vessel.RequestResource ( Part  part,
int  id,
double  demand,
bool  usePriority,
bool  simulate 
)
inline

Request a resource from across the vessel.

Parameters
partThe part requesting the pull/push of the resource
idthe hash of the resource
demandthe demand in units, positive means draw (pull), negative means push
usePrioritydraw in staging order
simulateSet to true to use the simulationResourcePartSet
Returns
void Vessel.ResetCollisionIgnores ( )
inline
void Vessel.ResetGroundContact ( )
inline
void Vessel.ResetRBAnchor ( )
inline

Destroys the joint that holds the vessel anchored in place

void Vessel.ResumeNavigation ( )
inline

Method called when vessel goes active, we need to start a coroutine while we wait for the contractsystem to be loaded

void Vessel.ResumeStaging ( )
inline
void Vessel.ResumeTarget ( )
inline
double Vessel.RevealAltitude ( )
inline

Implements IDiscoverable.

string Vessel.RevealDisplayName ( )
inline

Implements IDiscoverable.

float Vessel.RevealMass ( )
inline

Implements IDiscoverable.

string Vessel.RevealName ( )
inline

Implements IDiscoverable.

string Vessel.RevealSituationString ( )
inline

Implements IDiscoverable.

double Vessel.RevealSpeed ( )
inline

Implements IDiscoverable.

string Vessel.RevealType ( )
inline

Implements IDiscoverable.

void Vessel.SetActiveInternalSpace ( Part  visiblePart)
inline

Sets the internal space for the given part visible (and all others invisible)

Parameters
visiblePart
void Vessel.SetActiveInternalSpaces ( HashSet< Part visibleParts)
inline

Sets the internal spaces for the given parts visible, other IVA spaces in the same vesesl become invisible

Parameters
visibleParts
void Vessel.SetAutoClean ( string  reason = "")
inline
void Vessel.SetControlState ( FlightCtrlState  state)
inline
void Vessel.SetGroupOverride ( int  newGroup)
inline
void Vessel.SetLandedAt ( string  landedAt,
GameObject  gO = null,
string  inputdisplaylandedAt = "" 
)
inline

Set the LandedAt and displaylandedAt variables. an optional GameObject and an optional inputdisplaylandedAt string can be passed in. The landedAt field will be set to the passed in landedAt string. If an inputdisplaylandedAt string is passed in then the displaylandedAt string is set to this string (Usually localized language). If the inputdisplaylandedAt is empty and a GameObject is supplied the GameObject Unity Tag will be used to lookup a MiniBiome name. If no inputdisplaylandedAt or GameObject are passed in the displaylandedAt field is set to the landedAt field.

Parameters
landedAt
gO
inputdisplaylandedAt
void Vessel.SetLoaded ( bool  loaded)
inline
void Vessel.SetPosition ( Vector3d  position)
inline
void Vessel.SetPosition ( Vector3d  position,
bool  usePristineCoords 
)
inline

Sets the worldspace position of this vessel, and all its parts

Parameters
position

< physicsless parts will be moved along with their parents

void Vessel.SetReferenceTransform ( Part  p,
bool  storeRecall = true 
)
inline

< unset the ref transform id if setting a null transform.

void Vessel.SetRotation ( Quaternion  rotation)
inline

Sets the worldspace rotation of this vessel, and all its parts

Parameters
rotation
void Vessel.SetRotation ( Quaternion  rotation,
bool  setPos 
)
inline

Sets the worldspace rotation of this vessel, and all its parts. Accepts bool on whether to reset pos (leave false if pos is set elsewhere)

Parameters
rotation
void Vessel.SetWorldVelocity ( Vector3d  vel)
inline

set the absolute world velocity of this vessel

Parameters
vel
void Vessel.SpawnCrew ( )
inline
void Vessel.StartFromBackup ( ProtoVessel  pv)
inline

Start from backup is used when the scene is being resumed, and the Vessel component is added before the parts themselves. Note that this method won't load the parts. It only creates the vessel object. To load parts, use the Vessel.Load() method.

Parameters
pvThe Protovessel object for this vessel
void Vessel.StartFromBackup ( ProtoVessel  pv,
FlightState  st 
)
inline

Start from backup is used when the scene is being resumed, and the Vessel component is added before the parts themselves. Note that this method won't load the parts. It only creates the vessel object. To load parts, use the Vessel.Load() method.

Parameters
pvThe Protovessel object for this vessel
stThe flightstate
void Vessel.Translate ( Vector3d  offset)
inline
void Vessel.Unload ( )
inline
void Vessel.UpdateAcceleration ( double  fdtRecip,
bool  fromUpdate 
)
inline

< If we're not dead and we have the engines on, then let's compute an estimated acceleration from engines.

void Vessel.UpdateCaches ( )
inline

< do data transmitter thingie here

void Vessel.UpdateDistanceTraveled ( )
inline

Updates the distance traveled of this vessel

void Vessel.UpdateLandedSplashed ( )
inline
void Vessel.UpdatePosVel ( )
inline

< use CoM, not root part

< Pythagorean idea thanks to suggestion from Toadicus on modders' corner tracker. And it's even faster than the old trig version, too!

void Vessel.UpdateResourceSets ( )
inline

Clears dirty flag and updates the vessel and the crossfeed sets

void Vessel.UpdateResourceSetsIfDirty ( )
inline

Will update only if dirty.

void Vessel.UpdateVesselModuleActivation ( )
inline
void Vessel.UpdateVesselSize ( )
inline

Update the bounds of the vessel.

Member Data Documentation

Vector3d Vessel.acceleration
AltimeterDisplayState Vessel.altimeterDisplayState = AltimeterDisplayState.DEFAULT
double Vessel.altitude
Vector3 Vessel.angularMomentum = Vector3.zero
Vector3 Vessel.angularVelocity = Vector3.zero
Vector3d Vessel.angularVelocityD = Vector3d.zero
Vector3 Vessel.CoM
Vector3d Vessel.CoMD
CommNetVessel Vessel.connection
double Vessel.convectiveMachFlux
List<ProtoCrewMember> Vessel.crew = new List<ProtoCrewMember>()
protected
int Vessel.crewableParts = 0
int Vessel.crewCachedPartCount = -1
protected
int Vessel.crewedParts = 0
List<PartSet> Vessel.crossfeedSets = new List<PartSet>()

all the crossfeed (i.e. non-vessel-wide) sets on the vessel

FlightCtrlState Vessel.ctrlState
int Vessel.currentStage
bool Vessel.directSunlight
string Vessel.displaylandedAt = ""

A string of where the vessel is landed in Localized language.

double Vessel.distanceTraveled

Protopart snapshot Dictionary (keyed by part persistentId) of the parts that will get drained when vessel is packed

List built within this class, used to grouped in a single element the parts with it's resources to drain and drain time.

List<PartModule> Vessel.dockingPorts = new List<PartModule>()
bool Vessel.easingInToSurface
bool Vessel.EditableNodes
KerbalEVA Vessel.evaController
ConfigNode Vessel.flightPlanNode

a holder for the flowgraph

bool Vessel.frameWasRotating = false
double Vessel.geeForce
Vector3d Vessel.graviticAcceleration
List<Part> Vessel.GroundContacts
int Vessel.GroupOverride

Action/axis group override selector

0 -> default group 1+ selects actual override group

float Vessel.gThresh
double Vessel.HeightFromPartOffsetGlobal = 0.5d
static
double Vessel.heightFromPartOffsetLocal = 0d
float Vessel.heightFromSurface = -1f
float Vessel.heightFromTerrain = -1f
Guid Vessel.id

Unique identifier for each vessel.

Vector3d Vessel.krakensbaneAcc
bool Vessel.Landed
string Vessel.landedAt = ""

A string of where the vessel is landed in English.

string Vessel.landedAtLast = ""
CelestialBody Vessel.lastBody
double Vessel.lastUT = -1

for use in FI when checking if vessel has spent time unloaded.

Vector3d Vessel.lastVel
double Vessel.latitude
string Vessel.launchedFrom = ""

Will contain the Launch Site Name that this vessel launched from. If indeed it did launch from a launch site.

double Vessel.launchTime
bool Vessel.loaded = false
Vector3 Vessel.localCoM

This is used for persistence purposes. Use findLocalCenterOfMass() if you just want the center of mass.

double Vessel.longitude
double Vessel.mach
MapObject Vessel.mapObject
ControlLevel Vessel.maxControlLevel = ControlLevel.FULL
double Vessel.missionTime
Waypoint Vessel.navigationWaypoint

the active navigation waypoint for this vessel

int Vessel.NumOverrideGroups = 4
static

Number of override groups available (does not include the default group)

GameObject Vessel.objectUnderVessel
double Vessel.obt_speed
Vector3d Vessel.obt_velocity
FlightInputCallback Vessel.OnAutopilotUpdate = (FlightCtrlState st) => { }
FlightInputCallback Vessel.OnFlyByWire = (FlightCtrlState st) => { }

pass the control state from the scene handler to this vessel.

Callback Vessel.OnJustAboutToBeDestroyed = () => { }
FlightInputCallback Vessel.OnPostAutopilotUpdate = (FlightCtrlState st) => { }
FlightInputCallback Vessel.OnPreAutopilotUpdate = (FlightCtrlState st) => { }
OrbitDriver Vessel.orbitDriver
OrbitRenderer Vessel.orbitRenderer
OrbitTargeter Vessel.orbitTargeter
KSPActionGroup [] Vessel.OverrideActionControl
KSPAxisGroup [] Vessel.OverrideAxisControl
bool [] Vessel.OverrideDefault
string [] Vessel.OverrideGroupNames
bool Vessel.packed

landing / splashdown detection

bool Vessel.PartialControlHasSASRCS = true
static
double Vessel.partMaxGThresh
List<Part> Vessel.parts
PatchedConicRenderer Vessel.patchedConicRenderer
PatchedConicSolver Vessel.patchedConicSolver
bool Vessel.permanentGroundContact
uint Vessel.persistentId

A unique identifier for each vessel including from when it was Shipconstruct

Vector3d Vessel.perturbation
double Vessel.pqsAltitude
int Vessel.PQSmaxLevel = 0
int Vessel.PQSminLevel = 0
VesselPrecalculate Vessel.precalc
float Vessel.presThresh
ProtoVessel Vessel.protoVessel
ProtoTargetInfo Vessel.pTI = null
double Vessel.radarAltitude
Vector3 Vessel.rb_velocity
Vector3d Vessel.rb_velocityD
uint Vessel.referenceTransformId
uint Vessel.referenceTransformIdRecall
PartSet Vessel.resourcePartSet

The vessel partset.

bool Vessel.resourcesDirty = false

We set the dirty flag if we're waiting.

Part Vessel.rootPart
FlightCtrlState [] Vessel.setControlStates
List<PartSet> Vessel.simulationCrossfeedSets = new List<PartSet>()

all the Delta-V simulation crossfeed (i.e. non-vessel-wide) sets on the vessel

PartSet Vessel.simulationResourcePartSet

The vessel Delta-V simulation partset.

Situations Vessel.situation
bool Vessel.skipGroundPositioning = false

True if this Vessel is to skip vessel ground checks. Will also be set true if the vessel was launched from a LaunchSite. If true Vessel will skip ground repositioning when coming off rails.

bool Vessel.skipGroundPositioningForDroppedPart = false

True if this Vessel is a single part vessel and should skip vessel ground checks. skipGroundPositioning will overridden a single part vessel if this is false If true Vessel will skip ground repositioning when coming off rails.

double Vessel.specificAcceleration

Specific acceleration is the vessel's potential acceleration per unit of throttle. Used to estimate burn times and such. NOTE: this value is calculated based on smoothed acceleration, so it isn't completely accurate. It will also change as the vessel's mass is reduced as fuel burns away. (it does get pretty accurate after burning for a few seconds)

Quaternion Vessel.srfRelRotation
State Vessel.state = State.INACTIVE
ITargetable Vessel.targetObject
double Vessel.terrainAltitude
Vector3 Vessel.terrainNormal
double Vessel.totalMass
Vector3d Vessel.up
Vector3d Vessel.upAxis
bool Vessel.updateResourcesOnEvent = true

do we update immediately on event, or wait until the end of a series of modify events (i.e. vessel instantiation or decoupling)

Vector3d Vessel.velocityD
double Vessel.verticalSpeed
List<string> Vessel.VesselAnchorExceptions
static

List of module classes that should not be anchored

VesselDeltaV Vessel.VesselDeltaV

This is the VesselDeltaV instance for this ShipConstruct.

List<VesselModule> Vessel.vesselModules = new List<VesselModule>()
string Vessel.vesselName

Beware this could be a localization Tag - Not localized. It's better to use GetDisplayName() to get the localized displayable vessel name for UI purposes.

VesselRanges Vessel.vesselRanges
Vector3 Vessel.vesselSize

Bounds for the vessel

bool Vessel.vesselSpawning = true

True if this Vessel has just spawned into the game and hasn't had ground checks done.

Transform Vessel.vesselTransform
VesselType Vessel.vesselType = VesselType.Debris
double Vessel.warningThresholdG = 0.8d
static
double Vessel.waterOffset = 0d

Property Documentation

ActionGroupList Vessel.ActionGroups
get
bool Vessel.AutoClean
get
string Vessel.AutoCleanReason
get
VesselAutopilot Vessel.Autopilot
get
Situations Vessel.BestSituation
get
CometVessel Vessel.Comet
getset
CommNetVessel Vessel.Connection
getset
Vector3 Vessel.CurrentCoM
get
ControlLevel Vessel.CurrentControlLevel
get
DiscoveryInfo Vessel.DiscoveryInfo
get
float Vessel.distanceLandedPackThreshold
getset
float Vessel.distanceLandedUnpackThreshold
getset
float Vessel.distancePackThreshold
getset
float Vessel.distanceUnpackThreshold
getset
Vessel Vessel.EVALadderVessel
get
float Vessel.GroundLevelAngle
get

Angle of surface the Vessel is at currently, a negative value means it is initialized

RaycastHit Vessel.HeightFromSurfaceHit
get
bool Vessel.HoldPhysics
get
int Vessel.IgnoreCollisionsFrames
get
bool Vessel.IgnoreSpeedActive
get

Returns True if the vessel is ignoring Speed calcs. - Used after Set Position cheat is fired.

bool Vessel.isActiveVessel
get
bool Vessel.IsAnchored
get
bool Vessel.isCommandable
get
bool Vessel.IsControllable
get

True if the vessel has at least one operational control source and is active (focused).

bool Vessel.isEVA
get
bool Vessel.isPersistent
getset
bool Vessel.IsRecoverable
get
bool Vessel.LandedInKSC
get

Returns true if vessel is landed at the KSC Launchpad or Runway.

bool Vessel.LandedInStockLaunchSite
get

Returns true if vessel is landed at one of the stock Launch Sites.

bool Vessel.LandedOrSplashed
get
float Vessel.loadDistance
staticgetset
CelestialBody Vessel.mainBody
get
Orbit Vessel.orbit
get
List<Part> Vessel.Parts
get
bool Vessel.PatchedConicsAttached
getset
Transform Vessel.ReferenceTransform
get

The reference transform is used to define the orientation of a vessel for controls and gauges. It defines which way is 'up' or 'forward' or which way pitch rotates, for instance. Read only. Use SetReferenceTransform to set. Defaults to vessel transform if no other transform is set.

string Vessel.SituationString
get

Returns the Localized Vessel situation String

SuspensionLoadBalancer Vessel.suspensionLoadBalancer
getset

This is the Vessel Module that distributes the vessels mass across all suspension/wheels on the vessel.

Part Vessel.this[int index]
get
Part Vessel.this[uint flightID]
get
float Vessel.unloadDistance
staticgetset
Vessel Vessel.VesselSurface
getset

If this vessel is over another vessel, this property will be set

VesselValues Vessel.VesselValues
get

The documentation for this class was generated from the following file: