예제 #1
0
        protected override void OnUpdate()
        {
            base.OnUpdate();
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }
            if (state != ParameterState.Incomplete)
            {
                return;
            }

            //Get the kerbal object
            if (kerbal == null)
            {
                KerbalRoster roster = HighLogic.CurrentGame.CrewRoster;
                if (roster.Exists(kerbalName))
                {
                    kerbal = roster[kerbalName];
                }
            }
            if (kerbal == null)
            {
                SetIncomplete();
                return;
            }
            if (specificVesselParam == null)
            {
                specificVesselParam = Root.GetParameter <SpecificVesselParameter>();
            }
            if (specificVesselParam == null)
            {
                SetIncomplete();
                return;
            }

            //If we're at the desired vessel, then check to see if the kerbal is aboard.
            if (specificVesselParam.State == ParameterState.Complete)
            {
                if (FlightGlobals.ActiveVessel.GetVesselCrew().Contains(kerbal))
                {
                    SetComplete();
                }
                else
                {
                    SetIncomplete();
                }
            }
            else
            {
                SetIncomplete();
            }
        }
예제 #2
0
        protected override void OnCompleted()
        {
            Log.detail("OnCompleted");

            foreach (ProtoCrewMember tourist in tourists)
            {
                Log.detail("Setting hasToured for {0}", tourist.name);
                KerbalRoster roster = HighLogic.CurrentGame.CrewRoster;
                if (roster.Exists(tourist.name))
                {
                    ProtoCrewMember t = roster[tourist.name];
                    t.type      = ProtoCrewMember.KerbalType.Tourist;
                    t.hasToured = true;
                }
            }
            base.OnCompleted();
        }
        protected override void OnCompleted()
        {
            KourageousTouristsAddOn.printDebug($"OnCompleted");

            foreach (var tourist in tourists)
            {
                KourageousTouristsAddOn.printDebug($"Setting hasToured for {tourist.name}");
                KerbalRoster roster = HighLogic.CurrentGame.CrewRoster;
                if (roster.Exists(tourist.name))
                {
                    ProtoCrewMember t = roster[tourist.name];
                    t.type      = ProtoCrewMember.KerbalType.Tourist;
                    t.hasToured = true;
                }
            }
            base.OnCompleted();
        }
예제 #4
0
        protected override void checkSituation()
        {
            if (!HighLogic.LoadedSceneIsFlight)
            {
                return;
            }

            if (FlightGlobals.ActiveVessel.mainBody.flightGlobalsIndex == FlightGlobals.GetHomeBodyIndex() &&
                (FlightGlobals.ActiveVessel.situation == Vessel.Situations.LANDED ||
                 FlightGlobals.ActiveVessel.situation == Vessel.Situations.SPLASHED ||
                 FlightGlobals.ActiveVessel.situation == Vessel.Situations.PRELAUNCH))
            {
                if (kerbal == null)
                {
                    KerbalRoster roster = HighLogic.CurrentGame.CrewRoster;
                    if (roster.Exists(kerbalName))
                    {
                        kerbal = roster[kerbalName];
                    }
                }
                if (kerbal == null)
                {
                    isCompleted = false;
                    SetIncomplete();
                }

                if (FlightGlobals.ActiveVessel.GetVesselCrew().Contains(kerbal))
                {
                    isCompleted = true;
                    base.SetComplete();
                }
                else
                {
                    isCompleted = false;
                    SetIncomplete();
                }
            }
            else
            {
                base.SetIncomplete();
            }
        }