protected override void AwardCompletion() { base.AwardCompletion(); Debug.Log("[LRTR] DownrangeDistance AwardCompletion"); var cc = (ConfiguredContract)Root; if (cc.AutoAccept) { string contractName = ConfiguredContract.contractTypeName(cc); Debug.Log("[LRTR] Contract name: " + contractName); GameEvents.onGameSceneSwitchRequested.Add(SceneChangeInProgress); if (CompletedParams == null) { CompletedParams = new Dictionary <string, DownrangeDistance>(); } if (CompletedParams.ContainsKey(contractName)) { CompletedParams[contractName] = this; } else { CompletedParams.Add(contractName, this); } } }
public override bool RequirementMet(ConfiguredContract contract) { if (contract.targetBody == null) { return(false); } switch (field) { case RadiationFieldType.INNER_BELT: return(KerbalismContracts.Instance.BodyData(contract.targetBody).has_inner); case RadiationFieldType.OUTER_BELT: return(KerbalismContracts.Instance.BodyData(contract.targetBody).has_outer); case RadiationFieldType.MAGNETOPAUSE: return(KerbalismContracts.Instance.BodyData(contract.targetBody).has_pause); case RadiationFieldType.ANY: return(KerbalismContracts.Instance.BodyData(contract.targetBody).has_inner || KerbalismContracts.Instance.BodyData(contract.targetBody).has_outer || KerbalismContracts.Instance.BodyData(contract.targetBody).has_pause); } 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 ProgressNode 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); }
/// <summary> /// Copy constructor. /// </summary> public WaypointGenerator(WaypointGenerator orig, ConfiguredContract contract) : base() { foreach (WaypointData old in orig.waypoints) { // Copy waypoint data for (int i = 0; i < old.count; i++) { WaypointData wpData = new WaypointData(old, contract); waypoints.Add(wpData); // Set the name if (old.names.Any()) { wpData.waypoint.name = (old.names.Count() == 1 ? old.names.First() : old.names.ElementAtOrDefault(i)); } if (string.IsNullOrEmpty(wpData.waypoint.name) || wpData.waypoint.name.ToLower() == "site") { wpData.waypoint.name = StringUtilities.GenerateSiteName(random.Next(), wpData.waypoint.celestialBody, !wpData.waterAllowed); } // Handle waypoint chaining if (wpData.chained && i != 0) { wpData.nearIndex = waypoints.Count - 2; } } } initialized = orig.initialized; orig.initialized = false; this.contract = contract; Initialize(); }
public override bool RequirementMet(ConfiguredContract contract) { foreach (CelestialBody body in Database.instance.BodyList) { if (Database.instance.CelestialBodies[body].isResearched && Database.instance.CelestialBodies[body].researchState < 100) { if (host == "Observatory") { if (RBRange.WithinObsRange(body.transform)) { return(true); } } else { if (FlightGlobals.fetch != null) { for (int i = 0; i < FlightGlobals.Vessels.Count; i++) { double range = 0; if (RBRange.VesselHasModuleTrackBodies(FlightGlobals.Vessels[i], out range)) { if (RBRange.WithinVslRange(FlightGlobals.Vessels[i], body.transform)) { return(true); } } } } } } } return(false); }
protected override void OnRegister() { base.OnRegister(); GameEvents.onLaunch.Add(new EventData <EventReport> .OnEvent(OnLaunch)); try { var cc = (ConfiguredContract)Root; string contractName = ConfiguredContract.contractTypeName(cc); if (cc.AutoAccept && CompletedParams != null && CompletedParams.ContainsKey(contractName)) { Debug.Log("[LRTR] Carrying starting point over to new contract..."); DownrangeDistance oldParam = CompletedParams[contractName]; triggered = oldParam.triggered; curDist = oldParam.curDist; markLatitude = oldParam.markLatitude; markLongitude = oldParam.markLongitude; } } catch (Exception ex) { Debug.LogError("[LRTR] OnRegisterError: " + ex); } }
protected void OnContractLoaded(ConfiguredContract contract) { if (contract == Root) { CreateTimerParameter(); } }
public override bool RequirementMet(ConfiguredContract contract) { if (pqsCity != null) { latitude = targetBody.GetLatitude(pqsCity.transform.position); longitude = targetBody.GetLongitude(pqsCity.transform.position); pqsCity = null; } return(SCANsatUtil.IsCovered(latitude, longitude, SCANsatUtil.GetSCANtype(scanType), targetBody)); }
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; } double coverageInPercentage = SCANsatUtil.GetCoverage(SCANsatUtil.GetSCANtype(scanType), targetBody); return coverageInPercentage >= minCoverage && coverageInPercentage <= maxCoverage; }
public override bool RequirementMet(ConfiguredContract contract) { LoggingUtil.LogVerbose(this, "Checking requirement"); // Perform another validation of the target body to catch late validation issues due to expressions if (!ValidateTargetBody()) { return(false); } return(RemoteTechProgressTracker.Instance.ActiveRange(targetBody) > range); }
public override bool RequirementMet(ConfiguredContract contract) { bool bOpen = LaunchSiteManager.getIsSiteOpen(basename); if (bOpen) { return(false); } else { return(true); } }
public override bool RequirementMet(ConfiguredContract contract) { TieredResource resource = ColonizationResearchScenario.Instance.AllResourcesTypes.FirstOrDefault(r => r.ResearchCategory.Name == this.researchCategory); if (resource == null) { Debug.LogError($"Misconfigured PksTierRequirement - unknown resource '{this.researchCategory}'"); return(false); } TechTier tier = ColonizationResearchScenario.Instance.GetMaxUnlockedTier(resource, this.targetBody.name); return((int)tier > this.tier); }
public override bool RequirementMet(ConfiguredContract contract) { LoggingUtil.LogVerbose(this, "Checking requirement"); if (RemoteTechProgressTracker.Instance == null) { // Assume no coverage return(maxCoverage == 0.0); } double coverage = RemoteTechProgressTracker.Instance.GetCoverage(targetBody); return(coverage >= minCoverage && coverage <= maxCoverage); }
private bool ContractTypeMatches(Contract contract) { // Get the contract type Type contractType = contract.GetType(); string contractTypeName = contractType.Name; if (contractTypeName == "ConfiguredContract") { contractTypeName = ConfiguredContract.contractGroupName(contract); } // Check if contract type matches return(contractTypes.Contains(contractTypeName)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { // Set legacy values if (legacy) { kerbals = passengerName.Select(name => new Kerbal(gender, name, experienceTrait)).ToList(); } // Set the kerbal type foreach (Kerbal kerbal in kerbals) { kerbal.kerbalType = kerbalType; } return(new SpawnPassengers(kerbals, count, removePassengers)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { ContractBehaviour result; if (current != null) { result = current; current = null; } else { result = new SpawnKerbal(spawnKerbalTemplate); } return(result); }
public override ContractBehaviour Generate(ConfiguredContract contract) { WaypointGenerator result; if (current != null) { result = current; current = null; result.SetContract(contract); } else { result = new WaypointGenerator(waypointGeneratorTemplate, contract); } return(result); }
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; } if (pqsCity != null) { latitude = targetBody.GetLatitude(pqsCity.transform.position); longitude = targetBody.GetLongitude(pqsCity.transform.position); pqsCity = null; } return SCANsatUtil.IsCovered(latitude, longitude, SCANsatUtil.GetSCANtype(scanType), targetBody); }
public override bool RequirementMet(ConfiguredContract contract) { LoggingUtil.LogVerbose(this, "Checking requirement"); // Perform another validation of the target body to catch late validation issues due to expressions if (!ValidateTargetBody()) { return(false); } if (RemoteTechProgressTracker.Instance == null) { // Assume no coverage return(maxCoverage == 0.0); } double coverage = RemoteTechProgressTracker.GetCoverage(targetBody); return(coverage >= minCoverage && coverage <= maxCoverage); }
public override bool RequirementMet(ConfiguredContract contract) { if (contract == null) { return(false); } if (contract.ContractState == Contract.State.Active) { return(true); } for (int i = 0; i < PSystemSetup.Instance.SpaceCenterFacilities.Length; i++) { if (PSystemSetup.Instance.SpaceCenterFacilities[i].name == facility) { int level = Mathf.RoundToInt(ScenarioUpgradeableFacilities.GetFacilityLevel(facility) + 1); return(level >= minLevel); } } RSTLogWriter.Log("Observatory NOT found...."); return(false); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return(new CloseBase(conditions, basename)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return new Expression(expression); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return(new ExperimentalPart(parts, add, remove)); }
public override bool RequirementMet(ConfiguredContract contract) { return(LaunchSiteManager.checkLaunchSiteExists(basename)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return(new AwardExperience(parameter, kerbals, experience, awardImmediately)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return(new ChangeVesselOwnership(onState, vessels, owned, parameter)); }
public override bool RequirementMet(ConfiguredContract contract) { double coverageInPercentage = SCANUtil.GetCoverage((int)scanType, targetBody); return(coverageInPercentage >= minCoverage && coverageInPercentage <= maxCoverage); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return(new Expression(expression)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return new AwardExperience(parameter, experience, awardImmediately); }
public override ContractBehaviour Generate(ConfiguredContract contract) { throw new InvalidOperationException("Cannot generate invalid behaviour."); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return(new UnlockPart(parts, unlockTech)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return(new WaypointGenerator(waypointGenerator, contract)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return new RunCutScene(onState, parameter, cutSceneDefinition); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return new ChangeVesselOwnership(onState, vessels, owned, parameter); }
public override bool RequirementMet(ConfiguredContract contract) { return(!LaunchSiteManager.getIsSiteOpen(basename)); }
public override ContractBehaviour Generate(ConfiguredContract contract) { return(new SpawnVessel(spawnVessel)); }
public override bool RequirementMet(ConfiguredContract contract) { return(Configuration.HideRadiationBelts); }
public ContractContainer(ConfiguredContract contract) { this.contract = contract; contractType = contract.contractType; }