public progressBodyCollection(CelestialBodySubtree b)
        {
            body = b.Body;

            if (b.Body.isHomeWorld)
            {
                homeworld = true;
            }
            else
            {
                addProgressStandard(ProgressType.FLIGHT, b.Body, b.flight, progressParser.flightDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.flight));
                addProgressStandard(ProgressType.SUBORBIT, b.Body, b.suborbit, progressParser.suborbitDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.suborbit));
                addProgressStandard(ProgressType.FLYBY, b.Body, b.flyBy, progressParser.flybyDescriptor);
                addProgressStandard(ProgressType.FLYBYRETURN, b.Body, b.returnFromFlyby, progressParser.returnFlybyDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromFlyby));
                addProgressStandard(ProgressType.LANDINGRETURN, b.Body, b.returnFromSurface, progressParser.returnLandingDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromSurface));
            }

            addProgressStandard(ProgressType.ESCAPE, b.Body, b.escape, progressParser.escapeDescriptor);
            addProgressStandard(ProgressType.BASECONSTRUCTION, b.Body, b.baseConstruction, progressParser.baseDescriptor, progressParser.FacilityNote, progressParser.vesselNameFromNode(b.baseConstruction));
            addProgressStandard(ProgressType.CREWTRANSFER, b.Body, b.crewTransfer, progressParser.crewTransferDescriptor);
            addProgressStandard(ProgressType.DOCKING, b.Body, b.docking, progressParser.dockingDescriptor);
            addProgressStandard(ProgressType.FLAGPLANT, b.Body, b.flagPlant, progressParser.flagDescriptor);
            addProgressStandard(ProgressType.LANDING, b.Body, b.landing, progressParser.landingDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.landing));
            addProgressStandard(ProgressType.ORBIT, b.Body, b.orbit, progressParser.orbitDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.orbit));
            addProgressStandard(ProgressType.ORBITRETURN, b.Body, b.returnFromOrbit, progressParser.returnOrbitDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromOrbit));
            addProgressStandard(ProgressType.RENDEZVOUS, b.Body, b.rendezvous, progressParser.rendezvousDescriptor);
            addProgressStandard(ProgressType.SCIENCE, b.Body, b.science, progressParser.scienceDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.science));
            addProgressStandard(ProgressType.SPACEWALK, b.Body, b.spacewalk, progressParser.spacewalkDescriptor, progressParser.CrewNote, progressParser.crewNameFromNode(b.spacewalk));
            addProgressStandard(ProgressType.SPLASHDOWN, b.Body, b.splashdown, progressParser.splashdownDescriptor);
            addProgressStandard(ProgressType.STATIONCONSTRUCTION, b.Body, b.stationConstruction, progressParser.stationDescriptor, progressParser.FacilityNote, progressParser.vesselNameFromNode(b.stationConstruction));
            addProgressStandard(ProgressType.SURFACEEVA, b.Body, b.surfaceEVA, progressParser.EVADescriptor, progressParser.CrewNote, progressParser.crewNameFromNode(b.surfaceEVA));
        }
        public override bool RequirementMet(ConfiguredContract contract)
        {
            CelestialBodySubtree tree = GetCelestialBodySubtree();

            return(base.RequirementMet(contract) && tree.flyBy != null &&
                   tree.flyBy.IsComplete);
        }
