Difference between revisions of "API:Vessel"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (N3X15 moved page Vessel to API:Vessel)
m (Added some descriptions)
 
(18 intermediate revisions by 10 users not shown)
Line 1: Line 1:
A Vessel represents a ship, or a piece of debris that was once part of a ship. You can access the vessel that your Part is part of with this.vessel. Particularly useful members are vessel.orbit, which gives your orbit, and vessel.mainBody, which gives CelestialBody whose influence you are currently under.
+
A '''Vessel''' represents a ship, or a piece of debris that was once part of a ship. You can access the vessel that your Part is part of with this.vessel. Particularly useful members are vessel.orbit, which gives your orbit, and vessel.mainBody, which gives CelestialBody whose influence you are currently under.
  
== Useful members ==
+
<!-- Class tables autogenerated by Glyph's kerbal_wiki_pdoc program for KSP 1.04. Using syntax set up for the wiki by N3X15, format from DOCTOOLS (I'm not clear if DOCTOOLS is the script used to generate N3X15's old version of these tables, or some mediawiki thing). -->
 +
{{Class
 +
  |inherits={{Type|MonoBehaviour}}
 +
  |implements=<ul><li>{{Type|IShipconstruct}}</li><li>{{Type|ITargetable}}</li><li>{{Type|IDiscoverable}}</li></ul>
 +
  |name=Vessel
 +
  |summary=Vessels define individual ships in flight. They work essentially as a header for the set of parts that make up the ship.
 +
}}
 +
{{Properties|properties=
 +
{{Property
 +
  |type=ActionGroupList
 +
  |name=ActionGroups
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=VesselAutopilot
 +
  |name=Autopilot
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=Vector3
 +
  |name=CurrentCoM
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=DiscoveryInfo
 +
  |name=DiscoveryInfo
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=float
 +
  |name=distanceLandedPackThreshold
 +
  |desc=? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
 +
  |hasget=1
 +
  |hasset=1
 +
}}
 +
{{Property
 +
  |type=float
 +
  |name=distanceLandedUnpackThreshold
 +
  |desc=? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
 +
  |hasget=1
 +
  |hasset=1
 +
}}
 +
{{Property
 +
  |type=float
 +
  |name=distancePackThreshold
 +
  |desc=? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
 +
  |hasget=1
 +
  |hasset=1
 +
}}
 +
{{Property
 +
  |type=float
 +
  |name=distanceUnpackThreshold
 +
  |desc=? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
 +
  |hasget=1
 +
  |hasset=1
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=HoldPhysics
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=isActiveVessel
 +
  |desc=Returns true if this is the vessel that is currently being controled by the player.
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=isCommandable
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=IsControllable
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=isEVA
 +
  |desc=True if the vessel is an EVA kerbal.
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=isPersistent
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=1
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=IsRecoverable
 +
  |desc=Returns true if this vessel is recoverable (ex. is splashed down or landed on Kerbin and is not moving).
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=LandedOrSplashed
 +
  |desc=Returns true if the vessel is splashed down or landed.
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=CelestialBody
 +
  |name=mainBody
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=Orbit
 +
  |name=orbit
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=List&#x3008;Part&#x3009;
 +
  |name=Parts
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=bool
 +
  |name=PatchedConicsAttached
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=Transform
 +
  |name=ReferenceTransform
 +
  |desc=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.
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=VesselValues
 +
  |name=VesselValues
 +
  |desc=?
 +
  |hasget=1
 +
  |hasset=
 +
}}
 +
{{Property
 +
  |type=static float
 +
  |name=loadDistance
 +
  |desc=? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
 +
  |hasget=1
 +
  |hasset=1
 +
}}
 +
{{Property
 +
  |type=static float
 +
  |name=unloadDistance
 +
  |desc=? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
 +
  |hasget=1
 +
  |hasset=1
 +
}}
 +
}}
  
