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

Stores information on asteroid spawning More...

Inheritance diagram for ScenarioDiscoverableObjects:

Public Member Functions

void debugSpawnProbability ()
 Returns a description of the current spawn interval and spawn odds More...
 
void OnAwake ()
 
void OnLoad (ConfigNode node)
 
void OnSave (ConfigNode node)
 
void SpawnAsteroid ()
 Creates a random asteroid and Kerbin-intercepting orbit More...
 
void SpawnLastAsteroid ()
 Creates a random asteroid and Kerbin-intercepting orbit. More...
 
void Start ()
 

Public Attributes

int spawnGroupMinLimit = 3
 Number of untracked asteroids at which spawn rate begins to slow More...
 
int spawnGroupMaxLimit = 8
 Number of untracked asteroids at which spawn rate stops completely More...
 
FloatCurve sizeCurve
 Sets size distribution for asteroids More...
 
int spawnOddsAgainst = 2
 Controls the fraction of spawn checks in which new asteroids are generated More...
 
float spawnInterval = 15.0f
 Number of seconds between asteroid checks More...
 
float maxUntrackedLifetime = 20.0f
 Longest time an asteroid can go untracked before disappearing, in Earth days More...
 
float minUntrackedLifetime = 1.0f
 Shortest time an asteroid can go untracked before disappearing, in Earth days More...
 

Detailed Description

Stores information on asteroid spawning

Executed while in Flight, Tracking Station, and Space Center scenes

The module schedules periodic "spawn checks" while the game clock is running, at an interval set by spawnInterval. At each spawn check, any asteroids that have gone untracked for too long are removed from the game.

To add an element of randomness, only a fraction of checks (controlled by spawnOddsAgainst) have a chance to produce asteroids. No asteroids are produced if the number of untracked asteroids already in the game exceeds spawnGroupMaxLimit. Because spawn checks happen very frequently, the number of detected asteroids in a game where the player never tracks an asteroid will almost always be close to spawnGroupMaxLimit.

The timing of spawn checks appears to be independent of the warp rate, but at high time warp multiple asteroids may be spawned per check. (Needs confirmation)

Member Function Documentation

void ScenarioDiscoverableObjects.debugSpawnProbability ( )

Returns a description of the current spawn interval and spawn odds

See also
spawnOddsAgainst, spawnInterval
void ScenarioDiscoverableObjects.OnAwake ( )
void ScenarioDiscoverableObjects.OnLoad ( ConfigNode  node)
void ScenarioDiscoverableObjects.OnSave ( ConfigNode  node)
void ScenarioDiscoverableObjects.SpawnAsteroid ( )

Creates a random asteroid and Kerbin-intercepting orbit

void ScenarioDiscoverableObjects.SpawnLastAsteroid ( )

Creates a random asteroid and Kerbin-intercepting orbit.

See also
SpawnAsteroid()

Asteroid is identical to the last call of SpawnAsteroid()

Intended for debugging?

void ScenarioDiscoverableObjects.Start ( )

Member Data Documentation

float ScenarioDiscoverableObjects.maxUntrackedLifetime = 20.0f

Longest time an asteroid can go untracked before disappearing, in Earth days

See also
DiscoveryInfo.unobservedLifetime
float ScenarioDiscoverableObjects.minUntrackedLifetime = 1.0f

Shortest time an asteroid can go untracked before disappearing, in Earth days

See also
DiscoveryInfo.unobservedLifetime
FloatCurve ScenarioDiscoverableObjects.sizeCurve

Sets size distribution for asteroids

The output range of [0, 1) is divided equally among the classes. So [0, 0.2) is class A, [0.2, 0.4) is class B, ..., [0.8, 1) is class E.

Default curve translates to 12% class A, 13% class B, 49% class C, 13% class D, and 12% class E

int ScenarioDiscoverableObjects.spawnGroupMaxLimit = 8

Number of untracked asteroids at which spawn rate stops completely

int ScenarioDiscoverableObjects.spawnGroupMinLimit = 3

Number of untracked asteroids at which spawn rate begins to slow

float ScenarioDiscoverableObjects.spawnInterval = 15.0f

Number of seconds between asteroid checks

These are seconds of time spent playing KSP, regardless of the time warp rate. The faster your time warp, the longer the in-game interval between asteroid detections.

Since asteroids are removed during spawn checks, spawnInterval also controls the asteroid removal rate.

int ScenarioDiscoverableObjects.spawnOddsAgainst = 2

Controls the fraction of spawn checks in which new asteroids are generated

The probability of spawning an asteroid is 1 / (1 + spawnOddsAgainst)


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