Ejemplo n.º 3
0
        private static bool CheckTree(CelestialBodySubtree tree, ProgressItem pi)
        {
            if (tree == null)
            {
                return(false);
            }

            switch (pi)
            {
            case ProgressItem.REACHED:
                return(tree.IsReached);

            case ProgressItem.ORBITED:
                return(tree.orbit.IsComplete);

            case ProgressItem.LANDED:
                return(tree.landing.IsComplete);

            case ProgressItem.ESCAPED:
                return(tree.escape.IsComplete);

            case ProgressItem.RETURNED_FROM:
                return(tree.returnFromFlyby.IsComplete);
            }

            return(false);
        }
		public progressBodyCollection(CelestialBodySubtree b)
		{
			body = b.Body;

			if (b.Body.isHomeWorld)
			{
				homeworld = true;
			}
			else
			{
				addProgressStandard(ProgressType.FLIGHT, b.Body, b.flight, progressParser.flightDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.flight));
				addProgressStandard(ProgressType.SUBORBIT, b.Body, b.suborbit, progressParser.suborbitDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.suborbit));
				addProgressStandard(ProgressType.FLYBY, b.Body, b.flyBy, progressParser.flybyDescriptor);
				addProgressStandard(ProgressType.FLYBYRETURN, b.Body, b.returnFromFlyby, progressParser.returnFlybyDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromFlyby));
				addProgressStandard(ProgressType.LANDINGRETURN, b.Body, b.returnFromSurface, progressParser.returnLandingDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromSurface));
			}

			addProgressStandard(ProgressType.ESCAPE, b.Body, b.escape, progressParser.escapeDescriptor);
			addProgressStandard(ProgressType.BASECONSTRUCTION, b.Body, b.baseConstruction, progressParser.baseDescriptor, progressParser.FacilityNote, progressParser.vesselNameFromNode(b.baseConstruction));
			addProgressStandard(ProgressType.CREWTRANSFER, b.Body, b.crewTransfer, progressParser.crewTransferDescriptor);
			addProgressStandard(ProgressType.DOCKING, b.Body, b.docking, progressParser.dockingDescriptor);
			addProgressStandard(ProgressType.FLAGPLANT, b.Body, b.flagPlant, progressParser.flagDescriptor);
			addProgressStandard(ProgressType.LANDING, b.Body, b.landing, progressParser.landingDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.landing));
			addProgressStandard(ProgressType.ORBIT, b.Body, b.orbit, progressParser.orbitDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.orbit));
			addProgressStandard(ProgressType.ORBITRETURN, b.Body, b.returnFromOrbit, progressParser.returnOrbitDescriptor, progressParser.RecoveryNote, progressParser.vesselNameFromNode(b.returnFromOrbit));
			addProgressStandard(ProgressType.RENDEZVOUS, b.Body, b.rendezvous, progressParser.rendezvousDescriptor);
			addProgressStandard(ProgressType.SCIENCE, b.Body, b.science, progressParser.scienceDescriptor, progressParser.StandardNote, progressParser.vesselNameFromNode(b.science));
			addProgressStandard(ProgressType.SPACEWALK, b.Body, b.spacewalk, progressParser.spacewalkDescriptor, progressParser.CrewNote, progressParser.crewNameFromNode(b.spacewalk));
			addProgressStandard(ProgressType.SPLASHDOWN, b.Body, b.splashdown, progressParser.splashdownDescriptor);
			addProgressStandard(ProgressType.STATIONCONSTRUCTION, b.Body, b.stationConstruction, progressParser.stationDescriptor, progressParser.FacilityNote, progressParser.vesselNameFromNode(b.stationConstruction));
			addProgressStandard(ProgressType.SURFACEEVA, b.Body, b.surfaceEVA, progressParser.EVADescriptor, progressParser.CrewNote, progressParser.crewNameFromNode(b.surfaceEVA));
		}
Ejemplo n.º 5
0
        public override bool MeetRequirements()
        {
            CelestialBodySubtree progress = null;

            foreach (var node in ProgressTracking.Instance.celestialBodyNodes)
            {
                if (node.Body == Planetarium.fetch.Home)
                {
                    progress = node;
                }
            }
            if (progress == null)
            {
                StnSciScenario.LogError("ProgressNode for Kerbin not found, terminating");
                return(false);
            }
            if (progress.orbit.IsComplete &&
                (IsPartUnlocked("dockingPort1") ||
                 IsPartUnlocked("dockingPort2") ||
                 IsPartUnlocked("dockingPort3") ||
                 IsPartUnlocked("dockingPortLarge") ||
                 IsPartUnlocked("dockingPortLateral")) &&
                (IsPartUnlocked("StnSciLab") || IsPartUnlocked("StnSciCyclo")))
            {
                return(true);
            }
            return(false);
        }
        public override bool RequirementMet(ConfiguredContract contract)
        {
            // Perform another validation of the target body to catch late validation issues due to expressions
            if (!ValidateTargetBody())
            {
                return(false);
            }

            // Validate the CelestialBodySubtree exists
            CelestialBodySubtree cbProgress = GetCelestialBodySubtree();

            if (cbProgress == null)
            {
                LoggingUtil.LogError(this, ": ProgressNode for targetBody " + targetBody.bodyName + " not found.");
                return(false);
            }

            if (checkType == CheckType.MANNED)
            {
                return(cbProgress.IsReached && cbProgress.IsCompleteManned);
            }
            else if (checkType == CheckType.UNMANNED)
            {
                return(cbProgress.IsReached && cbProgress.IsCompleteUnmanned);
            }

            return(true);
        }
Ejemplo n.º 7
0
        protected override bool Check(CelestialBodySubtree cbs)
        {
            if (cbs.returnFromSurface.IsReached && cbs.returnFromSurface.IsCompleteManned)
            {
                return(true);
            }

            // Check if a Kerbal has returned from the surface, and consider that good enough
            return(HighLogic.CurrentGame.CrewRoster.Crew.Any(pcm => pcm.careerLog.HasEntry(FlightLog.EntryType.Land, cbs.Body.name)));
        }
Ejemplo n.º 8
0
        private static bool IsReached(CelestialBody cb, ProgressItem pi)
        {
            if (ProgressTracking.Instance == null)
            {
                return(false);
            }

            CelestialBodySubtree tree = ProgressTracking.Instance.celestialBodyNodes.Where(node => node.Body == cb).FirstOrDefault();

            return(tree == null ? false : CheckTree(tree, pi));
        }
