Difference between revisions of "API:PartModule"

From Kerbal Space Program Wiki
Jump to: navigation, search
(Put it at least into a list format :/. It's super wrong right now, but I couldn't figure out how to make it better. Someone help!)
Line 108: Line 108:
 
}}
 
}}
  
[[Category:Community API Documentation]]
 
  
  
 +
{{Fields|
 
{{Field
 
{{Field
 
|name=Docked
 
|name=Docked
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=Part started while docked.
 
}}
 
}}
  
Line 119: Line 120:
 
|name=Editor
 
|name=Editor
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=Part started in editor.
 
}}
 
}}
  
Line 124: Line 126:
 
|name=Flying
 
|name=Flying
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=Part started while flying.
 
}}
 
}}
  
Line 130: Line 133:
 
|name=Landed
 
|name=Landed
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=Part started landed on a planet.
 
}}
 
}}
  
Line 136: Line 140:
 
|name=None
 
|name=None
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=The part state is unknown.
 
}}
 
}}
  
Line 141: Line 146:
 
|name=Orbital
 
|name=Orbital
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=The part started in orbit.
 
}}
 
}}
  
Line 146: Line 152:
 
|name=PreLaunch
 
|name=PreLaunch
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=The part started before launch.
 
}}
 
}}
  
Line 152: Line 159:
 
|name=Splashed
 
|name=Splashed
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=The part started in the water.
 
}}
 
}}
  
Line 158: Line 166:
 
|name=SubOrbital
 
|name=SubOrbital
 
|type=PartModule.StartState
 
|type=PartModule.StartState
 +
|desc=The part started in a sub orbital atmosphere.
 
}}
 
}}
 +
 +
}}
 +
 +
[[Category:Community API Documentation]]

Revision as of 23:56, 27 April 2013

PartModule Class

Inherits Implements
  • MonoBehaviour

The PartModule class allows you to override its functions to intuitively control your parts.

The properties of this class have not been added.

Example

Called during the main menu loading stage.

using System;
using UnityEngine;
 
public class RandomPart : PartModule
{
	public override void OnAwake()
	{
		Debug.Log("Hello World");
	}
}

Fields

The following is a list of fields in PartModule.

Signature Description
ProtoPartModuleSnapshot snapshot Unknown
string moduleName The modules name
bool isEnabled The part state.

Methods

The following are methods included in PartModule.

Signature Description
void OnStart(PartModule.StartState state) Called during the part startup.
void OnUpdate() Called when OnUpdate is called on the part.
void OnAwake() Called when the part is loaded, this can be more than once.
void OnFixedUpdate() Per-PhysX frame update, Called only when the part is active!
void OnActive() Called when the part is active.
void OnInactive() Get the part information.
void OnLoad(ConfigNode node) Called when the object is loaded from a save.
void OnSave(ConfigNode node) Called when the object is saved.
string GetInfo() Returns the part information.


|- | StartState | Enum template: values parameter missing


Fields

The following is a list of fields in PartModule.

Signature Description
PartModule.StartState Docked Part started while docked.
PartModule.StartState Editor Part started in editor.
PartModule.StartState Flying Part started while flying.


PartModule.StartState Landed Part started landed on a planet.


PartModule.StartState None The part state is unknown.
PartModule.StartState Orbital The part started in orbit.
PartModule.StartState PreLaunch The part started before launch.


PartModule.StartState Splashed The part started in the water.


PartModule.StartState SubOrbital The part started in a sub orbital atmosphere.