Click or drag to resize

PartModuleUtilsGetAction Method

Returns an action for the requested method.

Namespace:  KSPDev.PartUtils
Assembly:  KSPDev_Utils.1.1 (in KSPDev_Utils.1.1.dll) Version: 1.1 for KSP v1.6+
Syntax
C#
public static BaseAction GetAction(
	PartModule partModule,
	Action<KSPActionParam> actionFn
)
Request Example View Source

Parameters

partModule
Type: (Default Namespace)PartModule
The module to find the action in.
actionFn
Type: SystemActionKSPActionParam
The actions's method signature.

Return Value

Type: BaseAction
An action, or null if nothing found for the method provided.
Remarks
This method requests a KPS action of the part's module by its signature instead of a string literal name. The same result could be achieved by accessing the Actions field of the PartModule object. However, in case of using a string literal the refactoring and the source tracking tools won't be able to track the reference. The main goal of this method is to provide a compile time checking mechanism for the cases when the exact method is known at the compile time (e.g. in the class descendants).
See Also