protected override void OnLoad(ConfigNode configNode) { base.OnLoad(configNode); foreach (ConfigNode child in configNode.GetNodes("KERBAL_DETAIL")) { // Read all the orbit data KerbalData kd = new KerbalData(); kd.body = ConfigNodeUtil.ParseValue <CelestialBody>(child, "body"); kd.latitude = ConfigNodeUtil.ParseValue <double>(child, "lat"); kd.longitude = ConfigNodeUtil.ParseValue <double>(child, "lon"); kd.altitude = ConfigNodeUtil.ParseValue <double?>(child, "alt", (double?)null); kd.landed = ConfigNodeUtil.ParseValue <bool>(child, "landed"); kd.owned = ConfigNodeUtil.ParseValue <bool>(child, "owned"); kd.addToRoster = ConfigNodeUtil.ParseValue <bool>(child, "addToRoster"); if (child.HasNode("ORBIT")) { kd.orbit = new OrbitSnapshot(child.GetNode("ORBIT")).Load(); } // Load the kerbal kd.kerbal = Kerbal.Load(child); kerbals.Add(kd); } }
public void SelectKerbal() { if (kerbalSelected) { return; } kerbalSelected = true; // First, try to get a Kerbal that matches the name if (!string.IsNullOrEmpty(characterName)) { kerbal = HighLogic.CurrentGame.CrewRoster.AllKerbals().Where(pcm => pcm.name == characterName).FirstOrDefault(); } // Now grab from the active vessel else if (kerbal == null && FlightGlobals.ActiveVessel != null) { kerbal = FlightGlobals.ActiveVessel.GetVesselCrew().Where(pcm => !excludeName.Contains(pcm.name)).ElementAtOrDefault(crewIndex); if (kerbal != null) { characterName = kerbal.name; } } if (kerbal == null && string.IsNullOrEmpty(characterName)) { System.Random r = new System.Random(); gender = r.Next(2) == 0 ? ProtoCrewMember.Gender.Male : ProtoCrewMember.Gender.Female; characterName = Kerbal.KerbalName(gender); } }
internal static bool InActiveCrew(Kerbal crew, bool checkName = false) { if (!checkName) { for (int i = 0; i < KerbalPortraitGallery.Instance.ActiveCrew.Count; ++i) { if (KerbalPortraitGallery.Instance.ActiveCrew[i] == crew) { return(true); } } return(false); } else { for (int i = 0; i < KerbalPortraitGallery.Instance.ActiveCrew.Count; ++i) { if (KerbalPortraitGallery.Instance.ActiveCrew[i].crewMemberName == crew.crewMemberName) { return(true); } } return(false); } }
internal static bool HasPortrait(Kerbal crew, bool checkName = false) { if (!checkName) { for (int i = 0; i < KerbalPortraitGallery.Instance.Portraits.Count; ++i) { if (KerbalPortraitGallery.Instance.Portraits[i].crewMember == crew) { return(true); } } return(false); } else { for (int i = 0; i < KerbalPortraitGallery.Instance.Portraits.Count; ++i) { if (KerbalPortraitGallery.Instance.Portraits[i].crewMemberName == crew.crewMemberName) { return(true); } } return(false); } }
public void Start(KerbalInfo kerbalInfo) { Kerbal kerbal = kerbalInfo.Kerbal; CameraManager cameraManager = CameraManager.Instance; cameraManager.SetCameraIVA(kerbal, true); }
protected override void OnParameterLoad(ConfigNode node) { try { base.OnParameterLoad(node); trait = ConfigNodeUtil.ParseValue <string>(node, "trait", (string)null); minExperience = Convert.ToInt32(node.GetValue("minExperience")); maxExperience = Convert.ToInt32(node.GetValue("maxExperience")); minCrew = Convert.ToInt32(node.GetValue("minCrew")); maxCrew = Convert.ToInt32(node.GetValue("maxCrew")); foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL")) { kerbals.Add(Kerbal.Load(kerbalNode)); } foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL_EXCLUDE")) { excludeKerbals.Add(Kerbal.Load(kerbalNode)); } CreateDelegates(); } finally { ParameterDelegate <Vessel> .OnDelegateContainerLoad(node); } }
void UpdateCamera() { if (HighLogic.LoadedSceneIsFlight) { if (CameraManager.Instance && CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA && part.vessel.isActiveVessel) { Kerbal camKerbal = InternalCamera.Instance.transform.parent.parent.GetComponent <Kerbal>(); if (camKerbal && camKerbal.InPart == part) { InternalCamera.Instance.maxPitch = maxPitch; InternalCamera.Instance.minPitch = minPitch; InternalCamera.Instance.maxRot = maxRot; hasResetCamRanges = false; float camYaw = Vector3.Angle(Vector3.ProjectOnPlane(InternalCamera.Instance.transform.forward, internalProp.transform.up), -internalProp.transform.forward); float sign = Mathf.Sign(Vector3.Dot(InternalCamera.Instance.transform.forward, -internalProp.transform.right)); Vector3 lp = InternalCamera.Instance.transform.parent.localPosition; float normYaw = Mathf.Clamp((camYaw / 160), -1, 1); float worldScale = InternalCamera.Instance.transform.parent.InverseTransformVector(InternalCamera.Instance.transform.parent.right).x; InternalCamera.Instance.transform.parent.localPosition = new Vector3(sign * normYaw * normYaw * (0.28f * worldScale), lp.y, lp.z); } else if (!hasResetCamRanges) { ResetCamRanges(); } } else if (!hasResetCamRanges) { ResetCamRanges(); } } }
public KerbalTrait(Kerbal k, KerbalPortrait p) { portrait = p; crew = k; protoCrew = k.protoCrewMember; if (PortraitStats.ctiOk) { trait = CTIWrapper.CTI.getTrait(protoCrew.experienceTrait.Config.Name); iconColor = (trait.Color != null) ? (Color)trait.Color : XKCDColors.White; } GameObject hover = p.hoverObjectsContainer; GameObject role = hover.transform.GetChild(2).gameObject; setupGameObjects(role, hover, protoCrew); addEVAListener(); if (protoCrew.experienceTrait.Config.Name == "Tourist") { touristUpdate(); } cachedTooltip = portrait.tooltip.descriptionString; }
public void EVAClick() { Kerbal thatKerbal = part.FindCurrentKerbal(); if (thatKerbal != null && HighLogic.CurrentGame.Parameters.Flight.CanEVA) { activeKerbal = thatKerbal; if (intAnim != null) { intAnim.enabled = true; intAnim[internalAnimation].speed = 1; intAnim.Play(); intAnimStarted = true; } else { GoEva(); } JUtil.LogMessage(this, "{0} has opened the internal EVA hatch.", thatKerbal.name); } else { JUtil.LogMessage(this, "Could not open the internal EVA hatch, not sure why."); } }
protected override void OnParameterLoad(ConfigNode node) { try { base.OnParameterLoad(node); index = Convert.ToInt32(node.GetValue("index")); count = Convert.ToInt32(node.GetValue("count")); // Legacy support from Contract Configurator 1.8.3 if (node.HasValue("passenger")) { passengers = ConfigNodeUtil.ParseValue <List <string> >(node, "passenger", new List <string>()).Select( name => new Kerbal(name) ).ToList(); } else { foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL")) { passengers.Add(Kerbal.Load(kerbalNode)); } } CreateDelegates(); } finally { ParameterDelegate <Vessel> .OnDelegateContainerLoad(node); } }
public KerbalInfo(KerbalInfo other) { EVA = other.EVA; IsEVA = other.IsEVA; Kerbal = other.Kerbal; Vessel = other.Vessel; }
/// <summary> /// Ejects the Kerbal from the capsule /// </summary> private void GoEject() { print("Go eject..."); InternalSeat commandSeat = part.internalModel.seats[0]; if (commandSeat.taken == true) { activeKerbal = commandSeat.kerbalRef; commandSeat.DespawnCrew(); FlightEVA.SpawnEVA(activeKerbal); bool test = FlightGlobals.ActiveVessel; currentKerbalEVA = FlightGlobals.ActiveVessel.GetComponent <KerbalEVA>(); print("OK..."); if (currentKerbalEVA.OnALadder) { print("On ladder..."); currentKerbalEVA.OnVesselGoOffRails(FlightGlobals.ActiveVessel); } CameraManager.Instance.SetCameraFlight(); activeKerbal = null; } }
private void LateUpdate() { if (!FlightGlobals.ready) { return; } if (FlightGlobals.ActiveVessel == null) { return; } if (FlightGlobals.ActiveVessel.isEVA) { return; } if (reload) { reload = false; var crew = KerbalPortraitGallery.Instance.Portraits; for (int i = 0; i < crew.Count; i++) { KerbalPortrait p = crew[i]; if (p == null) { continue; } Kerbal k = p.crewMember; if (k == null) { return; } if (currentCrew.Contains(p.crewMemberName)) { continue; } if (k.state == Kerbal.States.DEAD) { continue; } KerbalTrait K = new KerbalTrait(k, p); if (K == null) { continue; } currentCrew.Add(p.crewMemberName, K); } } }
void Start() { Settings = new BeKerbalSettings() { EVA_EyeOffset = Vector3.back * 0.0f,//0.1f, EVA_HeadLocation = Vector3.up * 0.35f, EVA_MaxPitch = 25.0f, EVA_MinPitch = -25.0f, EVA_MaxYaw = 45.0f, EVA_MinYaw = -45.0f, EVA_LookSentivity = 1.0f, EVA_ViewTurnPercent = 0.25f, EVA_RagdollComponentReferenceName = "helmetCollider", EVA_HiddenComponentsName = new string[] { "headMesh", "eyeball", "upTeeth", "pupil", }, EVA_HelmetColliderComponentName = "helmetCollider", EVA_HelmetColliderRadiusFactor = 1.5f, EVA_NearClip = 0.01f, IVA_GoToEVAKeyCode = KeyCode.Backspace, MapControl_LockID = "BeKerbal_MapControlID", }; CurrentKerbal = null; }
protected override void OnParameterLoad(ConfigNode node) { try { count = ConfigNodeUtil.ParseValue <int>(node, "count"); index = ConfigNodeUtil.ParseValue <int>(node, "index"); foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL")) { // Legacy support for Contract Configurator 1.8.3 if (kerbalNode.HasValue("kerbal")) { kerbalNode.AddValue("name", kerbalNode.GetValue("kerbal")); } kerbals.Add(Kerbal.Load(kerbalNode)); recovered[kerbals.Last().name] = ConfigNodeUtil.ParseValue <bool>(kerbalNode, "recovered"); } CreateDelegates(); } finally { ParameterDelegate <string> .OnDelegateContainerLoad(node); } }
public void OnMouseDown() { if (part != null) { Kerbal k = part.FindCurrentKerbal(); if (k != null) { // Disallow tourists using props if (k.protoCrewMember.type == ProtoCrewMember.KerbalType.Tourist) { if (UnityEngine.Random.Range(0, 10) > 8) { ScreenMessages.PostScreenMessage(string.Format("Stop touching buttons, {0}!", k.name), 4.0f, ScreenMessageStyle.UPPER_CENTER); } else { ScreenMessages.PostScreenMessage(string.Format("Tourist {0} may not operate equipment.", k.name), 4.0f, ScreenMessageStyle.UPPER_CENTER); } return; } } } foreach (PageTriggerSet monitor in pageTriggers) { monitor.ShowNext(); } foreach (HandlerID consumer in clickHandlersID) { consumer.function(consumer.idValue); } foreach (Action clickHandler in clickHandlers) { clickHandler(); } }
protected override void OnAccepted() { // Create all the passengers for (int i = 0; i < count; i++) { // Create the ProtoCrewMember ProtoCrewMember crewMember = null; // Try to get existing passenger if (kerbals.Count > i) { crewMember = HighLogic.CurrentGame.CrewRoster.AllKerbals().Where(pcm => pcm.name == kerbals[i].name).FirstOrDefault(); if (crewMember != null) { crewMember.hasToured = false; } } if (crewMember == null) { // Generate the ProtoCrewMember Kerbal kerbal = (i < kerbals.Count()) ? kerbals.ElementAt(i) : new Kerbal(); if (i >= kerbals.Count()) { kerbal.kerbalType = ProtoCrewMember.KerbalType.Tourist; } kerbal.GenerateKerbal(); crewMember = kerbal.pcm; } passengers[crewMember] = false; } kerbals.Clear(); }
public void EVAClick() { Kerbal thatKerbal = part.FindCurrentKerbal(); float acLevel = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.AstronautComplex); bool evaUnlocked = GameVariables.Instance.UnlockedEVA(acLevel); bool evaPossible = GameVariables.Instance.EVAIsPossible(evaUnlocked, vessel); if (evaPossible && thatKerbal != null && HighLogic.CurrentGame.Parameters.Flight.CanEVA) { activeKerbal = thatKerbal; if (intAnim != null) { intAnim.enabled = true; intAnim[internalAnimation].speed = 1; intAnim.Play(); intAnimStarted = true; } else { GoEva(); } JUtil.LogMessage(this, "{0} has opened the internal EVA hatch.", thatKerbal.name); } else { if (evaPossible) { JUtil.LogMessage(this, "Could not open the internal EVA hatch, not sure why."); } else { JUtil.LogMessage(this, "EVA hatches can not be opened - is the astronaut complex upgraded yet?"); } } }
bool KerbalIsOnVessel(Vessel vessel, Kerbal kerbal) { if (kerbal == null) { return(false); } return(vessel.GetVesselCrew().Contains(kerbal.protoCrewMember)); }
private void GoEva() { if (activeKerbal != null) { FlightEVA.SpawnEVA(activeKerbal); CameraManager.Instance.SetCameraFlight(); activeKerbal = null; } }
public void SyncKerbal() { Kerbal.ChangeName(Name); Kerbal.stupidity = Stupidity; Kerbal.courage = Courage; Kerbal.isBadass = Badass; Kerbal.gender = Gender; Kerbal.type = Type; }
protected override void OnLoad(ConfigNode node) { base.OnLoad(node); foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL")) { kerbals.Add(Kerbal.Load(kerbalNode)); } }
private void RemoveKerbals() { LoggingUtil.LogVerbose(this, "Removing kerbals"); foreach (ProtoCrewMember kerbal in passengers.Keys) { Kerbal.RemoveKerbal(kerbal); } passengers.Clear(); }
private void RemoveKerbals() { LoggingUtil.LogDebug(this, "Removing kerbals..."); foreach (Kerbal kerbal in kerbals) { Kerbal.RemoveKerbal(kerbal); } kerbals.Clear(); }
// Select the good kerbal on IVA after an EVA void OnCrewBoardVessel(GameEvents.FromToAction <Part, Part> part) { ProtoCrewMember _pcrew = part.to.protoModuleCrew.Find(item => item.KerbalRef.crewMemberName == part.from.vessel.vesselName); if (_pcrew != null) { EVAKerbal = _pcrew.KerbalRef; } Log("OnCrewBoardVessel", "QIVA"); }
//utility methods private void SetHelmet(bool value) { foreach (var rend in Kerbal.GetComponentsInChildren <Renderer>()) { if (rend.name == "helmet" || rend.name == "visor" || rend.name == "flare1" || rend.name == "flare2") { rend.enabled = value; } } _hasHelmet = value; }
internal static bool InActiveCrew(Kerbal crew) { for (int i = 0; i < KerbalPortraitGallery.Instance.ActiveCrew.Count; ++i) { if (KerbalPortraitGallery.Instance.ActiveCrew[i] == crew) { return(true); } } return(false); }
public KerbalEditorForm( ) { InitializeComponent( ); this.editing = false; cmb_kerbal_select.Items.AddRange(roster.GetNames( ).ToArray( )); cmb_role.Items.AddRange(Professions); cmb_state.Items.AddRange(States); currentKerbal = roster.GetKerbal(0); ToggleControls( ); UpdateDisplay( ); }
internal static bool InActiveCrew(Kerbal crew, bool checkName = false) { if (!checkName) { return KerbalPortraitGallery.Instance.ActiveCrew.Any(p => p == crew); } else { return KerbalPortraitGallery.Instance.ActiveCrew.Any(p => p.crewMemberName == crew.crewMemberName); } }
internal static bool HasPortrait(Kerbal crew, bool checkName = false) { if (!checkName) { return KerbalPortraitGallery.Instance.Portraits.Any(p => p.crewMember == crew); } else { return KerbalPortraitGallery.Instance.Portraits.Any(p => p.crewMemberName == crew.crewMemberName); } }
private void IVA(Vessel vessel) { if (!HighLogic.CurrentGame.Parameters.Flight.CanIVA || !FlightGlobals.ready) { return; } if (vessel.GetCrewCount() > 0) { bool _VesselhasOnlyPlaceholder; Kerbal _IVAKerbal; if (VesselHasSeatTaken(vessel, out _IVAKerbal, out _VesselhasOnlyPlaceholder)) { if (EVAKerbal != null) { if (vessel.GetVesselCrew().Contains(EVAKerbal.protoCrewMember)) { _IVAKerbal = EVAKerbal; } else { EVAKerbal = null; } } if (_IVAKerbal != null) { if (KerbalIsOnVessel(vessel, _IVAKerbal)) { isGoneIVA = CameraManager.Instance.SetCameraIVA(_IVAKerbal, true); } else { isGoneIVA = CameraManager.Instance.SetCameraIVA(); } } else { isGoneIVA = CameraManager.Instance.SetCameraIVA(); } } else if (_VesselhasOnlyPlaceholder) { return; } } else { return; } if (isGoneIVA) { EVAKerbal = null; } }
/// <summary> /// Begins the EVA for the active kerbal. Based on Mihara's Internal Module code for EVA. /// https://github.com/Mihara/RasterPropMonitor/blob/master/RasterPropMonitor/Auxiliary%20modules/JSIInternalEVAHatch.cs /// </summary> private void GoEva() { InternalSeat commandSeat = part.internalModel.seats[0]; if (commandSeat.taken == true) { activeKerbal = commandSeat.kerbalRef; commandSeat.DespawnCrew(); FlightEVA.SpawnEVA(activeKerbal); CameraManager.Instance.SetCameraFlight(); activeKerbal = null; } }
// AutoHide UI and Kerbal Info void OnIVACameraKerbalChange(Kerbal kerbal) { if (kerbal != null) { Log(string.Format("IVA switch to {0}({1}) experienceTrait: {2}, partName: ({3}){4}", kerbal.crewMemberName, kerbal.protoCrewMember.seatIdx, kerbal.protoCrewMember.experienceTrait.Title, kerbal.protoCrewMember.seat.part.partInfo.category, kerbal.protoCrewMember.seat.part.name)); ScrMsg(false, kerbal); StartCoroutine(WaitToHideUI()); } else { Log("Can't find the current Kerbal", "QIVA"); } }
public void EVAClick() { Kerbal thatKerbal = part.FindCurrentKerbal(); if (thatKerbal != null && HighLogic.CurrentGame.Parameters.Flight.CanEVA) { activeKerbal = thatKerbal; if (intAnim != null) { intAnim.enabled = true; intAnim[internalAnimation].speed = 1; intAnim.Play(); intAnimStarted = true; } else { GoEva(); } JUtil.LogMessage(this, "{0} has opened the internal EVA hatch.", thatKerbal.name); } else JUtil.LogMessage(this, "Could not open the internal EVA hatch, not sure why."); }
/// <summary> /// Destroy Portraits for a kerbal and Unregisters them from the KerbalPortraitGallery /// </summary> /// <param name="kerbal">the Kerbal we want to delete portraits for</param> internal static void DestroyPortrait(Kerbal kerbal) { // set the kerbal InPart to null - this should stop their portrait from re-spawning. kerbal.InPart = null; //Set them visible in portrait to false kerbal.SetVisibleInPortrait(false); kerbal.state = Kerbal.States.NO_SIGNAL; //Loop through the ActiveCrew portrait List for (int i = KerbalPortraitGallery.Instance.ActiveCrew.Count - 1; i >= 0; i--) { //If we find an ActiveCrew entry where the crewMemberName is equal to our kerbal's if (KerbalPortraitGallery.Instance.ActiveCrew[i].crewMemberName == kerbal.crewMemberName) { //we Remove them from the list. KerbalPortraitGallery.Instance.ActiveCrew.RemoveAt(i); } } //Portraits List clean-up. DespawnInactivePortraits(); //Despawn any portraits where CrewMember == null DespawnPortrait(kerbal); //Despawn our Kerbal's portrait UIControlsUpdate(); //Update UI controls }
/// <summary> /// Restore the Portrait for a kerbal and register them to the KerbalPortraitGallery /// </summary> /// <param name="kerbal">the kerbal we want restored</param> /// <param name="part">the part the kerbal is in</param> internal static void RestorePortrait(Part part, Kerbal kerbal) { //We don't process DEAD, Unowned kerbals - Compatibility with DeepFreeze Mod. if (kerbal.rosterStatus != ProtoCrewMember.RosterStatus.Dead && kerbal.protoCrewMember.type != ProtoCrewMember.KerbalType.Unowned) { //Set the Kerbals InPart back to their part. kerbal.InPart = part; //Set their portrait state to ALIVE and set their portrait back to visible. kerbal.state = Kerbal.States.ALIVE; kerbal.SetVisibleInPortrait(true); //Find an ActiveCrew entry and Portraits entry for our kerbal? //If they aren't in ActiveCrew and don't have a Portrait them via the kerbal.Start method. if (!InActiveCrew(kerbal) && !HasPortrait(kerbal)) { kerbal.staticOverlayDuration = 1f; kerbal.randomizeOnStartup = false; kerbal.Start(); } kerbal.state = Kerbal.States.ALIVE; } }
public KerbalTrait(Kerbal k) { protoCrew = k.protoCrewMember; traitPos = crewType(k.protoCrewMember.experienceTrait); levelPos = levelRect(k.protoCrewMember.experienceLevel); }
/** * Personalise Kerbals in an internal space of a vessel. Used by IvaModule. */ public void personaliseIva(Kerbal kerbal) { bool needsSuit = !isHelmetRemovalEnabled || !isSituationSafe(kerbal.InVessel); personaliseKerbal(kerbal, kerbal.protoCrewMember, kerbal.InPart, needsSuit); }
/// <summary> /// Callback when the player switches IVA camera. /// /// BUG: The callback's parameter tells me who the /// previous Kerbal was, not who the new Kerbal is. /// </summary> /// <param name="newKerbal"></param> private void OnIVACameraChange(Kerbal newKerbal) { // Unfortunately, the callback is telling me who the previous Kerbal was, // not who the new Kerbal is. Kerbal activeKerbal = part.FindCurrentKerbal(); if (activeKerbal != null) { int seatID = activeKerbal.protoCrewMember.seatIdx; if (seatID != oldSeat) { UpdateCameras(seatID, activeKerbal); } } }
/// <summary> /// Take care of updating everything. /// </summary> /// <param name="seatID"></param> /// <param name="activeKerbal"></param> private void UpdateCameras(int seatID, Kerbal activeKerbal) { InternalCamera.Instance.SetFOV(seats[seatID].fov); InternalCamera.Instance.maxRot = seats[seatID].maxRot; InternalCamera.Instance.maxPitch = seats[seatID].maxPitch; InternalCamera.Instance.minPitch = seats[seatID].minPitch; RPMVesselComputer comp = null; if (RPMVesselComputer.TryGetInstance(vessel, ref comp)) { comp.SetKerbalVisible(activeKerbal, seats[seatID].hideKerbal); } oldSeat = seatID; }
private void TexReplacerPersonaliseKerbal(Kerbal kerbal) { //This will re-personalise a kerbal who has been personalised using Texture replacer mod. try { Utilities.Log_Debug("Texture Replacer installed. Re-PersonliseKerbal"); if (TRWrapper.APIReady && TRWrapper.InstanceExists) { TRWrapper.TexRepPersonaliser.personaliseIva(kerbal); } else { Debug.Log("DeepFreeze has been unable to connect to Texture Replacer mod. API is not ready. Report this error on the Forum Thread."); } } catch (Exception ex) { Debug.Log("Exception attempting to restore Kerbals Texture Replacer mod customisations. Report this error on the Forum Thread."); Debug.Log("Err: " + ex); } }
internal void checkPortraitRegistered(Kerbal kerbal) { if (!DFPortraits.HasPortrait(kerbal, true)) { vessel.DespawnCrew(); base.StartCoroutine(CallbackUtil.DelayedCallback(3, new Callback(this.delayedSpawnCrew))); } }
private void OnIVACameraKerbalChange(Kerbal kerbal) { activatedAt = DateTime.Now; }
/// <summary> /// Personalise IVA textures of a kerbal /// </summary> /// <param name="kerbal">The Kerbal reference</param> /// <returns>Success of call</returns> internal void personaliseIva(Kerbal kerbal) { try { personaliseIvaMethod.Invoke(APIactualTRPersonaliser, new Object[] { kerbal }); } catch (Exception ex) { LogFormatted("Unable to invoke Texture Replacer personaliseIva Method"); LogFormatted("Exception: {0}", ex); //throw; } }
//reflecting protected methods inside a public class. Until KSP 1.1.x can rectify the situation. internal static void DespawnPortrait(Kerbal kerbal) { MethodInfo DespawnPortraitMethod = typeof(KerbalPortraitGallery).GetMethod("DespawnPortrait", eFlags, Type.DefaultBinder, new Type[] { typeof(Kerbal) }, null); DespawnPortraitMethod.Invoke(KerbalPortraitGallery.Instance, new object[] { kerbal }); }