Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
KerbalRoster Class Reference

Public Member Functions

bool AddCrewMember (ProtoCrewMember crew)
 Will add new ProtoCrewMember to the roster. After a check is done on the first name. Duplicate first names will not be added. More...
 
bool ChangeName (string oldName, string newName)
 
bool ChangeNameCalledFromPCM (ProtoCrewMember crew, string oldName, string newName)
 DO NOT CALL DIRECTLY. Should only be called from PCM itself via PCM.ChangeName() More...
 
void CheckRosterRespawn (double universalTime, GameParameters parameters)
 Check if any kerbal in the roster can be respawned More...
 
void CheckRosterRespawn ()
 Check for roster spawn with default values More...
 
VesselCrewManifest DefaultCrewForVessel (ConfigNode vesselNode, VesselCrewManifest previous=null, bool autohire=true, bool usePreviousVCMToFill=false)
 Generate a default manifest for the current vessel. Optionally provide an already existing manifest to avoid reassigning crews already seated. More...
 
bool Exists (string name)
 
int GetActiveCrewCount ()
 
int GetAssignedCrewCount ()
 
int GetAvailableCrewCount ()
 
int GetKIACrewCount ()
 
int GetLostCrewCount ()
 
int GetMissingCrewCount ()
 
ProtoCrewMember GetNewKerbal (ProtoCrewMember.KerbalType type=ProtoCrewMember.KerbalType.Crew)
 
ProtoCrewMember GetNextApplicant ()
 
ProtoCrewMember GetNextAvailableKerbal (ProtoCrewMember.KerbalType type=ProtoCrewMember.KerbalType.Crew)
 
ProtoCrewMember GetNextOrNewKerbal (ProtoCrewMember.KerbalType type=ProtoCrewMember.KerbalType.Crew)
 
void HireApplicant (ProtoCrewMember ap)
 
int IndexOf (ProtoCrewMember pcm)
 
void Init (Game st)
 
 KerbalRoster (Game.Modes mode)
 
 KerbalRoster (ConfigNode node, Game.Modes mode)
 
IEnumerable< ProtoCrewMemberKerbals (ProtoCrewMember.KerbalType type, params ProtoCrewMember.RosterStatus[] status)
 
IEnumerable< ProtoCrewMemberKerbals (params ProtoCrewMember.RosterStatus[] status)
 
void PCMUpdate (double UT)
 
bool Remove (string name)
 
bool Remove (ProtoCrewMember crew)
 
void Remove (int i)
 
void RemoveDead (ProtoCrewMember ap)
 
void RemoveMIA (ProtoCrewMember ap)
 
void RepopulateCrewRoster (int rosterSize)
 Repopulates the crew roster with stock kerbals so it always have at least the number of kerbals defined in rosterSize More...
 
void SackAvailable (ProtoCrewMember ap)
 
void Save (ConfigNode node)
 
void Update (double UT)
 
void UpdateExperience ()
 Recalculate the experience of all the crew members in the roster to ensure that they're correct. More...
 
void ValidateAssignments (Game st)
 Validates all assigned crews against being on non-existing vessels. May never happen, but it was a bug once so it might still be a thing now. More...
 

Static Public Member Functions

static void AddExperienceType (string type, string typeName, float notHomeValue, float homeValue=0.0f)
 
static float CalculateExperience (params FlightLog[] logs)
 
static int CalculateExperienceLevel (float xp)
 
static void CheatExperience ()
 
static string GenerateExperienceLog (FlightLog log)
 
static KerbalRoster GenerateInitialCrewRoster (Game.Modes mode)
 
static System.Type GetExperienceEffectType (string typeName)
 
static float GetExperienceLevelRequirement (int level)
 
static int GetExperienceMaxLevel ()
 
static System.Type GetExperienceTraitType (string typeName)
 
static string GetLocalizedExperienceTraitName (string queriedTrait)
 
static void SetExperienceLevel (ProtoCrewMember pcm, int level)
 
static void SetExperienceLevel (ProtoCrewMember pcm, int level, GameParameters parameters, Game.Modes mode)
 
static void SetExperienceTrait (ProtoCrewMember pcm, string traitName=null)
 
static bool TryGetExperienceTraitConfig (string traitName, out ExperienceTraitConfig traitConfig)
 Try and get the config for a trait with this name More...
 

Static Public Attributes

static string engineerTrait = "Engineer"
 
static string pilotTrait = "Pilot"
 
static string scientistTrait = "Scientist"
 
static string touristTrait = "Tourist"
 

Properties

IEnumerable< ProtoCrewMemberApplicants [get]
 
int Count [get]
 
IEnumerable< ProtoCrewMemberCrew [get]
 
Game.Modes GameMode [get]
 
ProtoCrewMember this[int index] [get]
 
ProtoCrewMember this[string name] [get]
 
IEnumerable< ProtoCrewMemberTourist [get]
 
IEnumerable< ProtoCrewMemberUnowned [get]
 

Constructor & Destructor Documentation

KerbalRoster.KerbalRoster ( Game.Modes  mode)
inline
KerbalRoster.KerbalRoster ( ConfigNode  node,
Game.Modes  mode 
)
inline

Member Function Documentation

bool KerbalRoster.AddCrewMember ( ProtoCrewMember  crew)
inline

Will add new ProtoCrewMember to the roster. After a check is done on the first name. Duplicate first names will not be added.

Parameters
crew
Returns
static void KerbalRoster.AddExperienceType ( string  type,
string  typeName,
float  notHomeValue,
float  homeValue = 0.0f 
)
inlinestatic
static float KerbalRoster.CalculateExperience ( params FlightLog[]  logs)
inlinestatic

< go through each flight and compile it's targets and best achievements to the lists

static int KerbalRoster.CalculateExperienceLevel ( float  xp)
inlinestatic
bool KerbalRoster.ChangeName ( string  oldName,
string  newName 
)
inline
bool KerbalRoster.ChangeNameCalledFromPCM ( ProtoCrewMember  crew,
string  oldName,
string  newName 
)
inline

DO NOT CALL DIRECTLY. Should only be called from PCM itself via PCM.ChangeName()

Parameters
crew
oldName
newName
Returns
static void KerbalRoster.CheatExperience ( )
inlinestatic
void KerbalRoster.CheckRosterRespawn ( double  universalTime,
GameParameters  parameters 
)
inline

Check if any kerbal in the roster can be respawned

Parameters
universalTimeTime passed
parametersUsed internally to check for game settings (missingKerbalsRespawn)
void KerbalRoster.CheckRosterRespawn ( )
inline

Check for roster spawn with default values

VesselCrewManifest KerbalRoster.DefaultCrewForVessel ( ConfigNode  vesselNode,
VesselCrewManifest  previous = null,
bool  autohire = true,
bool  usePreviousVCMToFill = false 
)
inline

Generate a default manifest for the current vessel. Optionally provide an already existing manifest to avoid reassigning crews already seated.

Parameters
vesselNodeVessel to be populated
previousAlready existing crew manifest.
autohireHire more kerbals to fill seats if necessary.
usePreviousVCMToFillInstead of avoiding using crew members in the crew manifest, use them and sit them in the same seats. (We use this to fill in empty seats in a crewed part by passing in the half-filled crew manifest.)
Returns
Returns a new VesselCrewManifest which has been populated with crew members

< find first crewable commandable part and fill it with all available crew

bool KerbalRoster.Exists ( string  name)
inline
static string KerbalRoster.GenerateExperienceLog ( FlightLog  log)
inlinestatic

< go through each flight and compile it's targets and best achievements to the lists

static KerbalRoster KerbalRoster.GenerateInitialCrewRoster ( Game.Modes  mode)
inlinestatic

< force-set the traits

int KerbalRoster.GetActiveCrewCount ( )
inline
int KerbalRoster.GetAssignedCrewCount ( )
inline
int KerbalRoster.GetAvailableCrewCount ( )
inline
static System.Type KerbalRoster.GetExperienceEffectType ( string  typeName)
inlinestatic
static float KerbalRoster.GetExperienceLevelRequirement ( int  level)
inlinestatic
static int KerbalRoster.GetExperienceMaxLevel ( )
inlinestatic
static System.Type KerbalRoster.GetExperienceTraitType ( string  typeName)
inlinestatic
int KerbalRoster.GetKIACrewCount ( )
inline
static string KerbalRoster.GetLocalizedExperienceTraitName ( string  queriedTrait)
inlinestatic
int KerbalRoster.GetLostCrewCount ( )
inline
int KerbalRoster.GetMissingCrewCount ( )
inline
ProtoCrewMember KerbalRoster.GetNewKerbal ( ProtoCrewMember.KerbalType  type = ProtoCrewMember.KerbalType.Crew)
inline
ProtoCrewMember KerbalRoster.GetNextApplicant ( )
inline
ProtoCrewMember KerbalRoster.GetNextAvailableKerbal ( ProtoCrewMember.KerbalType  type = ProtoCrewMember.KerbalType.Crew)
inline

< check respawning kerbals to see if they're good to go again

ProtoCrewMember KerbalRoster.GetNextOrNewKerbal ( ProtoCrewMember.KerbalType  type = ProtoCrewMember.KerbalType.Crew)
inline
void KerbalRoster.HireApplicant ( ProtoCrewMember  ap)
inline
int KerbalRoster.IndexOf ( ProtoCrewMember  pcm)
inline
void KerbalRoster.Init ( Game  st)
inline
IEnumerable<ProtoCrewMember> KerbalRoster.Kerbals ( ProtoCrewMember.KerbalType  type,
params ProtoCrewMember.RosterStatus[]  status 
)
inline
IEnumerable<ProtoCrewMember> KerbalRoster.Kerbals ( params ProtoCrewMember.RosterStatus[]  status)
inline
void KerbalRoster.PCMUpdate ( double  UT)
inline
bool KerbalRoster.Remove ( string  name)
inline
bool KerbalRoster.Remove ( ProtoCrewMember  crew)
inline
void KerbalRoster.Remove ( int  i)
inline
void KerbalRoster.RemoveDead ( ProtoCrewMember  ap)
inline
void KerbalRoster.RemoveMIA ( ProtoCrewMember  ap)
inline
void KerbalRoster.RepopulateCrewRoster ( int  rosterSize)
inline

Repopulates the crew roster with stock kerbals so it always have at least the number of kerbals defined in rosterSize

void KerbalRoster.SackAvailable ( ProtoCrewMember  ap)
inline
void KerbalRoster.Save ( ConfigNode  node)
inline
static void KerbalRoster.SetExperienceLevel ( ProtoCrewMember  pcm,
int  level 
)
inlinestatic
static void KerbalRoster.SetExperienceLevel ( ProtoCrewMember  pcm,
int  level,
GameParameters  parameters,
Game.Modes  mode 
)
inlinestatic

< This method necessarily clears a kerbal's career log. Use it sparingly, for debug and cheats.

static void KerbalRoster.SetExperienceTrait ( ProtoCrewMember  pcm,
string  traitName = null 
)
inlinestatic
static bool KerbalRoster.TryGetExperienceTraitConfig ( string  traitName,
out ExperienceTraitConfig  traitConfig 
)
inlinestatic

Try and get the config for a trait with this name

Parameters
traitNamename of the trait
traitConfigThe traitConfig item if successful, null if not
Returns
True if it succeeds
void KerbalRoster.Update ( double  UT)
inline
void KerbalRoster.UpdateExperience ( )
inline

Recalculate the experience of all the crew members in the roster to ensure that they're correct.

void KerbalRoster.ValidateAssignments ( Game  st)
inline

Validates all assigned crews against being on non-existing vessels. May never happen, but it was a bug once so it might still be a thing now.

Parameters
st

Member Data Documentation

string KerbalRoster.engineerTrait = "Engineer"
static
string KerbalRoster.pilotTrait = "Pilot"
static
string KerbalRoster.scientistTrait = "Scientist"
static
string KerbalRoster.touristTrait = "Tourist"
static

Property Documentation

IEnumerable<ProtoCrewMember> KerbalRoster.Applicants
get
int KerbalRoster.Count
get
IEnumerable<ProtoCrewMember> KerbalRoster.Crew
get
Game.Modes KerbalRoster.GameMode
get
ProtoCrewMember KerbalRoster.this[int index]
get
ProtoCrewMember KerbalRoster.this[string name]
get
IEnumerable<ProtoCrewMember> KerbalRoster.Tourist
get
IEnumerable<ProtoCrewMember> KerbalRoster.Unowned
get

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