C# Class kOS.Utilities.Utils

Afficher le fichier Open project: KSP-KOS/KOS

Méthodes publiques

Méthode Description
BodyOrbitsBody ( CelestialBody a, CelestialBody b ) : System.Boolean

Returns true if body a orbits body b, either directly or through a grandparent chain.

DegreeFix ( double inAngle, double rangeStart ) : double

Fix the strange too-large or too-small angle degrees that are sometimes returned by KSP, normalizing them into a constrained 360 degree range.

DegreesToRadians ( double degrees ) : double
GetAssemblyFileVersion ( ) : string
GetCurrentCamera ( ) : Camera
GetSkinCopy ( GUISkin toCopy ) : GUISkin
IsResource ( string insensitiveName, int &foundId ) : bool

Determines if a given case insensitive name corresponds with a defined resource, and outputs the resource id for easy access from Squad's lists.

IsResource ( string insensitiveName, string &fixedName ) : bool

Determines if a given case insensitive name corresponds with a defined resource, and outputs the case sensitive name for easy access from Squad's lists.

IsValidNumber ( double input ) : bool
IsValidRotation ( Quaternion quaternion ) : bool
IsValidVector ( kOS.Suffixed.Vector vector ) : bool
IsValidVector ( Vector3 vector ) : bool
IsValidVector ( UnityEngine.Vector3d vector ) : bool
KOSExtensionGetObtVelocity ( this body, SharedObjects shared ) : UnityEngine.Vector3d

Meant to be an override for stock KSP's CelestialBody.GetObtVelocity(), which (literally) always stack overflows because it's implemented as just infinite recursion without a base case.
Returns the celestial body's velocity relative to the current universe's SOI body. It's identical to body.orbit.GetVel() except that it also works for The Sun, which normally can't call that because it's orbit is null.

KOSExtensionGetParentBody ( this body ) : CelestialBody

Return the parent body of this body, just like KSP's built-in referenceBody, except that it exhibits more sane behavior in the case of the Sun where there is no parent. Default KSP's referenceBody will sometimes return null and sometimes return the Sun itself as the parent of the Sun. This makes it always return null as the parent of the Sun no matter what.

KOSType ( Type type ) : string

Given any CSharp object, return the string name of the type in a way that makes more sense to kOS users, using kOS names rather than Csharp names.

RadiansToDegrees ( double radians ) : double

Private Methods

Méthode Description
GetActualAttachedNodes ( Part checkPart ) : IEnumerable

Gets the *actual* list of attachnodes for a part. Use as a replacement for the KSP API property part.attachNodes because that doesn't seem to reliably include the surface attached attachnodes all of the time.

Method Details

BodyOrbitsBody() public static méthode

Returns true if body a orbits body b, either directly or through a grandparent chain.
public static BodyOrbitsBody ( CelestialBody a, CelestialBody b ) : System.Boolean
a CelestialBody Does this body
b CelestialBody Orbit around this body
Résultat System.Boolean

DegreeFix() public static méthode

Fix the strange too-large or too-small angle degrees that are sometimes returned by KSP, normalizing them into a constrained 360 degree range.
public static DegreeFix ( double inAngle, double rangeStart ) : double
inAngle double input angle in degrees
rangeStart double /// Bottom of 360 degree range to normalize to. /// ( 0 means the range [0..360]), while -180 means [-180,180] ) ///
Résultat double

DegreesToRadians() public static méthode

public static DegreesToRadians ( double degrees ) : double
degrees double
Résultat double

GetAssemblyFileVersion() public static méthode

public static GetAssemblyFileVersion ( ) : string
Résultat string

GetCurrentCamera() public static méthode

public static GetCurrentCamera ( ) : Camera
Résultat UnityEngine.Camera

GetSkinCopy() public static méthode

public static GetSkinCopy ( GUISkin toCopy ) : GUISkin
toCopy UnityEngine.GUISkin
Résultat UnityEngine.GUISkin

IsResource() public static méthode

Determines if a given case insensitive name corresponds with a defined resource, and outputs the resource id for easy access from Squad's lists.
public static IsResource ( string insensitiveName, int &foundId ) : bool
insensitiveName string case insensitive name
foundId int output id of the found resource, zero if none found
Résultat bool

IsResource() public static méthode

Determines if a given case insensitive name corresponds with a defined resource, and outputs the case sensitive name for easy access from Squad's lists.
public static IsResource ( string insensitiveName, string &fixedName ) : bool
insensitiveName string case insensitive name
fixedName string output case sensitive name
Résultat bool

IsValidNumber() public static méthode

public static IsValidNumber ( double input ) : bool
input double
Résultat bool

IsValidRotation() public static méthode

public static IsValidRotation ( Quaternion quaternion ) : bool
quaternion UnityEngine.Quaternion
Résultat bool

IsValidVector() public static méthode

public static IsValidVector ( kOS.Suffixed.Vector vector ) : bool
vector kOS.Suffixed.Vector
Résultat bool

IsValidVector() public static méthode

public static IsValidVector ( Vector3 vector ) : bool
vector Vector3
Résultat bool

IsValidVector() public static méthode

public static IsValidVector ( UnityEngine.Vector3d vector ) : bool
vector UnityEngine.Vector3d
Résultat bool

KOSExtensionGetObtVelocity() public static méthode

Meant to be an override for stock KSP's CelestialBody.GetObtVelocity(), which (literally) always stack overflows because it's implemented as just infinite recursion without a base case.
Returns the celestial body's velocity relative to the current universe's SOI body. It's identical to body.orbit.GetVel() except that it also works for The Sun, which normally can't call that because it's orbit is null.
public static KOSExtensionGetObtVelocity ( this body, SharedObjects shared ) : UnityEngine.Vector3d
body this The body to get the value for. (this will be hidden when this is an extension method of CelestialBody).
shared SharedObjects Ubiquitous shared objects
Résultat UnityEngine.Vector3d

KOSExtensionGetParentBody() public static méthode

Return the parent body of this body, just like KSP's built-in referenceBody, except that it exhibits more sane behavior in the case of the Sun where there is no parent. Default KSP's referenceBody will sometimes return null and sometimes return the Sun itself as the parent of the Sun. This makes it always return null as the parent of the Sun no matter what.
public static KOSExtensionGetParentBody ( this body ) : CelestialBody
body this Body to get parent of (this will be hidden when called as an extension method)
Résultat CelestialBody

KOSType() public static méthode

Given any CSharp object, return the string name of the type in a way that makes more sense to kOS users, using kOS names rather than Csharp names.
public static KOSType ( Type type ) : string
type System.Type native c-sharp object
Résultat string

RadiansToDegrees() public static méthode

public static RadiansToDegrees ( double radians ) : double
radians double
Résultat double