Example #1
0
        public override void OnLoad(ConfigNode node)
        {
            // Sanity check: this module only applies to KerbalEVAs
            if (!part.Modules.Contains <KerbalEVA>())
            {
                EvaInfoAddon.Log($"{part.name} is not a KerbalEVA! Removing module.");
                part.RemoveModule(this);
            }

            // Safety check: Community Trait Icons is available
            if (HighLogic.LoadedSceneIsFlight && !EvaInfoAddon.foundCTI)
            {
                EvaInfoAddon.Log("Unable to proceed without Community Trait Icons; removing module.");
                part.RemoveModule(this);
            }
        }
Example #2
0
        public override void OnStart(StartState state)
        {
            if (!HighLogic.LoadedSceneIsFlight)
            {
                return;
            }

            int crewCount = vessel.GetCrewCount();

            if (crewCount < 1)
            {
                EvaInfoAddon.Log($"EVA Kerbal vessel {vessel.name} has {crewCount} crew. Perhaps this kerbal is dead inside?");
                EvaInfoAddon.Log("Unable to proceed; removing module.");
                part.RemoveModule(this);
                return;
            }
            if (crewCount > 1)
            {
                EvaInfoAddon.Log($"EVA Kerbal vessel {vessel.name} has {crewCount} crew. Perhaps this kerbal has multiple personality disorder?");
                EvaInfoAddon.Log("Proceeding using dominant personality (the first one in the list).");
            }

            this.pcm      = vessel.GetVesselCrew()[0];
            headTransform = this.transform.Find("helmetAndHeadCollider");

            SetupPane();
            if (EvaInfoAddon.ShowInfo)
            {
                PositionPane();
            }
            else
            {
                UpdateVisibility();
            }

            GameEvents.onKerbalNameChanged.Add(OnKerbalNameChanged);
            GameEvents.onKerbalLevelUp.Add(OnKerbalLevelUp);
            EvaInfoAddon.onToggleInfo.Add(UpdateVisibility);
        }