Note: this is not a complete listing of the class's members. It includes only the members that someone has figured out how to use and written an explanation for. If you figure out what the other members that aren't listed here do, you should add them to the list!
+
{{Fields|
 +
{{Field
 +
  |type=Vector3d
 +
  |name=acceleration
 +
  |desc=The current acceleration vector of the vessel.
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=altitude
 +
  |desc=Height above the surface of the reference body, including liquid bodies.
 +
}}
 +
{{Field
 +
  |type=Vector3
 +
  |name=angularMomentum
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3
 +
  |name=angularVelocity
 +
  |desc=The angular velocity vector of the vessel.
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=atmDensity
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=atmosphericTemperature
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3d
 +
  |name=CentrifugalAcc
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3
 +
  |name=CoM
 +
  |desc=The vector corresponding to the vessel's center of mass, relative to the vessel origin.
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=convectiveCoefficient
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=convectiveMachFlux
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3d
 +
  |name=CoriolisAcc
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=FlightCtrlState
 +
  |name=ctrlState
 +
  |desc=The vessel's flight control state object, used for accessing and modifying user and fly-by-wire input.
 +
}}
 +
{{Field
 +
  |type=int
 +
  |name=currentStage
 +
  |desc=Current stage of the vessel.
 +
}}
 +
{{Field
 +
  |type=bool
 +
  |name=directSunlight
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=distanceToSun
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=dynamicPressurekPa
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=KerbalEVA
 +
  |name=evaController
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=externalTemperature
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=ConfigNode
 +
  |name=flightPlanNode
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=geeForce
 +
  |desc=The current magnitude of gravity, in meters per second squared. (Is this right? geeForce is not gravity)
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=geeForce_immediate
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3d
 +
  |name=gForce
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=bool
 +
  |name=handlePhysicsStats
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=float
 +
  |name=heightFromSurface
 +
  |desc=The height above the surface of the reference body, including liquid bodies.
 +
}}
 +
{{Field
 +
  |type=float
 +
  |name=heightFromTerrain
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=horizontalSrfSpeed
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Guid
 +
  |name=id
 +
  |desc=Unique identifier for each vessel.
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=indicatedAirSpeed
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=bool
 +
  |name=Landed
 +
  |desc=True if the vessel has landed.
 +
}}
 +
{{Field
 +
  |type=string
 +
  |name=landedAt
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=latitude
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=launchTime
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=bool
 +
  |name=loaded
 +
  |desc=True if the vessel has loaded.
 +
}}
 +
{{Field
 +
  |type=Vector3
 +
  |name=localCoM
 +
  |desc=This is used for persistence purposes. Use findLocalCenterOfMass() if you just want the center of mass.
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=longitude
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=mach
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=missionTime
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3
 +
  |name=MOI
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=obt_speed
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3d
 +
  |name=obt_velocity
 +
  |desc=The orbital velocity vector of the vessel, relative to the reference body.
 +
}}
 +
{{Field
 +
  |type=FlightInputCallback
 +
  |name=OnAutopilotUpdate
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=FlightInputCallback
 +
  |name=OnFlyByWire
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Callback
 +
  |name=OnJustAboutToBeDestroyed
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=FlightInputCallback
 +
  |name=OnPostAutopilotUpdate
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=FlightInputCallback
 +
  |name=OnPreAutopilotUpdate
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=OrbitDriver
 +
  |name=orbitDriver
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=OrbitRenderer
 +
  |name=orbitRenderer
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=OrbitTargeter
 +
  |name=orbitTargeter
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=bool
 +
  |name=packed
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=List&#x3008;Part&#x3009;
 +
  |name=parts
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=PatchedConicRenderer
 +
  |name=patchedConicRenderer
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=PatchedConicSolver
 +
  |name=patchedConicSolver
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3d
 +
  |name=perturbation
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=pqsAltitude
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=ProtoVessel
 +
  |name=protoVessel
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3
 +
  |name=rb_velocity
 +
  |desc=The current velocity of the Unity physics rigidbody.
 +
}}
 +
{{Field
 +
  |type=uint
 +
  |name=referenceTransformId
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Part
 +
  |name=rootPart
 +
  |desc=The root part of the vessel.
 +
}}
 +
{{Field
 +
  |type=Situations
 +
  |name=situation
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=solarFlux
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=specificAcceleration
 +
  |desc=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)
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=speed
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=speedOfSound
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=bool
 +
  |name=Splashed
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Vector3d
 +
  |name=srf_velocity
 +
  |desc=The velocity vector of the vessel while in the atmosphere. (Prograde)
 +
}}
 +
{{Field
 +
  |type=Quaternion
 +
  |name=srfRelRotation
 +
  |desc=The Quaternion corresponding to the vessel's rotation, relative to the surface of reference body.
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=srfSpeed
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=State
 +
  |name=state
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=staticPressurekPa
 +
  |desc=The current atmospheric pressure of this vessel.
 +
}}
 +
{{Field
 +
  |type=ITargetable
 +
  |name=targetObject
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=terrainAltitude
 +
  |desc=The height of the terrain, relative to the center of the reference body.
 +
}}
 +
{{Field
 +
  |type=Vector3
 +
  |name=terrainNormal
 +
  |desc=The vector perpendicular to the terrain.
 +
}}
 +
{{Field
 +
  |type=Vector3d
 +
  |name=upAxis
 +
  |desc=Vector corresponding to the vessel's up facing direction.
 +
}}
 +
{{Field
 +
  |type=double
 +
  |name=verticalSpeed
 +
  |desc=The vertical speed of the vessel, relative to the surface of the reference body.
 +
}}
 +
{{Field
 +
  |type=string
 +
  |name=vesselName
 +
  |desc=Name identifier of the vessel.
 +
}}
 +
{{Field
 +
  |type=VesselRanges
 +
  |name=vesselRanges
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=Transform
 +
  |name=vesselTransform
 +
  |desc=?
 +
}}
 +
{{Field
 +
  |type=VesselType
 +
  |name=vesselType
 +
  |desc=?
 +
}}
 +
}}
  