Ejemplo n.º 9
0
        public override bool RequirementMet(ConfiguredContract contract)
        {
            // Validate the CelestialBodySubtree exists
            CelestialBodySubtree cbProgress = GetCelestialBodySubtree();

            if (cbProgress == null)
            {
                LoggingUtil.LogError(this.GetType(), ": ProgressNode for targetBody " + targetBody.bodyName + " not found.");
                return(false);
            }
            return(true);
        }
Ejemplo n.º 10
0
        private static void loadNextBodyNode(CelestialBodySubtree b)
        {
            if (b == null)
            {
                return;
            }

            if (b.Body == null)
            {
                return;
            }

            addBodySubTree(b);
        }
Ejemplo n.º 11
0
        private static IEnumerator parseProgressTree()
        {
            loaded = false;

            int timer = 0;

            while (ProgressTracking.Instance == null && timer < 500)
            {
                timer++;
                yield return(null);
            }

            if (timer >= 500)
            {
                Debug.Log("[Progress Tracking Parser] Progress Parser Timed Out");
                loaded = false;
                yield break;
            }

            while (timer < 10)
            {
                timer++;
                yield return(null);
            }

            bodySubTrees.Clear();
            standardNodes.Clear();
            intervalNodes.Clear();
            pointsOfInterest.Clear();

            loadIntervalNodes();
            loadStandardNodes();
            loadPOINodes();

            for (int i = 0; i < ProgressTracking.Instance.celestialBodyNodes.Length; i++)
            {
                CelestialBodySubtree b = ProgressTracking.Instance.celestialBodyNodes[i];

                loadNextBodyNode(b);
            }

            updateCompletionRecord();

            loaded = true;

            onProgressParsed.Fire();

            Debug.Log("[Progress Tracking Parser] Progress Nodes Loaded...");
        }
        public override bool MeetRequirements()
        {
            CelestialBodySubtree kerbinProgress = null;

            foreach (var node in ProgressTracking.Instance.celestialBodyNodes)
            {
                if (node.Body == Planetarium.fetch.Home)
                {
                    kerbinProgress = node;
                }
            }
            if (kerbinProgress == null)
            {
                return(false);
            }

            return(ExperimentFactory.getAvailableExperiments(ExperimentFactory.KEMINI_EXPERIMENTS).Count > 0);
        }
Ejemplo n.º 13
0
        public static void addBodySubTree(CelestialBodySubtree body)
        {
            if (body == null)
            {
                return;
            }

            if (body.Body == null)
            {
                return;
            }

            if (bodySubTrees.Contains(body.Body.displayName.LocalizeBodyName()))
            {
                return;
            }

            bodySubTrees.Add(body.Body.displayName.LocalizeBodyName(), new progressBodyCollection(body));
        }
        public override bool MeetRequirements()
        {
            CelestialBodySubtree kerbinProgress = null;

            foreach (var node in ProgressTracking.Instance.celestialBodyNodes)
            {
                if (node.Body == Planetarium.fetch.Home)
                {
                    kerbinProgress = node;
                }
            }
            if (kerbinProgress == null)
            {
                return(false);
            }

            return((kerbinProgress.orbit.IsComplete &&
                    isPartUnlocked(KEES_PC) &&
                    isPartUnlocked(KEES_PEC) &&
                    isPartUnlocked(KEES_PPMD)) &&
                   ScenarioUpgradeableFacilities.GetFacilityLevel("SpaceCenter/AstronautComplex") > 0.1f);
        }
 protected override bool Check(CelestialBodySubtree cbs)
 {
     return cbs.orbit.IsReached;
 }
Ejemplo n.º 16
0
 protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree)
 {
     return(celestialBodySubtree.returnFromFlyby);
 }
Ejemplo n.º 17
0
 protected override bool Check(CelestialBodySubtree cbs)
 {
     return(cbs.returnFromSurface.IsReached);
 }
Ejemplo n.º 18
0
 protected override bool Check(CelestialBodySubtree cbs)
 {
     return(cbs.returnFromOrbit.IsReached && cbs.returnFromOrbit.IsCompleteManned);
 }
