@@ -41,7 +41,9 @@ public static class Core
4141 /// <summary>
4242 /// Mod-wide random number generator
4343 /// </summary>
44- internal static System . Random rand = new System . Random ( ) ;
44+ internal static System . Random Rand = new System . Random ( ) ;
45+
46+ static readonly string [ ] prefixes = { "" , "K" , "M" , "G" , "T" } ;
4547
4648 static List < HealthFactor > factors = new List < HealthFactor > ( )
4749 {
@@ -62,8 +64,6 @@ public static class Core
6264
6365 static List < double > trainingCaps ;
6466
65- static readonly string [ ] prefixes = { "" , "K" , "M" , "G" , "T" } ;
66-
6767 /// <summary>
6868 /// List of all tracked kerbals
6969 /// </summary>
@@ -81,7 +81,7 @@ public static List<HealthFactor> Factors
8181 /// <summary>
8282 /// Keeps data about all resources that provide Shielding. Key is resource id, value is amount of shielding provided by 1 unit
8383 /// </summary>
84- public static Dictionary < int , double > ResourceShielding { get ; set ; } = new Dictionary < int , double > ( ) ;
84+ public static Dictionary < int , double > ShieldingResources { get ; set ; } = new Dictionary < int , double > ( ) ;
8585
8686 public static List < Quirk > Quirks { get ; set ; } = new List < Quirk > ( ) ;
8787
@@ -131,7 +131,7 @@ public static void AddResourceShielding(string name, double shieldingPerTon)
131131 {
132132 PartResourceDefinition prd = PartResourceLibrary . Instance ? . GetDefinition ( name ) ;
133133 if ( prd != null )
134- ResourceShielding . Add ( prd . id , shieldingPerTon * prd . density ) ;
134+ ShieldingResources . Add ( prd . id , shieldingPerTon * prd . density ) ;
135135 else Log ( $ "Can't find ResourceDefinition for { name } .") ;
136136 }
137137
@@ -145,7 +145,7 @@ public static PlanetHealthConfig GetPlanetConfig(string name)
145145
146146 public static RadStormType GetRandomRadStormType ( )
147147 {
148- double d = rand . NextDouble ( ) * radStormTypesTotalWeight ;
148+ double d = Rand . NextDouble ( ) * radStormTypesTotalWeight ;
149149 foreach ( RadStormType rst in RadStormTypes )
150150 {
151151 d -= rst . Weight ;
@@ -169,10 +169,10 @@ public static void LoadConfig()
169169 HealthConditions . Add ( n . GetValue ( "name" ) , new HealthCondition ( n ) ) ;
170170 Log ( $ "{ HealthConditions . Count } health conditions loaded.", LogLevel . Important ) ;
171171
172- ResourceShielding = new Dictionary < int , double > ( ) ;
172+ ShieldingResources = new Dictionary < int , double > ( ) ;
173173 foreach ( ConfigNode n in config . GetNodes ( "RESOURCE_SHIELDING" ) )
174174 AddResourceShielding ( n . GetValue ( "name" ) , n . GetDouble ( "shielding" ) ) ;
175- Log ( $ "{ ResourceShielding . Count } resource shielding values loaded.", LogLevel . Important ) ;
175+ Log ( $ "{ ShieldingResources . Count } shielding resource values loaded.", LogLevel . Important ) ;
176176
177177 Quirks = new List < Quirk > ( config . GetNodes ( "HEALTH_QUIRK" ) . Select ( n => new Quirk ( n ) ) ) ;
178178 Log ( $ "{ Quirks . Count } quirks loaded.", LogLevel . Important ) ;
@@ -209,9 +209,9 @@ public static void LoadConfig()
209209
210210 trainingCaps = new List < double > ( 3 )
211211 {
212- 0.6 ,
213- 0.75 ,
214- 0.85
212+ 0.6 ,
213+ 0.75 ,
214+ 0.85
215215 } ;
216216 foreach ( ConfigNode n in config . GetNodes ( "TRAINING_CAPS" ) )
217217 {
@@ -226,11 +226,11 @@ public static void LoadConfig()
226226
227227 public static IList < ProtoCrewMember > GetCrew ( ProtoCrewMember pcm , bool entireVessel )
228228 {
229+ Vessel vessel = pcm . GetVessel ( ) ;
229230 if ( ! entireVessel && CLS . Enabled && pcm . rosterStatus == ProtoCrewMember . RosterStatus . Assigned )
230- return pcm . GetCLSSpace ( ) . GetCrew ( ) . ToList ( ) ;
231+ return pcm . GetCLSSpace ( vessel ) . GetCrew ( ) . ToList ( ) ;
231232 if ( IsInEditor )
232233 return ShipConstruction . ShipManifest . GetAllCrew ( false ) ;
233- Vessel vessel = pcm . GetVessel ( ) ;
234234 return vessel != null ? vessel . GetVesselCrew ( ) : new List < ProtoCrewMember > ( ) ;
235235 }
236236
@@ -242,11 +242,11 @@ public static IList<ProtoCrewMember> GetCrew(ProtoCrewMember pcm, bool entireVes
242242 /// <returns></returns>
243243 public static int GetCrewCount ( ProtoCrewMember pcm , bool entireVessel )
244244 {
245+ Vessel vessel = pcm . GetVessel ( ) ;
245246 if ( ! entireVessel && CLS . Enabled )
246- return pcm . GetCLSSpace ( ) . GetCrewCount ( ) ;
247+ return pcm . GetCLSSpace ( vessel ) . GetCrewCount ( ) ;
247248 if ( IsInEditor )
248249 return ShipConstruction . ShipManifest . CrewCount ;
249- Vessel vessel = pcm . GetVessel ( ) ;
250250 return vessel != null ? vessel . GetCrewCount ( ) : 1 ;
251251 }
252252
@@ -362,7 +362,7 @@ public static bool GetBool(this ConfigNode n, string key, bool defaultValue = fa
362362 /// <param name="stdDev"></param>
363363 /// <returns></returns>
364364 public static double GetGaussian ( double stdDev = 1 , double mean = 0 ) =>
365- mean + stdDev * Math . Sqrt ( - 2 * Math . Log ( 1 - rand . NextDouble ( ) ) ) * Math . Sin ( 2 * Math . PI * ( 1 - rand . NextDouble ( ) ) ) ;
365+ mean + stdDev * Math . Sqrt ( - 2 * Math . Log ( 1 - Rand . NextDouble ( ) ) ) * Math . Sin ( 2 * Math . PI * ( 1 - Rand . NextDouble ( ) ) ) ;
366366
367367 /// <summary>
368368 /// Returns a string of a value with a mandatory sign (+ or -, unless v = 0)
0 commit comments