Difference between revisions of "API:PartModule"

From Kerbal Space Program Wiki
Jump to: navigation, search
Line 191: Line 191:
 
{{Enum
 
{{Enum
 
   |name=StartState
 
   |name=StartState
   |values=None<br/>Editor<br/>PreLaunch<br/>Landed = 4<br/>Docked = 8<br/>Flying = 16<br/>Splashed = 32<br/>SubOrbital = 64<br/>Orbital = 128
+
   |values=None<br/>Editor<br/>PreLaunch<br/>Landed = 4<br/>Docked = 8<br/>Flying = 16<br/>Splashed = 32<br/>SubOrbital = 64<br/>Orbital = 128<br/>
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Community API Documentation]]
 
[[Category:Community API Documentation]]

Revision as of 08:11, 14 October 2015

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}}}