KSP API
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Public Member Functions | Public Attributes | Properties | List of all members
DiscoveryInfo Class Reference

Represents the "remote sensing" information available for an IDiscoverable More...

Public Member Functions

 DiscoveryInfo (IDiscoverable host, DiscoveryLevels level, double untrackedLifetime)
 Initializes a Class C asteroid More...
 
 DiscoveryInfo (IDiscoverable host, double untrackedLifetime)
 Initializes a Class C asteroid, and assumes all properties are already known. More...
 
 DiscoveryInfo (IDiscoverable host)
 Initializes a Class C asteroid, and assumes all properties are already known. More...
 
static string GetSignalStrengthCaption (double signal)
 Returns a text description of the signal strength More...
 
static string GetSizeClassDescription (UntrackedObjectClass sizeClass)
 Returns long description of asteroid type More...
 
static string GetSizeClassSizes (UntrackedObjectClass sizeClass)
 Returns asteroid size displayed in map view More...
 
double GetSignalLife (double UT)
 Returns the fraction of the asteroid's unobservedLifetime that remains More...
 
double GetSignalStrength (double UT)
 Returns amount of time remaining until the asteroid is lost, in units of referenceLifetime More...
 
bool HaveKnowledgeAbout (DiscoveryLevels lvl)
 Function testing if an asteroid has a particular discovery level More...
 
void Load (ConfigNode node)
 
void Save (ConfigNode node)
 
void SetLastObservedTime (double UT)
 Logs an asteroid observation More...
 
void SetLevel (DiscoveryLevels level)
 Sets the level of knowledge the player has for the asteroid More...
 
void SetReferenceLifetime (double time)
 Updates the reference lifetime More...
 
void SetUnobservedLifetime (double time)
 Updates the time for which the asteroid can go untracked, preserving class invariants More...
 
void SetUntrackedObjectSize (UntrackedObjectClass size)
 Updates the asteroid size More...
 

Public Attributes

KnowledgeItem< double > distance
 Tracking station wrapper for IDiscoverable.RevealAltitude() More...
 
KnowledgeItem< string > situation
 Tracking station wrapper for IDiscoverable.RevealSituationString() More...
 
KnowledgeItem< double > speed
 Tracking station wrapper for IDiscoverable.RevealSpeed() More...
 
KnowledgeItem< float > mass
 Tracking station wrapper for IDiscoverable.RevealMass() More...
 
KnowledgeItem< string > type
 Tracking station wrapper for IDiscoverable.RevealType() More...
 
KnowledgeItem
< UntrackedObjectClass
size
 Tracking station wrapper for this.objectSize More...
 
KnowledgeItem< string > trackingStatus
 Tracking station wrapper for Level? More...
 
KnowledgeItem< double > signalStrengthPercent
 Tracking station wrapper for GetSignalStrength() More...
 
KnowledgeItem< string > name
 Tracking station wrapper for IDiscoverable.RevealName() More...
 
KnowledgeItem< string > signalStrengthLevel
 Tracking station wrapper for GetSignalStrengthCaption() More...
 

Properties

double fadeUT [get, set]
 The time at which the asteroid is scheduled to be deleted More...
 
double lastObservedTime [get, set]
 The time at which the asteroid was last tracked More...
 
DiscoveryLevels Level [get, set]
 The asteroid's tracking state More...
 
UntrackedObjectClass objectSize [get, set]
 The size class (A-E) of the asteroid More...
 
double referenceLifetime [get, set]
 The time for which an asteroid can go untracked if it starts at full signal strength More...
 
double unobservedLifetime [get, set]
 The time for which the asteroid can go untracked before it is deleted More...
 

Detailed Description

Represents the "remote sensing" information available for an IDiscoverable

<invariant>this.fadeUT = this.lastObservedTime + this.unobservedLifetime</invariant>

Constructor & Destructor Documentation

DiscoveryInfo.DiscoveryInfo ( IDiscoverable  host,
DiscoveryLevels  level,
double  untrackedLifetime 
)

Initializes a Class C asteroid

Parameters
hostThe vessel or celestial body to which this DiscoveryInfo applies
levelThe amount of knowledge for the asteroid
untrackedLifetimeThe amount of time the asteroid can remain untracked before disappearing
DiscoveryInfo.DiscoveryInfo ( IDiscoverable  host,
double  untrackedLifetime 
)

Initializes a Class C asteroid, and assumes all properties are already known.

Parameters
hostThe vessel or celestial body to which this DiscoveryInfo applies
untrackedLifetimeThe amount of time the asteroid can remain untracked before disappearing
DiscoveryInfo.DiscoveryInfo ( IDiscoverable  host)

Initializes a Class C asteroid, and assumes all properties are already known.

Parameters
hostThe vessel or celestial body to which this DiscoveryInfo applies

Member Function Documentation

double DiscoveryInfo.GetSignalLife ( double  UT)

Returns the fraction of the asteroid's unobservedLifetime that remains

Parameters
UTThe time at which the signal life is measured

GetSignalLife(t_discover) == 1.0 GetSignalLife(fadeUT) == 0.0

double DiscoveryInfo.GetSignalStrength ( double  UT)

Returns amount of time remaining until the asteroid is lost, in units of referenceLifetime

