Difference between revisions of "API:PartModule"

From Kerbal Space Program Wiki
Jump to: navigation, search
(Added more details about when each method is called. Incomplete.)
m (Blanked the page)
Line 1: Line 1:
<!-- 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 ===
 
Called during the main menu loading stage.
 
<syntaxhighlight>
 
using System;
 
using UnityEngine;
 
  
public class RandomPart : PartModule
 
{
 
public override void OnAwake()
 
{
 
Debug.Log("Hello World");
 
}
 
}
 
</syntaxhighlight>
 
{{Properties|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|
 
{{Field
 
  |type=bool
 
  |name=isEnabled
 
  |desc=The part state.
 
}}
 
{{Field
 
  |type=string
 
  |name=moduleName
 
  |desc=The module's name.
 
}}
 
{{Field
 
  |type=ProtoPartModuleSnapshot
 
  |name=snapshot
 
  |desc=?
 
}}
 
}}
 
{{Methods|
 
{{Method
 
  |returntype=constructor
 
  |returndesc=
 
  |name=PartModule
 
  |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.  Not called in VAB or when on launch pad, but is called when stage is started, assuming that activates the module.
 
}}
 
{{Method
 
  |returntype=virtual void
 
  |returndesc=
 
  |name=OnAwake
 
  |args=
 
  |desc=Called when the part is loaded, this can be more than once.  Called when part is selected in VAB, and also when switching from VAB to launch pad.
 
}}
 
{{Method
 
  |returntype=virtual void
 
  |returndesc=
 
  |name=OnFixedUpdate
 
  |args=
 
  |desc=Per-PhysX frame update, Called only when the part is active!
 
}}
 
{{Method
 
  |returntype=virtual void
 
  |returndesc=
 
  |name=OnInactive
 
  |args=
 
  |desc=Get the part information.
 
}}
 
{{Method
 
  |returntype=virtual void
 
  |returndesc=
 
  |name=OnInitialize
 
  |args=
 
  |desc=Called when part is selected in VAB, switching to launch pad or loading from a save.
 
}}
 
{{Method
 
  |returntype=virtual void
 
  |returndesc=
 
  |name=OnLoad
 
  |args={{arg|ConfigNode|node}}
 
  |desc=Called when the object is loaded from a save.
 
}}
 
{{Method
 
  |returntype=virtual void
 
  |returndesc=
 
  |name=OnSave
 
  |args={{arg|ConfigNode|node}}
 
  |desc=Called when the object is saved, which happens with any change in VAB, when switching to launch pad, and during auto saving.
 
}}
 
{{Method
 
  |returntype=virtual void
 
  |returndesc=
 
  |name=OnStart
 
  |args={{arg|StartState|state}}
 
  |desc=Called when entering VAB (with arg Editor), launch pad (with arg PreLaunch | Landed), or loading from save.
 
}}
 
{{Method
 
  |returntype=virtual void
 
  |returndesc=
 
  |name=OnUpdate
 
  |args=
 
  |desc=Called when OnUpdate is called on the part.
 
}}
 
{{Method
 
  |returntype=void
 
  |returndesc=
 
  |name=Save
 
  |args={{arg|ConfigNode|node}}
 
  |desc=?
 
}}
 
}}
 
{{Enums|enums=
 
{{Enum
 
  |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<br/>
 
}}
 
}}
 
 
[[Category:Community API Documentation]]
 

Revision as of 17:44, 17 March 2017