Skip to content

Commit

Permalink
Apply artificial radiation sources after Gamma Transparency is applied (
Browse files Browse the repository at this point in the history
#455)

* Apply artificial radiation sources after Gamma Transparency is applied
* Update CHANGELOG.md
  • Loading branch information
sswelm authored and SirMortimer committed Jul 5, 2019
1 parent 1805788 commit 6054ba0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Configs for SoundingRockets (Arthur, Breach Candy)
* Fixed DMOS experiment restriction to plantary space. This breaks some DMOS contracts that require experiments in solar orbit (Sir Mortimer)
* Improved shielding efficiency calculation (Free Thinker)
* Apply artificial radiation sources after Gamma Transparency is applied (Free Thinker)
* Fixed the configuration for EVA kerbals, a problem introduced by Serenity (Sir Mortimer)

## v3.0.2 for all versions of KSP from 1.4.0 to 1.7.x
Expand Down
13 changes: 9 additions & 4 deletions src/Kerbalism/Radiation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,7 @@ public static RadiationBody Info(CelestialBody body)
// add extern radiation
radiation += PreferencesStorm.Instance.ExternRadiation;

// add emitter radiation
radiation += Emitter.Total(v);


// if there is a storm in progress
if (Storm.InProgress(v))
Expand All @@ -637,13 +636,19 @@ public static RadiationBody Info(CelestialBody body)
if (magnetosphere) blackout = true;
else radiation += PreferencesStorm.Instance.StormRadiation * sunlight;
}

// apply gamma transparency if inside atmosphere
radiation *= gamma_transparency

// add emitter radiation after atmosphere transparency
radiation += Emitter.Total(v);

// clamp radiation to positive range
// note: we avoid radiation going to zero by using a small positive value
radiation = Math.Max(radiation, Nominal);

// return radiation, scaled by gamma transparency if inside atmosphere
return radiation * gamma_transparency;
// return radiation
return radiation;
}


Expand Down

0 comments on commit 6054ba0

Please sign in to comment.