<table border="1">
+
{{Methods|
<tr>
+
{{Method
<td><code>void ChangeWorldVelocity(Vector3d velOffset)</code></td>
+
  |returntype=constructor
<td>Adds velOffset to the vessel's velocity. This seems to happen instantaneously and without imposing any stresses on the ship. You can use this to simulate some sort of force, like gravity, that accelerates the vessel as a whole.</td>
+
  |returndesc=
</tr>
+
  |name=Vessel
<tr>
+
  |args=
<td><code>Vector3 findWorldCenterOfMass()</code></td>
+
  |desc=?
<td>Returns the center of mass of the ship, in world coordinates</td>
+
}}
</tr>
+
{{Method
<tr>
+
  |returntype=void
<td><code>void SetWorldVelocity(Vector3d vel)</code></td>
+
  |returndesc=
<td>Sets the velocity of the vessel to the supplied velocity vector. This seems to happen instantaneously and without imposing any stresses on the ship.</td>
+
  |name=AttachPatchedConicsSolver
</tr>
+
  |args=
<tr>
+
  |desc=?
<td><code>bool isActiveVessel { get; }</code></td>
+
}}
<td>Whether this vessel is the one the player is currently controlling. This is often useful to know, as your code will run even on non-active ships when they are within a few km of the active vessel. You can enclose your code in if(this.vessel.isActiveVessel) {} if you only want to do stuff when your plugin part is on the active ship.</td>
+
{{Method
</tr>
+
  |returntype=ProtoVessel
<tr>
+
  |returndesc=
<td><code>bool isCommandable { get; }</code></td>
+
  |name=BackupVessel
<td>Whether the vessel is commandable or debris. Commandable vessels can be selected from the tracking station and show up on the map with little command pod symbols. Non-commandable vessels can't and show up with debris symbols.</td>
+
  |args=
</tr>
+
  |desc=?
<tr>
+
}}
<td><code>CelestialBody mainBody { get; }</code></td>
+
{{Method
<td>The celestial body whose sphere of influence the vessel is currently inside. You will probably use this a lot.</td>
+
  |returntype=void
</tr>
+
  |returndesc=
<tr>
+
  |name=CalculatePhysicsStats
<td><code>bool Landed</code></td>
+
  |args=
<td>Whether the vessel is currently landed on solid ground.</td>
+
  |desc=?
</tr>
+
}}
<tr>
+
{{Method
<td><code>Orbit orbit</code></td>
+
  |returntype=void
<td>The Orbit object storing all the information about the vessel's orbit. You can get the vessel's current velocity with vessel.orbit.GetVel()</td>
+
  |returndesc=
</tr>
+
  |name=ChangeWorldVelocity
<tr>
+
  |args={{arg|Vector3d|velOffset}}
<td><code>List<Part> parts</code></td>
+
  |desc=change the worldspace velocity of this vessel
<td>A list of the parts in the ship.</td>
+
}}
</tr>
+
{{Method
<tr>
+
  |returntype=bool
<td><code>ProtoVessel protoVessel</code></td>
+
  |returndesc=
<td>Some sort of data structure that stores saved information about the vessel. It can be useful for getting data about parts in vessels that are on rails, when vessel.parts is empty. ProtoVessel.protoPartSnapshots is a List<ProtoPartSnapshot>, with one ProtoPartSnapshot for each part in the vessel. ProtoPartSnapshot.partStateValues is a Dictionary<string, KSPParseable>, which you can store data into by overriding Part.onFlightStateSave(). This data is then accessible even if the vessel that stored the data is on rails.</td>
+
  |name=checkLanded
</tr>
+
  |args=
<tr>
+
  |desc=?
<td><code>Part rootPart</code></td>
+
}}
<td>The part at the root of the vessel's part tree, i.e., the command pod.</td>
+
{{Method
</tr>
+
  |returntype=bool
<tr>
+
  |returndesc=
<td><code>bool Splashed</code></td>
+
  |name=checkSplashed
<td>Whether the vessel is currently splashed down in the ocean.</td>
+
  |args=
</tr>
+
  |desc=?
<tr>
+
}}
<td><code>string vesselName</code></td>
+
{{Method
<td>The name of the vessel that appears e.g. when you mouse over it on the orbital map.</td>
+
  |returntype=bool
</table>
+
  |returndesc=
 +
  |name=checkVisibility
 +
  |args=
 +
  |desc=Returns true if this vessel is within the visible range of any commandable (focusable) vessel, false otherwise.
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=ClearStaging
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=bool
 +
  |returndesc=
 +
  |name=ContainsCollider
 +
  |args={{arg|Collider|c}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=DespawnCrew
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=DestroyVesselComponents
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=DetachPatchedConicsSolver
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=Die
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=FallBackReferenceTransform
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=FeedInputFeed
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=VesselType
 +
  |returndesc=
 +
  |name=FindDefaultVesselType
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Vector3
 +
  |returndesc=
 +
  |name=findLocalCenterOfMass
 +
  |args=
 +
  |desc=Finds the local center of mass recursively from the given ship part.
 +
}}
 +
{{Method
 +
  |returntype=Vector3
 +
  |returndesc=
 +
  |name=findLocalCenterOfPressure
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Vector3
 +
  |returndesc=
 +
  |name=findLocalMOI
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Vector3
 +
  |returndesc=
 +
  |name=findLocalMOI
 +
  |args={{arg|Vector3|worldCoM}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=List&#x3008;T&#x3009;
 +
  |returndesc=
 +
  |name=FindPartModulesImplementing&#x3008;T&#x3009;
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Vector3
 +
  |returndesc=
 +
  |name=findWorldCenterOfMass
 +
  |args=
 +
  |desc=Finds the world center of mass recursively from the given ship part.
 +
}}
 +
{{Method
 +
  |returntype=List&#x3008;Part&#x3009;
 +
  |returndesc=
 +
  |name=GetActiveParts
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=ActiveResource
 +
  |returndesc=
 +
  |name=GetActiveResource
 +
  |args={{arg|PartResourceDefinition|def}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=List&#x3008;ActiveResource&#x3009;
 +
  |returndesc=
 +
  |name=GetActiveResources
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=int
 +
  |returndesc=
 +
  |name=GetCrewCapacity
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=int
 +
  |returndesc=
 +
  |name=GetCrewCount
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Vector3
 +
  |returndesc=
 +
  |name=GetFwdVector
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=float
 +
  |returndesc=
 +
  |name=GetHeightFromSurface
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=float
 +
  |returndesc=
 +
  |name=GetHeightFromTerrain
 +
  |args=
 +
  |desc=The vessel's altitude above the reference body's terrain, not including liquid bodies.
 +
}}
 +
{{Method
 +
  |returntype=string
 +
  |returndesc=
 +
  |name=GetName
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Vector3
 +
  |returndesc=
 +
  |name=GetObtVelocity
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Orbit
 +
  |returndesc=
 +
  |name=GetOrbit
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=OrbitDriver
 +
  |returndesc=
 +
  |name=GetOrbitDriver
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Part
 +
  |returndesc=
 +
  |name=GetReferenceTransformPart
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Vector3
 +
  |returndesc=
 +
  |name=GetSrfVelocity
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=VesselTargetModes
 +
  |returndesc=
 +
  |name=GetTargetingMode
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=float
 +
  |returndesc=
 +
  |name=GetTotalMass
 +
  |args=
 +
  |desc=Get the sum of the mass of all (physical) parts on this vessel
 +
}}
 +
{{Method
 +
  |returntype=Transform
 +
  |returndesc=
 +
  |name=GetTransform
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=Vessel
 +
  |returndesc=
 +
  |name=GetVessel
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=List&#x3008;ProtoCrewMember&#x3009;
 +
  |returndesc=
 +
  |name=GetVesselCrew
 +
  |args=
 +
  |desc=Returns a list of ProtoCrewMembers corresponding to each kerbal on board. ProtoCrewMember contains many fields relating to the kerbals stats such as name, courage, etc.
 +
}}
 +
{{Method
 +
  |returntype=Vector3d
 +
  |returndesc=
 +
  |name=GetWorldPos3D
 +
  |args=
 +
  |desc=Get a double precision vector for the vessel's worldspace position (for when transform.position isn't accurate enough)
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=GoOffRails
 +
  |args=
 +
  |desc=puts the ship back into a simulated orbit and reenables physics
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=GoOnRails
 +
  |args=
 +
  |desc=disables physics and puts the ship into a propagated orbit
 +
}}
 +
{{Method
 +
  |returntype=bool
 +
  |returndesc=
 +
  |name=HasControlSources
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=bool
 +
  |returndesc=
 +
  |name=Initialize
 +
  |args={{arg|bool|fromShipAssembly}}
 +
  |desc=Initialize is used in cases where the Vessel component is added to a ship that already exists.
 +
}}
 +
{{Method
 +
  |returntype=ClearToSaveStatus
 +
  |returndesc=
 +
  |name=IsClearToSave
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=Load
 +
  |args=
 +
  |desc=? Has attribute [ContextMenu("Load")]
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=MakeActive
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=MakeInactive
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=MurderCrew
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=OnDestroy
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=OnLoadFlightState
 +
  |args={{arg|Dictionary&#x3008;string, KSPParseable&#x3009;|dataPool}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=OnSaveFlightState
 +
  |args={{arg|Dictionary&#x3008;string, KSPParseable&#x3009;|dataPool}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=double
 +
  |returndesc=
 +
  |name=PQSAltitude
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=printCollisions
 +
  |args=
 +
  |desc=? Has attribute [ContextMenu("Print All Collisions")]
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=printGroundContacts
 +
  |args=
 +
  |desc=? Has attribute [ContextMenu("Print Ground Contacts")]
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=RenameVessel
 +
  |args=
 +
  |desc=? Has attribute [ContextMenu("Rename Vessel")]
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=ResetCollisionIgnores
 +
  |args=
 +
  |desc=? Has attribute [ContextMenu("Reset Collision Ignores")]
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=ResumeStaging
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=ResumeTarget
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=double
 +
  |returndesc=
 +
  |name=RevealAltitude
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=float
 +
  |returndesc=
 +
  |name=RevealMass
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=string
 +
  |returndesc=
 +
  |name=RevealName
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=string
 +
  |returndesc=
 +
  |name=RevealSituationString
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=double
 +
  |returndesc=
 +
  |name=RevealSpeed
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=string
 +
  |returndesc=
 +
  |name=RevealType
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SetActiveInternalPart
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SetActiveInternalPart
 +
  |args={{arg|List&#x3008;Part&#x3009;|visibleParts}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SetActiveInternalPart
 +
  |args={{arg|Part|visiblePart}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SetPosition
 +
  |args={{arg|Vector3|position}}
 +
  |desc=Sets the worldspace position of this vessel, and all its parts
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SetPosition
 +
  |args={{arg|Vector3|position}},{{arg|bool|usePristineCoords}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SetReferenceTransform
 +
  |args={{arg|Part|p}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SetRotation
 +
  |args={{arg|Quaternion|rotation}}
 +
  |desc=Sets the worldspace rotation of this vessel, and all its parts
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SetWorldVelocity
 +
  |args={{arg|Vector3d|vel}}
 +
  |desc=set the absolute world velocity of this vessel
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=SpawnCrew
 +
  |args=
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=StartFromBackup
 +
  |args={{arg|ProtoVessel|pv}}
 +
  |desc=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.
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=Translate
 +
  |args={{arg|Vector3|offset}}
 +
  |desc=?
 +
}}
 +
{{Method
 +
  |returntype=void
 +
  |returndesc=
 +
  |name=Unload
 +
  |args=
 +
  |desc=? Has attribute [ContextMenu("Unload")]
 +
}}
 +
{{StaticMethod
 +
  |returntype=string
 +
  |returndesc=
 +
  |name=AutoRename
 +
  |args={{arg|Vessel|v}},{{arg|string|baseName}}
 +
  |desc=?
 +
}}
 +
{{StaticMethod
 +
  |returntype=string
 +
  |returndesc=
 +
  |name=GetLandedAtString
 +
  |args={{arg|string|landedAt}}
 +
  |desc=?
 +
}}
 +
{{StaticMethod
 +
  |returntype=string
 +
  |returndesc=
 +
  |name=GetMETString
 +
  |args={{arg|Vessel|v}}
 +
  |desc=?
 +
}}
 +
{{StaticMethod
 +
  |returntype=string
 +
  |returndesc=
 +
  |name=GetSituationString
 +
  |args={{arg|Vessel|v}}
 +
  |desc=?
 +
}}
 +
{{StaticMethod
 +
  |returntype=bool
 +
  |returndesc=
 +
  |name=IsValidVesselName
 +
  |args={{arg|string|name}}
 +
  |desc=?
 +
}}
 +
}}
 +
{{Enums|enums=
 +
{{Enum
 +
  |name=Situations
 +
  |values=LANDED<br/>SPLASHED<br/>PRELAUNCH<br/>FLYING<br/>SUB_ORBITAL<br/>ORBITING<br/>ESCAPING<br/>DOCKED
 +
}}
 +
{{Enum
 +
  |name=State
 +
  |values=INACTIVE<br/>ACTIVE<br/>DEAD
 +
}}
 +
}}
 +
== Other API ==
 +
 
 +
Vessel also contains the following, not included above.
 +
 
 +
<syntaxhighlight>
 +
...
 +
public Part this[int index] { get; }
 +
public Part this[uint flightID] { get; }
 +
 
 +
public class ActiveResource
 +
{
 +
  public double amount;
 +
  public PartResourceDefinition info;
 +
  public double maxAmount;
 +
  public List<Part> parts;
 +
 
 +
  public ActiveResource(PartResourceDefinition def);
 +
}
 +
...
 +
</syntaxhighlight>
  
 
[[Category:Community API Documentation]]
 
[[Category:Community API Documentation]]

Latest revision as of 21:22, 21 April 2021

A Vessel represents a ship, or a piece of debris that was once part of a ship. You can access the vessel that your Part is part of with this.vessel. Particularly useful members are vessel.orbit, which gives your orbit, and vessel.mainBody, which gives CelestialBody whose influence you are currently under.

Vessel Class

Inherits Implements
MonoBehaviour
  • IShipconstruct
  • ITargetable
  • IDiscoverable

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

Properties

The following is a list of properties in Vessel.

Name Description
ActionGroupList ActionGroups { get; }  ?
VesselAutopilot Autopilot { get; }  ?
Vector3 CurrentCoM { get; }  ?
DiscoveryInfo DiscoveryInfo { get; }  ?
float distanceLandedPackThreshold { get; set; }  ? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
float distanceLandedUnpackThreshold { get; set; }  ? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
float distancePackThreshold { get; set; }  ? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
float distanceUnpackThreshold { get; set; }  ? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
bool HoldPhysics { get; }  ?
bool isActiveVessel { get; } Returns true if this is the vessel that is currently being controled by the player.
bool isCommandable { get; }  ?
bool IsControllable { get; }  ?
bool isEVA { get; } True if the vessel is an EVA kerbal.
bool isPersistent { get; set; }  ?
bool IsRecoverable { get; } Returns true if this vessel is recoverable (ex. is splashed down or landed on Kerbin and is not moving).
bool LandedOrSplashed { get; } Returns true if the vessel is splashed down or landed.
CelestialBody mainBody { get; }  ?
Orbit orbit { get; }  ?
List〈Part〉 Parts { get; }  ?
bool PatchedConicsAttached { get; }  ?
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.
VesselValues VesselValues { get; }  ?
static float loadDistance { get; set; }  ? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]
static float unloadDistance { get; set; }  ? Has attribute [Obsolete("Use Vessel.vesselRanges instead")]

Fields

The following is a list of fields in Vessel.

Signature Description
Vector3d acceleration The current acceleration vector of the vessel.
double altitude Height above the surface of the reference body, including liquid bodies.
Vector3 angularMomentum  ?
Vector3 angularVelocity The angular velocity vector of the vessel.
double atmDensity  ?
double atmosphericTemperature  ?
Vector3d CentrifugalAcc  ?
Vector3 CoM The vector corresponding to the vessel's center of mass, relative to the vessel origin.
double convectiveCoefficient  ?
double convectiveMachFlux  ?
Vector3d CoriolisAcc  ?
FlightCtrlState ctrlState The vessel's flight control state object, used for accessing and modifying user and fly-by-wire input.
int currentStage Current stage of the vessel.
bool directSunlight  ?
double distanceToSun  ?
double dynamicPressurekPa  ?
KerbalEVA evaController  ?
double externalTemperature  ?
ConfigNode flightPlanNode  ?
double geeForce The current magnitude of gravity, in meters per second squared. (Is this right? geeForce is not gravity)
double geeForce_immediate  ?
Vector3d gForce  ?
bool handlePhysicsStats  ?
float heightFromSurface The height above the surface of the reference body, including liquid bodies.
float heightFromTerrain  ?
double horizontalSrfSpeed  ?
Guid id Unique identifier for each vessel.
double indicatedAirSpeed  ?
bool Landed True if the vessel has landed.
string landedAt  ?
double latitude  ?
double launchTime  ?
bool loaded True if the vessel has loaded.
Vector3 localCoM This is used for persistence purposes. Use findLocalCenterOfMass() if you just want the center of mass.
double longitude  ?
double mach  ?
double missionTime  ?
Vector3 MOI  ?
double obt_speed  ?
Vector3d obt_velocity The orbital velocity vector of the vessel, relative to the reference body.
FlightInputCallback OnAutopilotUpdate  ?
FlightInputCallback OnFlyByWire  ?
Callback OnJustAboutToBeDestroyed  ?
FlightInputCallback OnPostAutopilotUpdate  ?
FlightInputCallback OnPreAutopilotUpdate  ?
OrbitDriver orbitDriver  ?
OrbitRenderer orbitRenderer  ?
OrbitTargeter orbitTargeter  ?
bool packed  ?
List〈Part〉 parts  ?
PatchedConicRenderer patchedConicRenderer  ?
PatchedConicSolver patchedConicSolver  ?
Vector3d perturbation  ?
double pqsAltitude  ?
ProtoVessel protoVessel  ?
Vector3 rb_velocity The current velocity of the Unity physics rigidbody.
uint referenceTransformId  ?
Part rootPart The root part of the vessel.
Situations situation  ?
double solarFlux  ?
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)
double speed  ?
double speedOfSound  ?
bool Splashed  ?
Vector3d srf_velocity The velocity vector of the vessel while in the atmosphere. (Prograde)
Quaternion srfRelRotation The Quaternion corresponding to the vessel's rotation, relative to the surface of reference body.
double srfSpeed  ?
State state  ?
double staticPressurekPa The current atmospheric pressure of this vessel.
ITargetable targetObject  ?
double terrainAltitude The height of the terrain, relative to the center of the reference body.
Vector3 terrainNormal The vector perpendicular to the terrain.
Vector3d upAxis Vector corresponding to the vessel's up facing direction.
double verticalSpeed The vertical speed of the vessel, relative to the surface of the reference body.
string vesselName Name identifier of the vessel.
VesselRanges vesselRanges  ?
Transform vesselTransform  ?
VesselType vesselType  ?

Methods

The following are methods included in Vessel.

Signature Description
constructor Vessel()  ?
void AttachPatchedConicsSolver()  ?
ProtoVessel BackupVessel()  ?
void CalculatePhysicsStats()  ?
void ChangeWorldVelocity(Vector3d velOffset) change the worldspace velocity of this vessel
bool checkLanded()  ?
bool checkSplashed()  ?
bool checkVisibility() Returns true if this vessel is within the visible range of any commandable (focusable) vessel, false otherwise.
void ClearStaging()  ?
bool ContainsCollider(Collider c)  ?
void DespawnCrew()  ?
void DestroyVesselComponents()  ?
void DetachPatchedConicsSolver()  ?
void Die()  ?
void FallBackReferenceTransform()  ?
void FeedInputFeed()  ?
VesselType FindDefaultVesselType()  ?
Vector3 findLocalCenterOfMass() Finds the local center of mass recursively from the given ship part.
Vector3 findLocalCenterOfPressure()  ?
Vector3 findLocalMOI()  ?
Vector3 findLocalMOI(Vector3 worldCoM)  ?
List〈T〉 FindPartModulesImplementing〈T〉()  ?
Vector3 findWorldCenterOfMass() Finds the world center of mass recursively from the given ship part.
List〈Part〉 GetActiveParts()  ?
ActiveResource GetActiveResource(PartResourceDefinition def)  ?
List〈ActiveResource〉 GetActiveResources()  ?
int GetCrewCapacity()  ?
int GetCrewCount()  ?
Vector3 GetFwdVector()  ?
float GetHeightFromSurface()  ?
float GetHeightFromTerrain() The vessel's altitude above the reference body's terrain, not including liquid bodies.
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
Transform GetTransform()  ?
Vessel GetVessel()  ?
List〈ProtoCrewMember〉 GetVesselCrew() Returns a list of ProtoCrewMembers corresponding to each kerbal on board. ProtoCrewMember contains many fields relating to the kerbals stats such as name, courage, etc.
Vector3d GetWorldPos3D() Get a double precision vector for the vessel's worldspace position (for when transform.position isn't accurate enough)
void GoOffRails() puts the ship back into a simulated orbit and reenables physics
void GoOnRails() disables physics and puts the ship into a propagated orbit
bool HasControlSources()  ?
bool Initialize(bool fromShipAssembly) Initialize is used in cases where the Vessel component is added to a ship that already exists.
ClearToSaveStatus IsClearToSave()  ?
void Load()  ? Has attribute [ContextMenu("Load")]
void MakeActive()  ?
void MakeInactive()  ?
void MurderCrew()  ?
void OnDestroy()  ?
void OnLoadFlightState(Dictionary〈string, KSPParseable〉 dataPool)  ?
void OnSaveFlightState(Dictionary〈string, KSPParseable〉 dataPool)  ?
double PQSAltitude()  ?
void printCollisions()  ? Has attribute [ContextMenu("Print All Collisions")]
void printGroundContacts()  ? Has attribute [ContextMenu("Print Ground Contacts")]
void RenameVessel()  ? Has attribute [ContextMenu("Rename Vessel")]
void ResetCollisionIgnores()  ? Has attribute [ContextMenu("Reset Collision Ignores")]
void ResumeStaging()  ?
void ResumeTarget()  ?
double RevealAltitude()  ?
float RevealMass()  ?
string RevealName()  ?
string RevealSituationString()  ?
double RevealSpeed()  ?
string RevealType()  ?
void SetActiveInternalPart()  ?
void SetActiveInternalPart(List〈Part〉 visibleParts)  ?
void SetActiveInternalPart(Part visiblePart)  ?
void SetPosition(Vector3 position) Sets the worldspace position of this vessel, and all its parts
void SetPosition(Vector3 position,bool usePristineCoords)  ?
void SetReferenceTransform(Part p)  ?
void SetRotation(Quaternion rotation) Sets the worldspace rotation of this vessel, and all its parts
void SetWorldVelocity(Vector3d vel) set the absolute world velocity of this vessel
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.
void Translate(Vector3 offset)  ?
void Unload()  ? Has attribute [ContextMenu("Unload")]
static string AutoRename(Vessel v,string baseName)  ?
static string GetLandedAtString(string landedAt)  ?
static string GetMETString(Vessel v)  ?
static string GetSituationString(Vessel v)  ?
static bool IsValidVesselName(string name)  ?

Enumerations

The following is a list of enumerations in Vessel.

Name Values
Situations LANDED
SPLASHED
PRELAUNCH
FLYING
SUB_ORBITAL
ORBITING
ESCAPING
DOCKED
State INACTIVE
ACTIVE
DEAD

Other API

Vessel also contains the following, not included above.

...
public Part this[int index] { get; }
public Part this[uint flightID] { get; }
 
public class ActiveResource
{
  public double amount;
  public PartResourceDefinition info;
  public double maxAmount;
  public List<Part> parts;
 
  public ActiveResource(PartResourceDefinition def);
}
...