Ejemplo n.º 19
0
		private static void loadNextBodyNode(CelestialBodySubtree b)
		{
			if (b == null)
				return;

			if (b.Body == null)
				return;

			addBodySubTree(b);
		}
 protected override bool Check(CelestialBodySubtree cbs)
 {
     return cbs.landing.IsReached && cbs.landing.IsCompleteManned;
 }
 protected abstract bool Check(CelestialBodySubtree cbs);
 protected override bool Check(CelestialBodySubtree cbs)
 {
     return cbs.returnFromSurface.IsReached;
 }
        protected override bool Check(CelestialBodySubtree cbs)
        {
            if (cbs.returnFromSurface.IsReached && cbs.returnFromSurface.IsCompleteManned)
            {
                return true;
            }

            // Check if a Kerbal has returned from the surface, and consider that good enough
            return HighLogic.CurrentGame.CrewRoster.Crew.Any(pcm => pcm.careerLog.HasEntry(FlightLog.EntryType.Land, cbs.Body.name));
        }
 protected override bool Check(CelestialBodySubtree cbs)
 {
     return cbs.returnFromOrbit.IsReached && cbs.returnFromOrbit.IsCompleteManned;
 }
 protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree)
 {
     return(celestialBodySubtree.rendezvous);
 }
Ejemplo n.º 26
0
		public static void addBodySubTree(CelestialBodySubtree body)
		{
			if (body == null)
				return;

			if (body.Body == null)
				return;

			if (bodySubTrees.Contains(body.Body.theName))
				return;			

			bodySubTrees.Add(body.Body.theName, new progressBodyCollection(body));
		}
 protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree)
 {
     return(celestialBodySubtree.splashdown);
 }
Ejemplo n.º 28
0
 protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree)
 {
     return(celestialBodySubtree.baseConstruction);
 }
Ejemplo n.º 29
0
        // Generate returns true => ok to generate new contract, false => don't generate a new contract
        protected override bool Generate()
        {
            Debug.Log ("MCC_contract: Generate called");

            totalContracts = ContractSystem.Instance.GetCurrentContracts<MCC_Contract>().Count();
            TotalFinished = ContractSystem.Instance.GetCompletedContracts<MCC_Contract>().Count();

            Debug.Log("Example Contracts: total=" + totalContracts + " / " + " finished=" + TotalFinished);

            //Rewrite so Duna progress is required to spawn the contract
            foreach (var node in ProgressTracking.Instance.celestialBodyNodes)
            {
                if (node.Body == targetBody)
                    progress = node;
            }
            if (progress == null)
            {
                Debug.LogError ("ProgressNode for targetBody " + targetBody.bodyName + " not found, terminating contract");
                return false;
            }

            // contract generation limiter, x contracts available at the same time
            if (totalContracts > 0)
            {
                Debug.Log("MCC_contract count is: " + totalContracts + ", so we generate this contract, return true, else false");
                return false;
            }

            if (TotalFinished == 1)
            {
                Debug.Log ("MCC_contract: 1 instance of MCC contract is completed, don't generate example contract any more");
                return false;
            }

            // Objective: reach an altitude of 1500 min up to 6000 m
            // fix
            this.AddParameter (new MCC_Param(1000 + UnityEngine.Random.Range(500, 5000)), null);

            // The first time, agent may not be displayed right (a stock one is used), clikcing on icon "fix" this :/.
            // (Maybe because I have messed up my career save while making this.)
            base.agent = Contracts.Agents.AgentList.Instance.GetAgent("Kerbin World-Firsts Record-Keeping Society");
            base.SetExpiry ();
            base.SetScience (500, targetBody);
            base.SetDeadlineYears (15, targetBody);
            base.SetReputation (500, targetBody);
            base.SetFunds(250000, 780000, targetBody);

            // example of settings prestige, but it seems to be bad this way, dig into this thread
            // http://forum.kerbalspaceprogram.com/threads/86588-Contract-Modding-Information-for-Mod-Authors
            // for more info.
            //this.prestige = Contract.ContractPrestige.Significant;

            Debug.Log ("MCC_contract: Generate end, return true");
            return true;
        }
Ejemplo n.º 30
0
 protected abstract ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree);
Ejemplo n.º 31
0
 protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree)
 {
     return(celestialBodySubtree.docking);
 }
Ejemplo n.º 32
0
        // Determines whether a body was already visited
        protected bool ReachedBody(CelestialBody body)
        {
            CelestialBodySubtree bodyTree = ProgressTracking.Instance.GetBodyTree(body.name);

            return(bodyTree != null && bodyTree.IsReached);
        }
Ejemplo n.º 33
0
        // Determines whether a body was already visited
        private static Boolean ReachedBody(CelestialBody body)
        {
            CelestialBodySubtree bodyTree = ProgressTracking.Instance.GetBodyTree(body.name);

            return(bodyTree != null && bodyTree.IsReached);
        }
Ejemplo n.º 34
0
 protected abstract bool Check(CelestialBodySubtree cbs);
Ejemplo n.º 35
0
 protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree)
 {
     return(celestialBodySubtree.surfaceEVA);
 }
Ejemplo n.º 36
0
 protected override bool Check(CelestialBodySubtree cbs)
 {
     return(cbs.orbit.IsReached);
 }