Parameters
UTThe time at which the signal strength is measured

GetSignalStrength(t_discover) == unobservedLifetime / referenceLifetime GetSignalStrength(fadeUT) == 0.0

static string DiscoveryInfo.GetSignalStrengthCaption ( double  signal)

Returns a text description of the signal strength

Returns

If signal is in [0.0, 0.2), returns "Very Weak"

If signal is in [0.2, 0.4), returns "Weak"

If signal is in [0.4, 0.6), returns "Average"

If signal is in [0.6, 0.8), returns "Good"

If signal is in [0.8, 1.0], returns "Strong"

static string DiscoveryInfo.GetSizeClassDescription ( UntrackedObjectClass  sizeClass)

Returns long description of asteroid type

Parameters
sizeClassThe asteroid type to label
Returns

The asteroid class explanation printed on the tracking station's info panel.

"Class C Objects are about average-sized..."

If not a valid value of UntrackedObjectClass, returns "This seems to be a non-standard size class. Who knows what it'll look like?"

static string DiscoveryInfo.GetSizeClassSizes ( UntrackedObjectClass  sizeClass)

Returns asteroid size displayed in map view

Parameters
sizeClassThe asteroid type to label
Returns

The asteroid class printed beneath an untracked asteroid.

"C (Medium)"

If not a valid value of UntrackedObjectClass, returns "???"

bool DiscoveryInfo.HaveKnowledgeAbout ( DiscoveryLevels  lvl)

Function testing if an asteroid has a particular discovery level

Parameters
lvlThe flag(s) whose presence must be tested.
Returns
True if at least one of the flags in lvl is in this object, false otherwise
void DiscoveryInfo.Load ( ConfigNode  node)
void DiscoveryInfo.Save ( ConfigNode  node)
void DiscoveryInfo.SetLastObservedTime ( double  UT)

Logs an asteroid observation

Parameters
UTThe new time of last observation
void DiscoveryInfo.SetLevel ( DiscoveryLevels  level)

Sets the level of knowledge the player has for the asteroid

Parameters
levelThe flags representing the asteroid's exploration state
void DiscoveryInfo.SetReferenceLifetime ( double  time)

Updates the reference lifetime

Parameters
timeChanges the scaling of signal strength.
void DiscoveryInfo.SetUnobservedLifetime ( double  time)

Updates the time for which the asteroid can go untracked, preserving class invariants

Parameters
timeThe maximum time to track the asteroid
void DiscoveryInfo.SetUntrackedObjectSize ( UntrackedObjectClass  size)

Updates the asteroid size

Parameters
sizeThe asteroid class (A-E)

Member Data Documentation

KnowledgeItem<double> DiscoveryInfo.distance

Tracking station wrapper for IDiscoverable.RevealAltitude()

Requires DiscoveryLevels.StateVectors

KnowledgeItem<float> DiscoveryInfo.mass

Tracking station wrapper for IDiscoverable.RevealMass()

Requires DiscoveryLevels.Appearance

KnowledgeItem<string> DiscoveryInfo.name

Tracking station wrapper for IDiscoverable.RevealName()

Requires DiscoveryLevels.Name

KnowledgeItem<string> DiscoveryInfo.signalStrengthLevel

Tracking station wrapper for GetSignalStrengthCaption()

Always visible

KnowledgeItem<double> DiscoveryInfo.signalStrengthPercent

Tracking station wrapper for GetSignalStrength()

Rounded to the nearest 0.1%.

Always visible

KnowledgeItem<string> DiscoveryInfo.situation

Tracking station wrapper for IDiscoverable.RevealSituationString()

Requires DiscoveryLevels.StateVectors

KnowledgeItem<UntrackedObjectClass> DiscoveryInfo.size

Tracking station wrapper for this.objectSize

Always visible

KnowledgeItem<double> DiscoveryInfo.speed

Tracking station wrapper for IDiscoverable.RevealSpeed()

Requires DiscoveryLevels.StateVectors

KnowledgeItem<string> DiscoveryInfo.trackingStatus

Tracking station wrapper for Level?

Always visible

KnowledgeItem<string> DiscoveryInfo.type

Tracking station wrapper for IDiscoverable.RevealType()

Requires DiscoveryLevels.Appearance

Property Documentation

double DiscoveryInfo.fadeUT
getset

The time at which the asteroid is scheduled to be deleted

double DiscoveryInfo.lastObservedTime
getset

The time at which the asteroid was last tracked

Stored in persistence file

DiscoveryLevels DiscoveryInfo.Level
getset

The asteroid's tracking state

Stored in persistence file as state

UntrackedObjectClass DiscoveryInfo.objectSize
getset

The size class (A-E) of the asteroid

Stored in persistence file as size

double DiscoveryInfo.referenceLifetime
getset

The time for which an asteroid can go untracked if it starts at full signal strength

Alternate definition: the time needed for the signal strength to fall by 1 unit.

Always equals 86400 × ScenarioDiscoverableObjects.maxUntrackedLifetime. For the default spawn settings, this is 1728000 seconds, or 20 Earth days.

Stored in persistence file as refTime

double DiscoveryInfo.unobservedLifetime
getset

The time for which the asteroid can go untracked before it is deleted

Stored in persistence file as lifetime


The documentation for this class was generated from the following file: