// Load from confignode public void Load(ConfigNode config, string name) { Name = name; var crewList = HighLogic.CurrentGame.CrewRoster.Crew.Concat(HighLogic.CurrentGame.CrewRoster.Applicants).Concat(HighLogic.CurrentGame.CrewRoster.Tourist).Concat(HighLogic.CurrentGame.CrewRoster.Unowned).ToList(); Kerbal = crewList.FirstOrDefault(a => a.name == name); //newKerbal.CrewType = Utils.GetValue(config, "Type", ProtoCrewMember.KerbalType.Crew); LastUpdate = Utils.GetValue(config, "LastUpdate", 0d); TotalExposure = Utils.GetValue(config, "TotalExposure", 0d); CurrentExposure = Utils.GetValue(config, "CurrentExposure", 0d); CurrentAmbientExposure = Utils.GetValue(config, "CurrentAmbientExposure", 0d); LocalExposureFraction = Utils.GetValue(config, "LocalExposureFraction", 1d); BodyExposureFraction = Utils.GetValue(config, "BodyExposureFraction", 0d); SkyExposureFraction = Utils.GetValue(config, "SkyExposureFraction", 1d); HealthState = (RadioactivityKerbalState)Enum.Parse(typeof(RadioactivityKerbalState), Utils.GetValue(config, "HealthState", "Healthy")); VesselID = Utils.GetValue(config, "VesselID", Guid.Empty); if (Guid.Empty.Equals(VesselID)) { CurrentVessel = null; } else { Vessel tryVessel = FlightGlobals.Vessels.FirstOrDefault(a => a.id == VesselID); if (tryVessel != null && tryVessel.loaded) { CurrentVessel = tryVessel; } } }
void Sicken() { HealthState = RadioactivityKerbalState.Sick; ScreenMessages.PostScreenMessage(new ScreenMessage(String.Format("{0} now has radiation sickness", Name), 4.0f, ScreenMessageStyle.UPPER_CENTER)); if (RadioactivitySettings.debugKerbalEvents) Utils.LogWarning(String.Format("Kerbals: {0} got radiation sickness", Name)); }
/// "kills" a kerbal void Die() { HealthState = RadioactivityKerbalState.Dead; KerbalTracking.Instance.KerbalDB.RemoveKerbal(this); ScreenMessages.PostScreenMessage(new ScreenMessage(String.Format("{0} has died of radiation exposure", Name), 4.0f, ScreenMessageStyle.UPPER_CENTER)); if (CurrentVessel != null && CurrentVessel.isEVA) { // If we are EVA, have to handle this more carefully CurrentVessel.rootPart.Die(); if (RadioactivitySettings.enableKerbalDeath) { // Do nothing } else { if (HighLogic.CurrentGame.Parameters.Difficulty.MissingCrewsRespawn) { Kerbal.StartRespawnPeriod(2160000.0); // 100 Kerbin days } } if (RadioactivitySettings.debugKerbalEvents) Utils.LogWarning(String.Format("Kerbals: {0} died on EVA of radiation exposure", Name)); } else { if (Kerbal.rosterStatus == ProtoCrewMember.RosterStatus.Available) { Kerbal.Die(); if (HighLogic.CurrentGame.Parameters.Difficulty.MissingCrewsRespawn) { Kerbal.StartRespawnPeriod(2160000.0); // 100 Kerbin days } if (RadioactivitySettings.debugKerbalEvents) Utils.LogWarning(String.Format("Kerbals: {0} died at home of radiation exposure", Name)); } else { Part part = CurrentVessel.Parts.Find(p => p.protoModuleCrew.Contains(Kerbal)); if (part != null) { part.RemoveCrewmember(Kerbal); Kerbal.Die(); if (HighLogic.CurrentGame.Parameters.Difficulty.MissingCrewsRespawn) { Kerbal.StartRespawnPeriod(2160000.0); // 100 Kerbin days } if (RadioactivitySettings.debugKerbalEvents) Utils.LogWarning(String.Format("Kerbals: {0} died in his vessel of radiation exposure", Name)); //HighLogic.CurrentGame.CrewRoster.RemoveDead(Kerbal); } } } }
void Heal() { HealthState = RadioactivityKerbalState.Healthy; ScreenMessages.PostScreenMessage(new ScreenMessage(String.Format("{0} recovered from radiation sickness", Name), 4.0f, ScreenMessageStyle.UPPER_CENTER)); if (RadioactivitySettings.debugKerbalEvents) Utils.LogWarning(String.Format("Kerbals: {0} recovered from radiation sickness", Name)); }
public void Load(ProtoCrewMember crewMember) { Name = crewMember.name; Kerbal = crewMember; //Status = crewMember //newKerbal.CrewType = Utils.GetValue(config, "Type", ProtoCrewMember.KerbalType.Crew); TotalExposure = 0d; CurrentExposure = 0d; LocalExposureFraction = 1d; BodyExposureFraction = 0d; SkyExposureFraction = 1d; HealthState = RadioactivityKerbalState.Healthy; }