Difference between revisions of "API:PartModule"
From Kerbal Space Program Wiki
(→Example) |
|||
Line 9: | Line 9: | ||
'''The properties of this class have not been added.''' | '''The properties of this class have not been added.''' | ||
+ | }} | ||
+ | <!-- Class tables autogenerated against KSP 1.04 by Glyph's kerbal_wiki_pdoc program. --> | ||
+ | {{Class | ||
+ | |inherits={{Type|MonoBehaviour}} | ||
+ | |implements=<ul></ul> | ||
+ | |name=PartModule | ||
+ | |summary=The '''PartModule''' class allows you to override its functions to intuitively control your parts. | ||
}} | }} | ||
=== Example === | === Example === | ||
Line 24: | Line 31: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | {{Properties| | |
+ | {{Property | ||
+ | |type=BaseActionList | ||
+ | |name=Actions | ||
+ | |desc=? | ||
+ | |hasget=1 | ||
+ | |hasset= | ||
+ | }} | ||
+ | {{Property | ||
+ | |type=int | ||
+ | |name=ClassID | ||
+ | |desc=? | ||
+ | |hasget=1 | ||
+ | |hasset= | ||
+ | }} | ||
+ | {{Property | ||
+ | |type=string | ||
+ | |name=ClassName | ||
+ | |desc=? | ||
+ | |hasget=1 | ||
+ | |hasset= | ||
+ | }} | ||
+ | {{Property | ||
+ | |type=BaseEventList | ||
+ | |name=Events | ||
+ | |desc=? | ||
+ | |hasget=1 | ||
+ | |hasset= | ||
+ | }} | ||
+ | {{Property | ||
+ | |type=BaseFieldList | ||
+ | |name=Fields | ||
+ | |desc=? | ||
+ | |hasget=1 | ||
+ | |hasset= | ||
+ | }} | ||
+ | {{Property | ||
+ | |type=string | ||
+ | |name=GUIName | ||
+ | |desc=? | ||
+ | |hasget=1 | ||
+ | |hasset= | ||
+ | }} | ||
+ | {{Property | ||
+ | |type=Part | ||
+ | |name=part | ||
+ | |desc=? | ||
+ | |hasget=1 | ||
+ | |hasset=1 | ||
+ | }} | ||
+ | {{Property | ||
+ | |type=Vessel | ||
+ | |name=vessel | ||
+ | |desc=? | ||
+ | |hasget=1 | ||
+ | |hasset= | ||
+ | }} | ||
+ | }} | ||
{{Fields| | {{Fields| | ||
{{Field | {{Field | ||
− | | | + | |type=bool |
− | | | + | |name=isEnabled |
− | |desc= | + | |desc=The part state. |
}} | }} | ||
− | |||
{{Field | {{Field | ||
− | | | + | |type=string |
− | | | + | |name=moduleName |
− | |desc=The | + | |desc=The module's name. |
}} | }} | ||
− | |||
{{Field | {{Field | ||
− | | | + | |type=ProtoPartModuleSnapshot |
− | | | + | |name=snapshot |
− | |desc= | + | |desc=? |
}} | }} | ||
}} | }} | ||
− | |||
{{Methods| | {{Methods| | ||
{{Method | {{Method | ||
− | |name= | + | |returntype=constructor |
− | |returntype=void | + | |returndesc= |
− | |args={{ | + | |name=PartModule |
− | |desc=Called | + | |args= |
+ | |desc=? | ||
+ | }} | ||
+ | {{Method | ||
+ | |returntype=virtual string | ||
+ | |returndesc= | ||
+ | |name=GetInfo | ||
+ | |args= | ||
+ | |desc=Returns the part information displayed in the part list mouse-over information box. | ||
+ | }} | ||
+ | {{Method | ||
+ | |returntype=void | ||
+ | |returndesc= | ||
+ | |name=Load | ||
+ | |args={{arg|ConfigNode|node}} | ||
+ | |desc=? | ||
+ | }} | ||
+ | {{Method | ||
+ | |returntype=virtual void | ||
+ | |returndesc= | ||
+ | |name=OnActive | ||
+ | |args= | ||
+ | |desc=Called when the part is active. | ||
+ | }} | ||
+ | {{Method | ||
+ | |returntype=virtual void | ||
+ | |returndesc= | ||
+ | |name=OnAwake | ||
+ | |args= | ||
+ | |desc=Called when the part is loaded, this can be more than once. | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
− | |name= | + | |returntype=virtual void |
− | | | + | |returndesc= |
− | |desc=Called when | + | |name=OnFixedUpdate |
+ | |args= | ||
+ | |desc=Per-PhysX frame update, Called only when the part is active! | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
− | |name= | + | |returntype=virtual void |
− | | | + | |returndesc= |
− | |desc= | + | |name=OnInactive |
+ | |args= | ||
+ | |desc=Get the part information. | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
− | |name= | + | |returntype=virtual void |
− | | | + | |returndesc= |
− | |desc= | + | |name=OnInitialize |
+ | |args= | ||
+ | |desc=? | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
− | |name= | + | |returntype=virtual void |
− | | | + | |returndesc= |
− | |desc=Called when the | + | |name=OnLoad |
+ | |args={{arg|ConfigNode|node}} | ||
+ | |desc=Called when the object is loaded from a save. | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
− | |name= | + | |returntype=virtual void |
− | | | + | |returndesc= |
− | |desc= | + | |name=OnSave |
+ | |args={{arg|ConfigNode|node}} | ||
+ | |desc=Called when the object is saved. | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
− | | | + | |returntype=virtual void |
− | | | + | |returndesc= |
− | |args={{ | + | |name=OnStart |
− | |desc=Called | + | |args={{arg|StartState|state}} |
+ | |desc=Called during the part startup. | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
− | | | + | |returntype=virtual void |
− | | | + | |returndesc= |
− | |args= | + | |name=OnUpdate |
− | |desc=Called when the | + | |args= |
+ | |desc=Called when OnUpdate is called on the part. | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
− | |name= | + | |returntype=void |
− | | | + | |returndesc= |
− | |desc= | + | |name=Save |
+ | |args={{arg|ConfigNode|node}} | ||
+ | |desc=? | ||
+ | }} | ||
+ | }} | ||
+ | {{Enums| | ||
+ | {{Enum | ||
+ | |name=StartState | ||
+ | |values={ None, Editor, PreLaunch, Landed = 4, Docked = 8, Flying = 16, Splashed = 32, SubOrbital = 64, Orbital = 128 } | ||
}} | }} | ||
}} | }} | ||
[[Category:Community API Documentation]] | [[Category:Community API Documentation]] |
Revision as of 22:01, 13 October 2015
The PartModule consits of two types:
- PartModule class
- StartState enum
Contents
PartModule Class
Inherits | Implements |
---|---|
|
The PartModule class allows you to override its functions to intuitively control your parts.
The properties of this class have not been added.
PartModule Class
Inherits | Implements |
---|---|
MonoBehaviour | |
The PartModule class allows you to override its functions to intuitively control your parts.
Example
Called during the main menu loading stage.
using System; using UnityEngine; public class RandomPart : PartModule { public override void OnAwake() { Debug.Log("Hello World"); } }
Properties
The following is a list of properties in PartModule.
Name | Description
{{{properties}}} |
---|
Fields
The following is a list of fields in PartModule.
Signature | Description |
---|---|
bool isEnabled | The part state. |
string moduleName | The module's name. |
ProtoPartModuleSnapshot snapshot | ? |
Methods
The following are methods included in PartModule.
Signature | Description |
---|---|
constructor PartModule() | ? |
virtual string GetInfo() | Returns the part information displayed in the part list mouse-over information box. |
void Load(ConfigNode node) | ? |
virtual void OnActive() | Called when the part is active. |
virtual void OnAwake() | Called when the part is loaded, this can be more than once. |
virtual void OnFixedUpdate() | Per-PhysX frame update, Called only when the part is active! |
virtual void OnInactive() | Get the part information. |
virtual void OnInitialize() | ? |
virtual void OnLoad(ConfigNode node) | Called when the object is loaded from a save. |
virtual void OnSave(ConfigNode node) | Called when the object is saved. |
virtual void OnStart(StartState state) | Called during the part startup. |
virtual void OnUpdate() | Called when OnUpdate is called on the part. |
void Save(ConfigNode node) | ? |
Enumerations
The following is a list of enumerations in PartModule.
Name | Values
{{{enums}}} |
---|