KSP API
|
Stores information on asteroid spawning More...
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 () |
![]() | |
ScenarioModule () | |
void | Load (ConfigNode node) |
void | Save (ConfigNode node) |
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... | |
![]() | |
ScenarioRunner | runner |
ProtoScenarioModule | snapshot |
List< GameScenes > | targetScenes |
Additional Inherited Members | |
![]() | |
int | ClassID [get] |
string | ClassName [get] |
BaseEventList | Events [get] |
BaseFieldList | Fields [get] |
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.
void ScenarioDiscoverableObjects.debugSpawnProbability | ( | ) |
Returns a description of the current spawn interval and spawn odds
|
virtual |
Reimplemented from ScenarioModule.
|
virtual |
Reimplemented from ScenarioModule.
|
virtual |
Reimplemented from ScenarioModule.
void ScenarioDiscoverableObjects.SpawnAsteroid | ( | ) |
Creates a random asteroid and Kerbin-intercepting orbit
void ScenarioDiscoverableObjects.SpawnLastAsteroid | ( | ) |
Creates a random asteroid and Kerbin-intercepting orbit.
Asteroid is identical to the last call of SpawnAsteroid()
Intended for debugging?
void ScenarioDiscoverableObjects.Start | ( | ) |
float ScenarioDiscoverableObjects.maxUntrackedLifetime = 20.0f |
Longest time an asteroid can go untracked before disappearing, in Earth days
float ScenarioDiscoverableObjects.minUntrackedLifetime = 1.0f |
Shortest time an asteroid can go untracked before disappearing, in Earth days
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 approximately seconds of in-game time, but if you make sudden changes in the time warp rate the spawner may need some time to catch up.
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)