C# Class kOS.Module.kOSVesselModule

The kOSVesselModule class contains references to anything that is vessel specific rather than processor part specific. For instance, flight controls and steering. It gives a single location to manage instances where docking, staging, and similar events should be handled automatically.
Inheritance: VesselModule
Afficher le fichier Open project: KSP-KOS/KOS Class Usage Examples

Méthodes publiques

Méthode Description
AddFlightControlParameter ( string name, IFlightControlParameter parameter ) : void

Adds an IFlightControlParameter to the reference dictionary, and throws an error if it already exists.

FixedUpdate ( ) : void

FixedUpdate is called once per physics tick.

GetFlightControlParameter ( string name ) : IFlightControlParameter

Returns the named IFlightControlParameter

GetInstance ( Vessel vessel ) : kOSVesselModule

Return the kOSVesselModule instance associated with the given Vessel object

HasFlightControlParameter ( string name ) : bool

Returns true if the named IFlightControlParameter already exists

LastUpdate ( ) : void

LastUpdate is called at the end of the update frame. Useful if something needs to be done after the physics and UI updates have been completed, but before scene or gui rendering.

OnDestroy ( ) : void

OnDestroy is called when the Vessel object is destroyed. This is the last method called by KSP. We can remove the instance tracking and unhook events here.

OnGUI ( ) : void

OnGUI is where any vessel specific interface rendering should be done.

RemoveFlightControlParameter ( string name ) : void

Removes the named IFlightControlParameter from the reference dictionary.

Update ( ) : void

Update is called once per UI tick.

Méthodes protégées

Méthode Description
OnAwake ( ) : void

OnAwake is called once when instatiating a new VesselModule. This is the first method called by KSP after the VesselModule has been attached to the parent Vessel. We use it to store the parent Vessel and track the kOSVesselModule instances.

OnLoad ( ConfigNode node ) : void
OnStart ( ) : void

Start is called after OnEnable activates the module. This is the second method called by KSP after Awake. All parts should be added to the vessel now, so it is safe to walk the parts tree to find the attached kOSProcessor modules.

Private Methods

Méthode Description
AddDefaultParameters ( ) : void

Setup the default flight parameters.

CheckRehookAutopilot ( ) : void

A race condition exists where KSP can load the kOS module onto the vessel before it loaded the RemoteTech module. That makes it so that kOS may not see the existence of RT yet when kOS is first initialized.

This fixes that case by continually re-querying for RT post-loading, and re-initializing kOS's RT-related behaviors if it seems that the RT module now exists when it didn't before (or visa versa).
With the update for KSP 1.2, this function was renamed and made more generic so that it may support future autopilot connectivity configurations.

ClearParts ( ) : void

Clear the childParts list. This is used when refreshing the parts list, or when destroying the module.

HandleOnPreAutopilotUpdate ( FlightCtrlState c ) : void
HandleRemoteTechSanctionedPilot ( FlightCtrlState c ) : void
HarvestParts ( ) : void

Generates a list of all processorModules included on the parentVessel.

HookEvents ( ) : void

Hook up to any vessel/game events that might be needed.

UnHookEvents ( ) : void

Unhook from events we previously hooked up to.

UpdateAutopilot ( FlightCtrlState c ) : void

Call to each IFlightControlParameter to update the flight controls. This is called during OnPreAutopilotUpdate

UpdateParameterState ( ) : void

Update the current stte of the each IFlightControlParameter. This is called during FixedUpdate

cacheControllable ( ) : void
resetControllable ( ) : void

Method Details

AddFlightControlParameter() public méthode

Adds an IFlightControlParameter to the reference dictionary, and throws an error if it already exists.
public AddFlightControlParameter ( string name, IFlightControlParameter parameter ) : void
name string the bound name of the parameter, this will be converted to lower case internally
parameter IFlightControlParameter
Résultat void

FixedUpdate() public méthode

FixedUpdate is called once per physics tick.
public FixedUpdate ( ) : void
Résultat void

GetFlightControlParameter() public méthode

Returns the named IFlightControlParameter
public GetFlightControlParameter ( string name ) : IFlightControlParameter
name string the bound name of the parameter, this will be converted to lower case internally
Résultat IFlightControlParameter

GetInstance() public static méthode

Return the kOSVesselModule instance associated with the given Vessel object
public static GetInstance ( Vessel vessel ) : kOSVesselModule
vessel Vessel the vessel for which the module should be returned
Résultat kOSVesselModule

HasFlightControlParameter() public méthode

Returns true if the named IFlightControlParameter already exists
public HasFlightControlParameter ( string name ) : bool
name string the bound name of the parameter, this will be converted to lower case internally
Résultat bool

LastUpdate() public méthode

LastUpdate is called at the end of the update frame. Useful if something needs to be done after the physics and UI updates have been completed, but before scene or gui rendering.
public LastUpdate ( ) : void
Résultat void

OnAwake() protected méthode

OnAwake is called once when instatiating a new VesselModule. This is the first method called by KSP after the VesselModule has been attached to the parent Vessel. We use it to store the parent Vessel and track the kOSVesselModule instances.
protected OnAwake ( ) : void
Résultat void

OnDestroy() public méthode

OnDestroy is called when the Vessel object is destroyed. This is the last method called by KSP. We can remove the instance tracking and unhook events here.
public OnDestroy ( ) : void
Résultat void

OnGUI() public méthode

OnGUI is where any vessel specific interface rendering should be done.
public OnGUI ( ) : void
Résultat void

OnLoad() protected méthode

protected OnLoad ( ConfigNode node ) : void
node System.ConfigNode
Résultat void

OnStart() protected méthode

Start is called after OnEnable activates the module. This is the second method called by KSP after Awake. All parts should be added to the vessel now, so it is safe to walk the parts tree to find the attached kOSProcessor modules.
protected OnStart ( ) : void
Résultat void

RemoveFlightControlParameter() public méthode

Removes the named IFlightControlParameter from the reference dictionary.
public RemoveFlightControlParameter ( string name ) : void
name string the bound name of the parameter, this will be converted to lower case internally
Résultat void

Update() public méthode

Update is called once per UI tick.
public Update ( ) : void
Résultat void