Ejemplo n.º 1
0
        private void Start()
        {
            if (Instance != null || !foundCTI)
            {
                // Reloading of GameDatabase causes another copy of addon to spawn at next opportunity. Suppress it.
                // see: https://forum.kerbalspaceprogram.com/index.php?/topic/7542-x/&do=findComment&comment=3574980
                Destroy(gameObject);
                return;
            }

            foundCTI = CTIWrapper.initCTIWrapper() && CTIWrapper.CTI.Loaded;
            if (!foundCTI)
            {
                Log("ERROR: Community Trait Icons was not found!");
                Destroy(gameObject);
                return;
            }

            Instance = this;
            DontDestroyOnLoad(gameObject);

            toolbarBtnOn  = GameDatabase.Instance.GetTexture("EvaInfo/icons/button/icon-48-on", false);
            toolbarBtnOff = GameDatabase.Instance.GetTexture("EvaInfo/icons/button/icon-48-off", false);
            GameEvents.onGUIApplicationLauncherReady.Add(OnAppLauncherReady);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 private void OnDestroy()
 {
     GameEvents.onGUIApplicationLauncherReady.Remove(OnAppLauncherReady);
     GameEvents.onGUIApplicationLauncherUnreadifying.Remove(OnAppLauncherUnreadifying);
     Instance = null;
 }