API:List of Part Modules

From Kerbal Space Program Wiki
Revision as of 18:49, 17 March 2017 by Sal vager (talk | contribs) (Reverted edits by Rocketing Rudolph (talk) to last revision by Pizzaoverhead)
Jump to: navigation, search

Behaviour is added to parts in KSP using modular components called part modules. These are classes which derive from PartModule. Multiple simple modules can be added to parts to build up complex behaviour. For example, the J-90 "Goliath" Turbofan Engine uses ModuleResourceIntake, ModuleEnginesFX, ModuleAnimateHeat, ModuleAnimateGeneric, FXModuleAnimateThrottle, ModuleJettison, FlagDecal, ModuleAlternator, ModuleTestSubject and ModuleSurfaceFX to provide its air intake, engine thrust and effects, heat effects, thrust reverser, moving engine fan, fairings, mission flag, electric charge generation, test missions and near-ground effects in a single part.

Part modules can be added to a part by editing that part's configuration file. For example, to add a part module called "ModuleName" to a part, the part's configuration file should be edited to include the following before the final closing '}' in the file:

MODULE
{
	name = ModuleName
}

The following is an incomplete list of the part modules in KSP as of version 1.1.

Module name Notes
CModuleFuelLine  ?? (not in code)
CModuleLinkedMesh  ?? (not in code)
CModuleStrut  ?? (not in code)
FlagDecal Allows specifying a quad (mesh) to be textured with the current mission flag.
FXModuleAnimateThrottle Varies the state of an animation based on the current throttle setting. Most commonly used to make rocket engines glow orange when they're running.
FXModuleConstrainPosition  ??
FXModuleLookAtConstraint Used to automatically position, rotate or constrain movement of a [[1]] relative to another. For example, rotating mounting struts to stay attached to a gimballing engine, or keeping wheel suspension attached to the wheel as it bounces.
ModuleAblator Used for heat shields to provide thermal protection during re-entry. The module consumes the resource named in ablativeResource as it does this (normally Ablator, defined outside the part module). The part's colour is also darkened as ablataiveResource is depleted.
ModuleActiveRadiator Used for radiators to remove heat from the craft at the cost of a named resource, normally electric charge.
ModuleAdvancedLandingGear Unknown. Appears unused.
ModuleAerodynamicLift Unknown. Appears unused.
ModuleAeroSurface Allows toggling to a high-drag mode while activating an animation. Currently used only for the airbrake part.
ModuleAlternator Generates the specified resource, normally electric charge, at a rate dependent on the thrust of an engine module within the same part.
ModuleAnalysisResource Used in the Surface Scanning Module part to provide right-click abundance percentage for the given resourceName, ore.
ModuleAnchoredDecoupler Used in radial decouplers to detach the part.
ModuleAnimateGeneric Used to toggle animations via right-click menu or action group, for example toggling cockpit lights, engaging thrust reversers, or opening and closing cargo bay doors.
ModuleAnimateHeat Varies the state of an animation based on the part's heat. Used to provide the orange glow on intakes and nose cones as they heat up.
ModuleAnimationGroup Used to play "deploy" and looped "running" animations for parts such as the Convert-O-Tron 250 and the 'Drill-O-Matic' Mining Excavator
ModuleAnimatorLandingGear Unknown. Appears unused.
ModuleAsteroid Used to create procedural asteroids.
ModuleAsteroidAnalysis Provides mining resource information to ModuleAnalysisResource for procedural asteroids.
ModuleAsteroidDrill Used in mining drills to allow resource (ore) extraction from procedural asteroids.
ModuleAsteroidInfo Provides right-click information for procedural asteroid mass and resources.
ModuleAsteroidResource Used in procedural asteroids to provide mining resource abundance information for the given resourceName, ore.
ModuleBiomeScanner Used in the Surface Scanning Module to provide resource analysis of a biome.
ModuleCargoBay Used in cargo bays. Controls whether parts inside the bay are shielded from aerodynamic effects.
ModuleCommand Deals with allowing control of a vessel, e.g. in a crew pod or probe core, changing the control point via "Control From Here", as well as renaming the vessel.
ModuleConductionMultiplier Modifies how heat conducts between the part and parts connected to it.
ModuleControlSurface Used for controllable aerodynamic surfaces such as ailerons and fins.
ModuleCoreHeat Used to provide a separate heat area (i.e. not internal or surface) for parts which have high internal temperatures that don't easily conduct through to nearby parts. Used in the RTG, resource harvesters and resource converters.
ModuleDataTransmitter Transmits science data in exchange for electric charge.
ModuleDecouple Used in decouplers to break the connection of the specified attach node.
ModuleDeployableRadiator Used in deployable radiators to provide deployment animation control, sun tracking animation and heat removal.
ModuleDeployableSolarPanel Used in deployable solar panels to provide deployment animation control, sun tracking animation and electric charge generation.
ModuleDisplaceTweak Unknown. Appears unused.
ModuleDockingNode Used in docking ports to provide docking functionality, such as merging two craft into one or splitting them apart, and the docking attraction force between ports. Supports gendered docking ports and angle snap, although these are currently unused in stock KSP.
ModuleDragModifier Used in parachutes to override their debloyed and semideployed drag cube to generate additional drag force.
ModuleEffectTest Unknown. Appears unused.
ModuleEngines This part module has been made obsolete by ModuleEnginesFX. It provides thrust in exchange for a propellant resource.
ModuleEnginesFX An upgraded version of ModuleEngines which provides support for EFFECTS nodes (particle and sound effects).
ModuleEnviroSensor Provides data in the part's right-click menu in exchange for electric charge. The data displayed is determined by sensorType, which can be TEMP (temperature), GRAV (gravity), ACC (accelleration), or PRES (pressure).
ModuleFuelJettison Used in mining resource tanks to destroy contained resources.
ModuleGenerator Creates the specified OUTPUT_RESOURCE at the given rate. Used in the RTG and launch clamps.
ModuleGimbal Provides engine gimballing, i.e. the ability to change the direction thrust leaves an engine.
ModuleGPS Used in the M4435 Narrow-Band Scanner and Surface Scanning Module to provide latitude, longitude, biome and body information to the right-click menu.
ModuleGrappleNode Used in the Advanced Grabbing Unit to dock with other vessels without requiring a docking port on the other vessel.
ModuleHandle Included for clarification, this isn't actually a part of KSP or Unity, but .NET. [here for details].
ModuleHighDefCamera Used in the M4435 Narrow-Band Scanner to draw resource information onto bodies.
ModuleJettison Used to provide a jettisonable interstage fairing over parts such as engines. Provides the "Jettison" right-click menu option.
ModuleJointMotor Unknown. Appears unused.
ModuleJointMotorTest Unknown. Appears unused.
ModuleJointPivot Unknown. Appears unused.
ModuleLandingGear (old wheel system) Used in aircraft landing wheels. Controls deploy/retract animations, braking, suspension and headlights.
ModuleLandingGearFixed Used in aircraft landing wheels that can't be retracted. Controls braking and suspension.
ModuleLandingLeg Used in deployable landing legs. Makes use of [[2]] to provide suspension damping.
ModuleLiftingSurface Used in wings to define the amount of lift and drag created.
ModuleLight Used in spotlight parts to create a light source which uses electric charge when active. User colour controls and an animation control to toggle the appearance of the light when active are also provided.
ModuleOrbitalScanner  ??
ModuleOrbitalSurveyor  ??
ModuleOverheadDisplay  ??
ModuleParachute  ??
ModulePhysicMaterial Unknown. Appears unused.
ModuleProceduralFairing  ??
ModuleRCS Used to provide Reaction Control System engines, using a separate player control scheme to regular engines.
ModuleReactionWheel Used in reaction wheels to provide torque used to steer the craft in exchange for consuming a resource (normally electric charge).
ModuleRemoteController Unknown. Appears unused.
ModuleResource Unknown. Appears unused.
ModuleResourceConverter  ??
ModuleResourceHarvester  ??
ModuleResourceIntake Used in air intakes to generate a resource when flying through a body's atmosphere, usually intake air.
ModuleResourceScanner  ??
ModuleRotatingJoint  ??
ModuleSampleCollector  ??
ModuleSampleContainer  ??
ModuleSAS  ??
ModuleScienceContainer  ??
ModuleScienceConverter  ??
ModuleScienceExperiment  ??
ModuleScienceLab  ??
ModuleSeeThroughObject Used in the service bays (1.25m and 2.5m) to allow the part to fade (using the shader specified in shaderName) to transparency on mouseover when in the VAB or SPH, allowing the user to see the contents when the doors are closed.
ModuleStatusLight  ??
ModuleSteering (old wheel system) Adds the ability to steer aircraft landing gear wheels to part modules implementing ISteerable, such as ModuleLandingGear and ModuleLandingGearFixed.
ModuleSurfaceFX Used with engines to provide dust effects when pointed at the ground, ocean or launchpad.
ModuleTestSubject Marks this part as being suitable for selection for generating part test missions. Specifies the constraints under which these missions should be defined (i.e. don't ask the player to test air-breathing engines in space or docking clamps on the Mun).
ModuleToggleCrossfeed Allows the right-click option to toggle whether fuel can pass through this part.
ModuleTripLogger Unknown. Appears unused.
ModuleWheel (Obsolete; old wheel system) Used for rover wheels (not aircraft landing wheels) to control wheels which accept a resource (usually electric charge) and produce torque (i.e. the wheels can accelerate the craft). Also controls steering and suspension.
ModuleWheelBase This is the base for any wheeled part. It handles creating and setting up the VPP wheel controller and wheel collider, handles basic wheel parameters and sets up default values for anything not handled by a submodule. It also handles the tire mesh update and tire friction parameters. Added in 1.1's new wheel system.
ModuleWheelBogey  ?? New wheel system.
ModuleWheelBrakes This submodule manages the brakes on a wheel. If omitted, the wheel will have no brakes. Added in 1.1's new wheel system.
ModuleWheelDamage Wheels that are able to be damaged implement this submodule, which handles the stress simulation and damage states. Wheel stress has also been greatly rewritten. Of old, wheel stress was for the most part a function of vessel speed. Now, wheel damage is based on wheel load and slip. Excessively loaded wheels may pop under the least provocation, while doing donuts around KSC with a lightly loaded set of wheels may also end up in broken tires, and anything in between. Added in 1.1's new wheel system.
ModuleWheelDeployment This handles the wheel's ability to deploy and retract, manages the deployment animation and toggles the wheel on/off when it is extended or retracted. Added in 1.1's new wheel system.
ModuleWheelLock  ?? New wheel system.
ModuleWheelMotor This submodule adds motor functionality to a wheel. Motorized wheels now drain EC in proportion to how much torque they are outputting (which tapers down as the vehicle approaches its top speed), and also have tweakable traction control. Motors also be toggled and inverted. Added in 1.1's new wheel system.
ModuleWheelMotorSteering This submodule extends the ModuleWheelMotor submodule itself, providing differential steering functionality as well as driving, using the same motor logic as other motorized wheels (only the XL-3 rover wheels use differential steering in stock KSP). Added in 1.1's new wheel system.
ModuleWheelSteering This submodule handles the steering functionality for a wheel. If omitted, the wheel won't be steerable. The steering logic has been rewritten from scratch to be much smarter, and now supports Ackermann steering with any number of wheels. In game, steering can be toggled on/off, as well as inverted, for each set of wheels. Added in 1.1's new wheel system.
ModuleWheelSubmodule Submodules are the core of the new wheel system. ModuleWheelSteering, ModuleWheelMotor, ModuleWheelSuspension, ModuleWheelBrakes, ModuleWheelDeployment, ModuleWheelDamage and ModuleWheelMotorSteering extend this base class. Added in 1.1's new wheel system.
ModuleWheelSuspension This submodule handles the suspension system for the wheel. This feature was the most improved, as suspensions were the most broken aspect of the new unity5 wheel colliders. The new suspension system is self-tuning. The spring force and damper values are adjusted in realtime based on the vessel mass and observed suspension compression, so the suspension is always springy and able to support the load of the vessel, regardless of its design. Added in 1.1's new wheel system.