├── .github └── workflows │ ├── attachReleaseArtifacts.yml │ ├── build.yml │ └── pr-comment.yml ├── .gitignore ├── CHANGES.txt ├── CREDITS.txt ├── ContractConfiguratorRO.netkan ├── GameData ├── ContractConfigurator │ ├── Agencies │ │ ├── ARM.cfg │ │ ├── ARM.dds │ │ ├── ARM_scaled.truecolor │ │ ├── Base.cfg │ │ ├── Base.dds │ │ ├── Base_scaled.truecolor │ │ ├── CollectScience.cfg │ │ ├── CollectScience.dds │ │ ├── CollectScience_scaled.truecolor │ │ ├── ContractConfigurator.cfg │ │ ├── ContractConfigurator.dds │ │ ├── ContractConfigurator_scaled.truecolor │ │ ├── DMOS.cfg │ │ ├── Explore.cfg │ │ ├── Explore.dds │ │ ├── Explore_scaled.truecolor │ │ ├── FlagPlanting.cfg │ │ ├── FlagPlanting.dds │ │ ├── FlagPlanting_scaled.truecolor │ │ ├── GrandTour.cfg │ │ ├── GrandTour.dds │ │ ├── GrandTour_scaled.truecolor │ │ ├── ISRU.cfg │ │ ├── ISRU.dds │ │ ├── ISRU_scaled.truecolor │ │ ├── LICENSE.txt │ │ ├── PartTest.cfg │ │ ├── PartTest.dds │ │ ├── PartTest_scaled.truecolor │ │ ├── Rescue.cfg │ │ ├── Rescue.dds │ │ ├── Rescue_scaled.truecolor │ │ ├── Robotics.cfg │ │ ├── Robotics.dds │ │ ├── Robotics_scaled.truecolor │ │ ├── Satellite.cfg │ │ ├── Satellites.dds │ │ ├── Satellites_scaled.truecolor │ │ ├── Sentinel.cfg │ │ ├── Sentinel.dds │ │ ├── Sentinel_scaled.truecolor │ │ ├── Stations.cfg │ │ ├── Stations.dds │ │ ├── Stations_scaled.truecolor │ │ ├── Survey.dds │ │ ├── Survey_scaled.truecolor │ │ ├── Surveys.cfg │ │ ├── Tourism.cfg │ │ ├── Tourism.dds │ │ └── Tourism_scaled.truecolor │ ├── BiomeDataDefault.cfg │ ├── ContractConfigurator.cfg.default │ ├── ContractConfigurator.version │ ├── LICENSE_CC_RemoteTech.txt │ ├── LICENSE_ContractConfigurator.txt │ ├── LICENSE_KerKonConConExt.txt │ ├── LICENSE_RemoteTech.txt │ ├── LICENSE_SCANsat.txt │ ├── Localization │ │ ├── en-us.cfg │ │ └── zh-cn.cfg │ ├── PluginData │ │ └── empty.txt │ ├── icons │ │ ├── LICENSE.txt │ │ ├── check.png │ │ ├── close.png │ │ ├── cross.png │ │ ├── cutscene.png │ │ └── toolbar.png │ ├── patches │ │ ├── Agent_Title.cfg │ │ └── Contracts.cfg │ ├── science │ │ ├── DMagicOrbitalScience.cfg │ │ ├── Impact.cfg │ │ ├── Mkerb.cfg │ │ ├── N3h3miah.cfg │ │ ├── SCANsat.cfg │ │ ├── SolarScience.cfg │ │ ├── StationScience.cfg │ │ ├── SurfaceExperimentPackage.cfg │ │ ├── TarsierSpaceTechnology.cfg │ │ ├── USI.cfg │ │ └── stock.cfg │ └── ui │ │ ├── MissionControl.dds │ │ ├── TrackingStation.dds │ │ ├── eva_ac_female.dds │ │ ├── eva_ac_male.dds │ │ ├── eva_kerbin_female.dds │ │ ├── eva_kerbin_male.dds │ │ ├── eva_space_female.dds │ │ ├── eva_space_male.dds │ │ ├── iva_female.dds │ │ └── iva_male.dds └── ContractPacks │ └── README.txt ├── LICENSE.txt ├── assets ├── Agents │ ├── ContractConfigurator.xcf │ ├── Robotics.xcf │ └── Sentinel.xcf ├── MissionControl.xcf ├── TrackingStation.xcf ├── cutscene.xcf └── toolbar.xcf ├── source ├── CC_RemoteTech │ ├── ActiveVesselRangeRequirement.cs │ ├── CC_RemoteTech.csproj │ ├── CelestialBodyCoverageFactory.cs │ ├── CelestialBodyCoverageParameter.cs │ ├── CelestialBodyCoverageRequirement.cs │ ├── HasAntennaFactory.cs │ ├── HasAntennaParameter.cs │ ├── KSCConnectivityFactory.cs │ ├── KSCConnectivityParameter.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── RemoteTechAssistant.cs │ ├── RemoteTechParameter.cs │ ├── RemoteTechProgressTracker.cs │ ├── SignalDelayFactory.cs │ ├── SignalDelayParameter.cs │ ├── VesselConnectivityFactory.cs │ └── VesselConnectivityParameter.cs ├── ContractConfigurator.sln ├── ContractConfigurator │ ├── Behaviour │ │ ├── AwardExperience.cs │ │ ├── ChangeKerbalType.cs │ │ ├── ChangeVesselOwnership.cs │ │ ├── CopyCraftFile.cs │ │ ├── DestroyVessel.cs │ │ ├── DialogBox.cs │ │ ├── ExperimentalPart.cs │ │ ├── Expression.cs │ │ ├── IHasKerbalBehaviour.cs │ │ ├── Message.cs │ │ ├── OrbitGenerator.cs │ │ ├── PartTestHandler.cs │ │ ├── RemoveKerbal.cs │ │ ├── RunCutScene.cs │ │ ├── SpawnKerbal.cs │ │ ├── SpawnPassengers.cs │ │ ├── SpawnVessel.cs │ │ ├── TriggeredBehaviour.cs │ │ ├── UnlockPart.cs │ │ ├── UnlockTech.cs │ │ └── WaypointGenerator.cs │ ├── BehaviourFactory.cs │ ├── BehaviourFactory │ │ ├── AwardExperienceFactory.cs │ │ ├── ChangeKerbalTypeFactory.cs │ │ ├── ChangeVesselOwnershipFactory.cs │ │ ├── CopyCraftFileFactory.cs │ │ ├── DestroyVesselFactory.cs │ │ ├── DialogBoxFactory.cs │ │ ├── ExperimentalPartFactory.cs │ │ ├── ExpressionFactory.cs │ │ ├── InvalidBehaviourFactory.cs │ │ ├── MessageFactory.cs │ │ ├── OrbitGeneratorFactory.cs │ │ ├── RemoveKerbalFactory.cs │ │ ├── RunCutSceneFactory.cs │ │ ├── SpawnKerbalFactory.cs │ │ ├── SpawnPassengersFactory.cs │ │ ├── SpawnVesselFactory.cs │ │ ├── UnlockPartFactory.cs │ │ ├── UnlockTechFactory.cs │ │ └── WaypointGeneratorFactory.cs │ ├── ConfiguredContract.cs │ ├── ContractBehaviour.cs │ ├── ContractConfigurator.cs │ ├── ContractConfigurator.csproj │ ├── ContractGroup.cs │ ├── ContractRequirement.cs │ ├── ContractType.cs │ ├── CutScene │ │ ├── Action │ │ │ ├── CutSceneAction.cs │ │ │ ├── Delay.cs │ │ │ ├── MoveEVAKerbal.cs │ │ │ ├── PositionActor.cs │ │ │ └── SetCamera.cs │ │ ├── Actor │ │ │ ├── Actor.cs │ │ │ └── KerbalActor.cs │ │ ├── Camera │ │ │ ├── CutSceneCamera.cs │ │ │ └── FixedCamera.cs │ │ ├── CutSceneConfigurator.cs │ │ ├── CutSceneDefinition.cs │ │ ├── CutSceneExecutor.cs │ │ └── CutSceneItem.cs │ ├── ExpressionParser │ │ ├── BaseParser.cs │ │ ├── DataNode.cs │ │ ├── ExpressionParser.cs │ │ ├── Function.cs │ │ ├── IExpressionParserRegistrer.cs │ │ ├── Method.cs │ │ ├── Parsers │ │ │ ├── Behaviours │ │ │ │ ├── BehaviourParser.cs │ │ │ │ ├── SpawnKerbalParser.cs │ │ │ │ └── WaypointGeneratorParser.cs │ │ │ ├── Classes │ │ │ │ ├── AgentParser.cs │ │ │ │ ├── CelestialBodyParser.cs │ │ │ │ ├── DurationParser.cs │ │ │ │ ├── ExperienceTraitParser.cs │ │ │ │ ├── KerbalParser.cs │ │ │ │ ├── LaunchSiteParser.cs │ │ │ │ ├── LocationParser.cs │ │ │ │ ├── OrbitParser.cs │ │ │ │ ├── PQSCityParser.cs │ │ │ │ ├── PartParser.cs │ │ │ │ ├── PrestigeParser.cs │ │ │ │ ├── ResourceParser.cs │ │ │ │ ├── Science │ │ │ │ │ ├── BiomeParser.cs │ │ │ │ │ ├── ExperimentParser.cs │ │ │ │ │ ├── ExperimentSituationParser.cs │ │ │ │ │ └── SubjectParser.cs │ │ │ │ ├── TechParser.cs │ │ │ │ ├── VesselIdentifierParser.cs │ │ │ │ ├── VesselParser.cs │ │ │ │ └── WaypointParser.cs │ │ │ └── SimpleTypes │ │ │ │ ├── BooleanValueExpressionParser.cs │ │ │ │ ├── ClassExpressionParser.cs │ │ │ │ ├── EnumExpressionParser.cs │ │ │ │ ├── ListExpressionParser.cs │ │ │ │ ├── NumericValueExpressionParser.cs │ │ │ │ ├── StringExpressionParser.cs │ │ │ │ └── ValueExpressionParser.cs │ │ └── Wrappers │ │ │ ├── Biome.cs │ │ │ ├── Duration.cs │ │ │ ├── Kerbal.cs │ │ │ ├── Location.cs │ │ │ ├── Resource.cs │ │ │ ├── Tech.cs │ │ │ └── VesselIdentifier.cs │ ├── Harmony │ │ ├── ContractSystem.cs │ │ └── Kerbal.cs │ ├── HarmonyPatcher.cs │ ├── IContractConfiguratorFactory.cs │ ├── IKerbalNameStorage.cs │ ├── MissionControlUI.cs │ ├── Other │ │ └── VesselWaypoint.cs │ ├── Parameter │ │ ├── All.cs │ │ ├── AlwaysTrue.cs │ │ ├── Any.cs │ │ ├── AtLeast.cs │ │ ├── AtMost.cs │ │ ├── ContractConfiguratorParameter.cs │ │ ├── Duration.cs │ │ ├── HasAstronaut.cs │ │ ├── KerbalDeathsCustom.cs │ │ ├── MissionTimer.cs │ │ ├── None.cs │ │ ├── Not.cs │ │ ├── ParameterDelegate.cs │ │ ├── PerformOrbitalSurvey.cs │ │ ├── ReachSpaceCustom.cs │ │ ├── RecoverKerbalCustom.cs │ │ ├── SCANsatCoverage.cs │ │ ├── Sequence.cs │ │ ├── TargetDestroyed.cs │ │ ├── Timer.cs │ │ ├── VesselParameter.cs │ │ ├── VesselParameter │ │ │ ├── CollectScienceCustom.cs │ │ │ ├── Docking.cs │ │ │ ├── HasAntenna.cs │ │ │ ├── HasCrew.cs │ │ │ ├── HasCrewCapacity.cs │ │ │ ├── HasPassengers.cs │ │ │ ├── HasResource.cs │ │ │ ├── IsNotVessel.cs │ │ │ ├── NewVessel.cs │ │ │ ├── NoStaging.cs │ │ │ ├── OrbitParameter.cs │ │ │ ├── PartValidation.cs │ │ │ ├── PlantFlagCustom.cs │ │ │ ├── ReachState.cs │ │ │ ├── RecoverVessel.cs │ │ │ ├── Rendezvous.cs │ │ │ ├── ResourceConsuption.cs │ │ │ ├── ReturnHome.cs │ │ │ ├── VesselDestroyed.cs │ │ │ ├── VesselHasVisited.cs │ │ │ ├── VesselIsType.cs │ │ │ ├── VesselMass.cs │ │ │ ├── VesselNotDestroyed.cs │ │ │ └── VisitWaypoint.cs │ │ └── VesselParameterGroup.cs │ ├── ParameterFactory.cs │ ├── ParameterFactory │ │ ├── AllFactory.cs │ │ ├── AnyFactory.cs │ │ ├── AtLeastFactory.cs │ │ ├── AtMostFactory.cs │ │ ├── CollectScienceFactory.cs │ │ ├── DockingFactory.cs │ │ ├── DurationFactory.cs │ │ ├── HasAntennaFactory.cs │ │ ├── HasAstronautFactory.cs │ │ ├── HasCrewCapacityFactory.cs │ │ ├── HasCrewFactory.cs │ │ ├── HasPassengersFactory.cs │ │ ├── HasResourceCapacityFactory.cs │ │ ├── HasResourceFactory.cs │ │ ├── InvalidParameterFactory.cs │ │ ├── IsNotVesselFactory.cs │ │ ├── KerbalDeathsFactory.cs │ │ ├── MissionTimerFactory.cs │ │ ├── NewVesselFactory.cs │ │ ├── NoStagingFactory.cs │ │ ├── NoneFactory.cs │ │ ├── NotFactory.cs │ │ ├── OrbitFactory.cs │ │ ├── PartTestFactory.cs │ │ ├── PartValidationFactory.cs │ │ ├── PerformOrbitalSurveyFactory.cs │ │ ├── PlantFlagFactory.cs │ │ ├── ReachSpaceFactory.cs │ │ ├── ReachSpecificOrbitFactory.cs │ │ ├── ReachStateFactory.cs │ │ ├── RecoverKerbalFactory.cs │ │ ├── RecoverVesselFactory.cs │ │ ├── RendezvousFactory.cs │ │ ├── ResourceConsumptionFactory.cs │ │ ├── ReturnHomeFactory.cs │ │ ├── SCANsatCoverageFactory.cs │ │ ├── SequenceFactory.cs │ │ ├── TargetDestroyedFactory.cs │ │ ├── TimerFactory.cs │ │ ├── VesselDestroyedFactory.cs │ │ ├── VesselIsTypeFactory.cs │ │ ├── VesselMassFactory.cs │ │ ├── VesselNotDestroyedFactory.cs │ │ ├── VesselParameterGroupFactory.cs │ │ └── VisitWaypointFactory.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Requirement │ │ ├── AcceptContractRequirement.cs │ │ ├── All.cs │ │ ├── AltitudeRecordRequirement.cs │ │ ├── Any.cs │ │ ├── AtLeasRequirement.cs │ │ ├── AtMostRequirement.cs │ │ ├── CanResearchTechRequirement.cs │ │ ├── CompleteContractRequirement.cs │ │ ├── ContractCheckRequirement.cs │ │ ├── ExpansionRequirement.cs │ │ ├── ExpressionRequirement.cs │ │ ├── FacilityRequirement.cs │ │ ├── FirstCrewToSurviveRequirement.cs │ │ ├── FirstLaunchRequirement.cs │ │ ├── FundsRequirement.cs │ │ ├── HasAstronautRequirement.cs │ │ ├── InvalidContractRequirement.cs │ │ ├── KSCLandingRequirement.cs │ │ ├── PartModuleTypeUnlockedRequirement.cs │ │ ├── PartModuleUnlockedRequirement.cs │ │ ├── PartUnlockedRequirement.cs │ │ ├── PerformOrbitalSurveyRequirement.cs │ │ ├── ProgressCelestialBodyRequirement.cs │ │ ├── ProgressCelestialBodyRequirement │ │ │ ├── BaseConstructionRequirement.cs │ │ │ ├── DockingRequirement.cs │ │ │ ├── EscapeRequirement.cs │ │ │ ├── FlyByRequirement.cs │ │ │ ├── LandingRequirement.cs │ │ │ ├── OrbitRequirement.cs │ │ │ ├── RendezvousRequirement.cs │ │ │ ├── ReturnFromFlyByRequirement.cs │ │ │ ├── ReturnFromOrbitRequirement.cs │ │ │ ├── ReturnFromSurfaceRequirement.cs │ │ │ ├── SplashDownRequirement.cs │ │ │ └── SurfaceEVARequirement.cs │ │ ├── ReachSpaceRequirement.cs │ │ ├── ReputationRequirement.cs │ │ ├── RunwayLandingRequirement.cs │ │ ├── SCANsatCoverageRequirement.cs │ │ ├── SCANsatLocationCoverageRequirement.cs │ │ ├── ScienceRequirement.cs │ │ ├── SpacewalkRequirement.cs │ │ ├── TechResearchedRequirement.cs │ │ └── ValidVesselRequirement.cs │ ├── ScenarioModules │ │ ├── BiomeTracker.cs │ │ ├── ContractPreLoader.cs │ │ ├── ContractVesselTracker.cs │ │ ├── PersistentDataStore.cs │ │ └── ScienceReporter.cs │ ├── SettingsBuilder.cs │ ├── TrackingStationUI.cs │ └── Util │ │ ├── ConfigNodeUtil.cs │ │ ├── ContractConfiguratorException.cs │ │ ├── ContractDisabler.cs │ │ ├── ContractsWindow.cs │ │ ├── DebugWindow.cs │ │ ├── DebuggingUtils.cs │ │ ├── DraftTwitchViewers.cs │ │ ├── DurationUtil.cs │ │ ├── ExceptionLogWindow.cs │ │ ├── ExceptionUtil.cs │ │ ├── Extensions.cs │ │ ├── LRUCache.cs │ │ ├── LocalizationUtil.cs │ │ ├── LocationUtil.cs │ │ ├── LoggingUtil.cs │ │ ├── PartUtil.cs │ │ ├── PrincipiaUtil.cs │ │ ├── RP0Util.cs │ │ ├── ResearchBodiesWrapper.cs │ │ ├── SCANsatUtil.cs │ │ ├── Science.cs │ │ ├── TextureUtil.cs │ │ ├── TipLoader.cs │ │ ├── TitleTracker.cs │ │ ├── Validation.cs │ │ ├── Version.cs │ │ └── WaypointUtil.cs ├── KerKonConConExt │ ├── Behaviours │ │ ├── CloseBase.cs │ │ ├── CloseBaseFactory.cs │ │ ├── LockBase.cs │ │ ├── LockBaseFactory.cs │ │ ├── OpenBase.cs │ │ ├── OpenBaseFactory.cs │ │ ├── UnlockBase.cs │ │ └── UnlockBaseFactory.cs │ ├── KerKonConConExt.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Requirements │ │ ├── BaseClosedRequirement.cs │ │ ├── BaseExistsRequirement.cs │ │ ├── BaseLockedRequirement.cs │ │ ├── BaseOpenRequirement.cs │ │ └── BaseUnlockedRequirement.cs └── ksplocations_example.props └── test ├── Behaviour ├── AwardExperience.cfg ├── ExperimentalPart.cfg ├── Orbit.cfg ├── SpawnPassengers.cfg ├── UnlockTech.cfg └── WaypointGenerator.cfg ├── CameraTest.cfg ├── DialogBox ├── AnimationTest.cfg ├── DialogBox.cfg └── peppy.png ├── DockingTest.cfg ├── Expression.cfg ├── Groups.cfg ├── LaunchSite.cfg ├── Parameter ├── Kerbal.cfg ├── Miscellaneous.cfg ├── Negative.cfg ├── Planetary.cfg ├── Progression.cfg ├── RemoteTech.cfg ├── Set.cfg ├── VesselAttributes.cfg ├── VesselHistory.cfg ├── VesselParameterGroup.cfg └── VesselState.cfg ├── PartTest.cfg ├── Requirement ├── CelestialBodyProgress.cfg ├── Contract.cfg ├── Miscellaneous.cfg ├── Planetary.cfg ├── Research.cfg ├── Set.cfg └── SpaceProgram.cfg ├── SampleContract.cfg ├── SequenceTest.cfg ├── Spawner ├── Little Plane.craft ├── Little Rocket.craft └── Spawner.cfg └── VesselTracking.cfg /CREDITS.txt: -------------------------------------------------------------------------------- 1 | - SCANsat integration courtesy of tattagreis. 2 | - Some GameDatabase reloading code courtesy of Sarbian (ModuleManager). 3 | - Some code reused from RemoteTech for the RemoteTech integration, credit to the Remote Technologies Group. 4 | -------------------------------------------------------------------------------- /ContractConfiguratorRO.netkan: -------------------------------------------------------------------------------- 1 | { 2 | "spec_version": "v1.16", 3 | "identifier": "ContractConfigurator", 4 | "$kref": "#/ckan/github/KSP-RO/ContractConfigurator", 5 | "name": "Contract Configurator", 6 | "abstract": "A config-file based solution for creating new contracts!", 7 | "license": "MIT", 8 | "release_status": "stable", 9 | "author": [ "nightingale", "KSP-RO team" ], 10 | "$vref": "#/ckan/ksp-avc", 11 | "ksp_version_strict" : true, 12 | "suggests": [ 13 | { "name": "ContractsWindowPlus" } 14 | ], 15 | "recommends": [ 16 | { "name": "WaypointManager" } 17 | ], 18 | "depends": [ 19 | { "name": "ModuleManager" }, 20 | { "name": "Harmony2" } 21 | ], 22 | "resources": { 23 | "homepage": "https://forum.kerbalspaceprogram.com/index.php?/topic/190040--", 24 | "bugtracker": "https://github.com/KSP-RO/ContractConfigurator/issues", 25 | "license": "https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/master/LICENSE.txt", 26 | "manual": "https://github.com/jrossignol/ContractConfigurator/wiki" 27 | }, 28 | "install" : [ 29 | { 30 | "file" : "GameData/ContractConfigurator", 31 | "install_to" : "GameData" 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ARM.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for ARM 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = ARMContract 6 | displayName = #cc.agency.AsteroidRecovery.name 7 | agent = Asteroid Recovery 8 | } 9 | 10 | CONTRACT_DEFINITION 11 | { 12 | name = CometSampleContract 13 | displayName = #cc.agency.CometSample.name 14 | agent = Asteroid Recovery 15 | } 16 | 17 | AGENT 18 | { 19 | name = Asteroid Recovery 20 | title = #cc.agency.AsteroidRecovery.name 21 | 22 | description = #cc.agency.AsteroidRecovery.desc 23 | 24 | logoURL = ContractConfigurator/Agencies/ARM 25 | logoScaledURL = ContractConfigurator/Agencies/ARM_scaled 26 | 27 | mentality = NoRandomContractMentality 28 | } 29 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ARM.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/ARM.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ARM_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/ARM_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Base.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for Base 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = BaseContract 6 | displayName = #cc.agency.BaseConstruction.name 7 | agent = Base Construction 8 | } 9 | 10 | AGENT 11 | { 12 | name = Base Construction 13 | title = #cc.agency.BaseConstruction.name 14 | 15 | description = #cc.agency.BaseConstruction.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/Base 18 | logoScaledURL = ContractConfigurator/Agencies/Base_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Base.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Base.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Base_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Base_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/CollectScience.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for CollectScience 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = DeployedScienceContract 6 | displayName = #cc.agency.DeployedScience.name 7 | agent = Collect Science 8 | } 9 | 10 | CONTRACT_DEFINITION 11 | { 12 | name = CollectScience 13 | displayName = #cc.agency.CollectScience.name 14 | agent = Collect Science 15 | } 16 | 17 | AGENT 18 | { 19 | name = Collect Science 20 | title = #cc.agency.CollectScience.name 21 | 22 | description = #cc.agency.CollectScience.desc 23 | 24 | logoURL = ContractConfigurator/Agencies/CollectScience 25 | logoScaledURL = ContractConfigurator/Agencies/CollectScience_scaled 26 | 27 | mentality = NoRandomContractMentality 28 | } 29 | 30 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/CollectScience.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/CollectScience.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/CollectScience_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/CollectScience_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ContractConfigurator.cfg: -------------------------------------------------------------------------------- 1 | // Agency file for Contract Configurator agency 2 | 3 | AGENT 4 | { 5 | name = Contract Configurator 6 | title = #cc.agency.ContractConfigurator.name 7 | 8 | description = #cc.agency.ContractConfigurator.desc 9 | 10 | logoURL = ContractConfigurator/Agencies/ContractConfigurator 11 | logoScaledURL = ContractConfigurator/Agencies/ContractConfigurator_scaled 12 | 13 | mentality = NoRandomContractMentality 14 | } 15 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ContractConfigurator.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/ContractConfigurator.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ContractConfigurator_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/ContractConfigurator_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/DMOS.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for DMOS contracts 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = DMAnomalyContract 6 | displayName = #cc.agency.Anomalies.name 7 | agent = DMagic 8 | } 9 | 10 | CONTRACT_DEFINITION 11 | { 12 | name = DMAsteroidSurveyContract 13 | displayName = #cc.agency.AsteroidSurvey.name 14 | agent = DMagic 15 | } 16 | 17 | CONTRACT_DEFINITION 18 | { 19 | name = DMMagneticSurveyContract 20 | displayName = #cc.agency.MagneticSurvey.name 21 | agent = DMagic 22 | } 23 | 24 | CONTRACT_DEFINITION 25 | { 26 | name = DMReconContract 27 | displayName = #cc.agency.ReconnaisanceSurvey.name 28 | agent = DMagic 29 | } 30 | 31 | CONTRACT_DEFINITION 32 | { 33 | name = DMSurveyContract 34 | displayName = #cc.agency.OrbitalSurvey.name 35 | agent = DMagic 36 | } 37 | 38 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Explore.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for Exploration 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = ExplorationContract 6 | displayName = #cc.agency.Exploration.name 7 | agent = Exploration 8 | } 9 | 10 | AGENT 11 | { 12 | name = Exploration 13 | title = #cc.agency.Exploration.name 14 | 15 | description = #cc.agency.Exploration.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/Explore 18 | logoScaledURL = ContractConfigurator/Agencies/Explore_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | 23 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Explore.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Explore.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Explore_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Explore_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/FlagPlanting.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for PlantFlag 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = PlantFlag 6 | displayName = #cc.agency.FlagPlanting.name 7 | agent = Flag Planting 8 | } 9 | 10 | AGENT 11 | { 12 | name = Flag Planting 13 | title = #cc.agency.FlagPlanting.name 14 | 15 | description = #cc.agency.FlagPlanting.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/FlagPlanting 18 | logoScaledURL = ContractConfigurator/Agencies/FlagPlanting_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/FlagPlanting.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/FlagPlanting.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/FlagPlanting_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/FlagPlanting_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/GrandTour.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for GrandTour 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = GrandTour 6 | displayName = #cc.agency.GrandTours.name 7 | agent = Grand Tours 8 | } 9 | 10 | AGENT 11 | { 12 | name = Grand Tours 13 | title = #cc.agency.GrandTours.name 14 | 15 | description = #cc.agency.GrandTours.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/GrandTour 18 | logoScaledURL = ContractConfigurator/Agencies/GrandTour_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/GrandTour.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/GrandTour.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/GrandTour_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/GrandTour_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ISRU.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for ISRU 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = ISRUContract 6 | displayName = #cc.agency.ISRU.name 7 | agent = ISRU 8 | } 9 | 10 | AGENT 11 | { 12 | name = ISRU 13 | title = #cc.agency.ISRU.name 14 | 15 | description = #cc.agency.ISRU.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/ISRU 18 | logoScaledURL = ContractConfigurator/Agencies/ISRU_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ISRU.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/ISRU.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/ISRU_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/ISRU_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Icons used under the Flaticon Basic License (http://file000.flaticon.com/downloads/license/license.pdf): 2 | 3 | ContractConfigurator: (Freepik) 4 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/PartTest.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for PartTest 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = PartTest 6 | displayName = #cc.agency.PartTesting.name 7 | agent = Part Testing 8 | } 9 | 10 | AGENT 11 | { 12 | name = Part Testing 13 | title = #cc.agency.PartTesting.name 14 | 15 | description = #cc.agency.PartTesting.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/PartTest 18 | logoScaledURL = ContractConfigurator/Agencies/PartTest_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | 23 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/PartTest.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/PartTest.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/PartTest_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/PartTest_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Rescue.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for RecoverAsset 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = RecoverAsset 6 | displayName = #cc.agency.RescueAndRecovery.name 7 | agent = Rescue and Recovery 8 | } 9 | 10 | AGENT 11 | { 12 | name = Rescue and Recovery 13 | title = #cc.agency.RescueAndRecovery.name 14 | 15 | description = #cc.agency.RescueAndRecovery.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/Rescue 18 | logoScaledURL = ContractConfigurator/Agencies/Rescue_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Rescue.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Rescue.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Rescue_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Rescue_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Robotics.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for CollectScience 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = ROCScienceArmContract 6 | displayName = #cc.agency.RoboticArm.name 7 | agent = Robotics 8 | } 9 | 10 | CONTRACT_DEFINITION 11 | { 12 | name = ROCScienceRetrievalContract 13 | displayName = #cc.agency.RoboticScienceRetrieval.name 14 | agent = Robotics 15 | } 16 | 17 | AGENT 18 | { 19 | name = Robotics 20 | title = #cc.agency.Robotics.name 21 | 22 | description = #cc.agency.Robotics.desc 23 | 24 | logoURL = ContractConfigurator/Agencies/Robotics 25 | logoScaledURL = ContractConfigurator/Agencies/Robotics_scaled 26 | 27 | mentality = NoRandomContractMentality 28 | } 29 | 30 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Robotics.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Robotics.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Robotics_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Robotics_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Satellite.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for SatelliteContract 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = SatelliteContract 6 | displayName = #cc.agency.Satellites.name 7 | agent = Satellites 8 | } 9 | 10 | AGENT 11 | { 12 | name = Satellites 13 | title = #cc.agency.Satellites.name 14 | 15 | description = #cc.agency.Satellites.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/Satellites 18 | logoScaledURL = ContractConfigurator/Agencies/Satellites_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | 23 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Satellites.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Satellites.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Satellites_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Satellites_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Sentinel.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for Sentinel contracts 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = SentinelContract 6 | displayName = #cc.agency.Sentinel.Asteroid.name 7 | agent = Sentinel 8 | } 9 | 10 | CONTRACT_DEFINITION 11 | { 12 | name = CometDetectionContract 13 | displayName = #cc.agency.Sentinel.Comet.name 14 | agent = Sentinel 15 | } 16 | 17 | AGENT 18 | { 19 | name = Sentinel 20 | title = #cc.agency.Sentinel.name 21 | 22 | description = #cc.agency.Sentinel.desc 23 | 24 | logoURL = ContractConfigurator/Agencies/Sentinel 25 | logoScaledURL = ContractConfigurator/Agencies/Sentinel_scaled 26 | 27 | mentality = NoRandomContractMentality 28 | } 29 | 30 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Sentinel.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Sentinel.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Sentinel_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Sentinel_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Stations.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for Stations 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = StationContract 6 | displayName = #cc.agency.Stations.name 7 | agent = Stations 8 | } 9 | 10 | AGENT 11 | { 12 | name = Stations 13 | title = #cc.agency.Stations.name 14 | 15 | description = #cc.agency.Stations.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/Stations 18 | logoScaledURL = ContractConfigurator/Agencies/Stations_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | 23 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Stations.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Stations.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Stations_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Stations_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Survey.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Survey.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Survey_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Survey_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Surveys.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for Surveys 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = SurveyContract 6 | displayName = #cc.agency.Surveys.name 7 | agent = Surveys 8 | } 9 | 10 | AGENT 11 | { 12 | name = Surveys 13 | title = #cc.agency.Surveys.name 14 | 15 | description = #cc.agency.Surveys.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/Survey 18 | logoScaledURL = ContractConfigurator/Agencies/Survey_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | 23 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Tourism.cfg: -------------------------------------------------------------------------------- 1 | // Agency details for Tourism 2 | 3 | CONTRACT_DEFINITION 4 | { 5 | name = TourismContract 6 | displayName = #cc.agency.Tourism.name 7 | agent = Tourism 8 | } 9 | 10 | AGENT 11 | { 12 | name = Tourism 13 | title = #cc.agency.Tourism.name 14 | 15 | description = #cc.agency.Tourism.desc 16 | 17 | logoURL = ContractConfigurator/Agencies/Tourism 18 | logoScaledURL = ContractConfigurator/Agencies/Tourism_scaled 19 | 20 | mentality = NoRandomContractMentality 21 | } 22 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Tourism.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Tourism.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/Agencies/Tourism_scaled.truecolor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/Agencies/Tourism_scaled.truecolor -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ContractConfigurator.cfg.default: -------------------------------------------------------------------------------- 1 | // Contract Configurator configuration file. Contains settings pertaining 2 | // to logging. 3 | // 4 | // TO USE THIS FILE: 5 | // First, copy the file and rename it from ContractConfigurator.cfg.default 6 | // to ContractConfigurator.cfg. Then, add in the desired log levels below. 7 | // You can log specific classes by adding an ADD_LOGLEVEL_EXCEPTION block as 8 | // demonstrated below. 9 | 10 | CC_DEBUGGING 11 | { 12 | // Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR 13 | logLevel = WARNING 14 | 15 | ADD_LOGLEVEL_EXCEPTION 16 | { 17 | // Type name 18 | type = ContractConfigurator 19 | // Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR 20 | logLevel = INFO 21 | } 22 | 23 | ADD_LOGLEVEL_EXCEPTION 24 | { 25 | // Type name 26 | type = ContractType 27 | // Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR 28 | logLevel = INFO 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ContractConfigurator.version: -------------------------------------------------------------------------------- 1 | { 2 | "NAME":"Contract Configurator", 3 | "URL":"https://github.com/KSP-RO/ContractConfigurator/raw/master/GameData/ContractConfigurator/ContractConfigurator.version", 4 | "DOWNLOAD":"https://github.com/KSP-RO/ContractConfigurator/releases", 5 | "CHANGE_LOG_URL":"https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/2.0.0/CHANGES.txt", 6 | "GITHUB":{ 7 | "USERNAME":"KSP-RO", 8 | "REPOSITORY":"ContractConfigurator", 9 | "ALLOW_PRE_RELEASE":false 10 | }, 11 | "VERSION":{ 12 | "MAJOR":2, 13 | "MINOR":11, 14 | "PATCH":2, 15 | "BUILD":0 16 | }, 17 | "KSP_VERSION":{ 18 | "MAJOR":1, 19 | "MINOR":12, 20 | "PATCH":3 21 | }, 22 | "KSP_VERSION_MIN":{ 23 | "MAJOR":1, 24 | "MINOR":12, 25 | "PATCH":3 26 | }, 27 | "KSP_VERSION_MAX":{ 28 | "MAJOR":1, 29 | "MINOR":12, 30 | "PATCH":99 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/LICENSE_ContractConfigurator.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jeremie Rossignol (nightingale) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /GameData/ContractConfigurator/LICENSE_KerKonConConExt.txt: -------------------------------------------------------------------------------- 1 | Originally developed by Ashley Hall (AlphaAsh) under an All Rights Reserved 2 | license. Sublicensed to Jeremie Rossignol with permission to re-license under 3 | the following license: 4 | 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2016 Jeremie Rossignol (nightingale) 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/PluginData/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/PluginData/empty.txt -------------------------------------------------------------------------------- /GameData/ContractConfigurator/icons/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Icons used under CC-BY-3.0 from Yusuke Kamiyamane (http://p.yusukekamiyamane.com/): 2 | check.png 3 | cross.png -------------------------------------------------------------------------------- /GameData/ContractConfigurator/icons/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/icons/check.png -------------------------------------------------------------------------------- /GameData/ContractConfigurator/icons/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/icons/close.png -------------------------------------------------------------------------------- /GameData/ContractConfigurator/icons/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/icons/cross.png -------------------------------------------------------------------------------- /GameData/ContractConfigurator/icons/cutscene.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/icons/cutscene.png -------------------------------------------------------------------------------- /GameData/ContractConfigurator/icons/toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/icons/toolbar.png -------------------------------------------------------------------------------- /GameData/ContractConfigurator/patches/Agent_Title.cfg: -------------------------------------------------------------------------------- 1 | // Fix for agents with missing title string 2 | @AGENT[*]:HAS[~title] { title = #$name$ } 3 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/patches/Contracts.cfg: -------------------------------------------------------------------------------- 1 | // Backwards compatibility for contracts written pre-KSP 1.1 where there was 2 | // a definition for a Wheel PartModuleType. Only include ModuleWheelMotor so 3 | // that landing gear doesn't count as wheels. 4 | @Contracts 5 | { 6 | @MODULE_DEFINITIONS 7 | { 8 | Wheel = ModuleWheelBrakes 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/Impact.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // This file contains experiment definitions for Impact! experiments. 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = Impact 10 | 11 | EXPERIMENT 12 | { 13 | name = ImpactSeismometer 14 | 15 | requireNoAtmosphere = true 16 | partModule = ImpactSeismometer 17 | } 18 | 19 | EXPERIMENT 20 | { 21 | name = ImpactSpectrometer 22 | 23 | requireNoAtmosphere = true 24 | partModule = ImpactSpectrometer 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/Mkerb.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // This file contains experiment definitions for Mkerb Inc. Science Instruments experiments. 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = Mkerb 10 | 11 | EXPERIMENT 12 | { 13 | name = MkerbProbeAlive 14 | } 15 | 16 | EXPERIMENT 17 | { 18 | name = MkerbRad 19 | } 20 | 21 | EXPERIMENT 22 | { 23 | name = MkerbTime 24 | } 25 | 26 | EXPERIMENT 27 | { 28 | name = MkerbSound 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/N3h3miah.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // This file contains experiment definitions for N3h3miah experiments (Orbital Science and others). 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = N3h3miah 10 | 11 | EXPERIMENT 12 | { 13 | name = NE_ADUM 14 | } 15 | 16 | EXPERIMENT 17 | { 18 | name = NE_SpiU 19 | } 20 | 21 | EXPERIMENT 22 | { 23 | name = NE_Test 24 | disallow = true 25 | } 26 | 27 | EXPERIMENT 28 | { 29 | name = NE_FLEX 30 | } 31 | 32 | EXPERIMENT 33 | { 34 | name = NE_CFI 35 | } 36 | 37 | EXPERIMENT 38 | { 39 | name = NE_CCF 40 | } 41 | 42 | EXPERIMENT 43 | { 44 | name = NE_CFE 45 | } 46 | 47 | EXPERIMENT 48 | { 49 | name = NE_MEE1 50 | } 51 | 52 | EXPERIMENT 53 | { 54 | name = NE_MEE2 55 | } 56 | 57 | EXPERIMENT 58 | { 59 | name = NE_MIS1 60 | } 61 | 62 | EXPERIMENT 63 | { 64 | name = NE_MIS2 65 | } 66 | 67 | EXPERIMENT 68 | { 69 | name = NE_MIS3 70 | } 71 | 72 | EXPERIMENT 73 | { 74 | name = NE_CVB 75 | } 76 | 77 | EXPERIMENT 78 | { 79 | name = NE_PACE 80 | } 81 | 82 | MODULE 83 | { 84 | name = NE_ExperimentModule 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/SCANsat.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // This file contains experiment definitions for SCANsat experiments. 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = SCANsat 10 | 11 | EXPERIMENT 12 | { 13 | name = SCANsatAltimetryLoRes 14 | ignored = true 15 | } 16 | 17 | EXPERIMENT 18 | { 19 | name = SCANsatAltimetryHiRes 20 | ignored = true 21 | } 22 | 23 | EXPERIMENT 24 | { 25 | name = SCANsatBiomeAnomaly 26 | ignored = true 27 | } 28 | 29 | EXPERIMENT 30 | { 31 | name = SCANsatResources 32 | ignored = true 33 | } 34 | 35 | EXPERIMENT 36 | { 37 | name = SCANsatVisual 38 | ignored = true 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/SolarScience.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // This file contains experiment definitions for Solar Science experiments. 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = SolarScience 10 | 11 | EXPERIMENT 12 | { 13 | name = HMI 14 | 15 | sunOnly = true 16 | } 17 | 18 | EXPERIMENT 19 | { 20 | name = STEREO 21 | 22 | sunOnly = true 23 | } 24 | 25 | MODULE 26 | { 27 | name = SolarExperiment 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/StationScience.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // This file contains experiment definitions for Station Scienceexperiments. 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = StationScience 10 | 11 | EXPERIMENT 12 | { 13 | name = plantGrowth 14 | 15 | disallowHomeSurface = true 16 | disallowHomeFlying = true 17 | } 18 | 19 | EXPERIMENT 20 | { 21 | name = progradeKuarqs 22 | 23 | disallowHomeSurface = true 24 | disallowHomeFlying = true 25 | } 26 | 27 | EXPERIMENT 28 | { 29 | name = retrogradeKuarqs 30 | 31 | disallowHomeSurface = true 32 | disallowHomeFlying = true 33 | } 34 | 35 | EXPERIMENT 36 | { 37 | name = eccentricKuarqs 38 | 39 | disallowHomeSurface = true 40 | disallowHomeFlying = true 41 | } 42 | 43 | EXPERIMENT 44 | { 45 | name = bioproducts 46 | 47 | disallowHomeSurface = true 48 | disallowHomeFlying = true 49 | } 50 | 51 | EXPERIMENT 52 | { 53 | name = kuarqsBioproducts 54 | 55 | disallowHomeSurface = true 56 | disallowHomeFlying = true 57 | } 58 | 59 | EXPERIMENT 60 | { 61 | name = zoologyBay 62 | 63 | disallowHomeSurface = true 64 | disallowHomeFlying = true 65 | } 66 | 67 | MODULE 68 | { 69 | name = StationExperiment 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/SurfaceExperimentPackage.cfg: -------------------------------------------------------------------------------- 1 | // This file contains experiment definitions for AlbertKermin's Surface 2 | // Experiment Package 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = SurfaceExperimentPackage 10 | 11 | EXPERIMENT 12 | { 13 | name = SEP_StationTest 14 | } 15 | 16 | EXPERIMENT 17 | { 18 | name = SEP_GolfTest 19 | } 20 | 21 | EXPERIMENT 22 | { 23 | name = SEP_Retroreflector 24 | requireNoAtmosphere = true 25 | } 26 | 27 | EXPERIMENT 28 | { 29 | name = SEP_InteriorHeatScan 30 | requireNoAtmosphere = true 31 | } 32 | 33 | EXPERIMENT 34 | { 35 | name = SEP_CCIDscan 36 | requireNoAtmosphere = true 37 | } 38 | 39 | EXPERIMENT 40 | { 41 | name = SEP_SolarwindSpectrum 42 | requireNoAtmosphere = true 43 | } 44 | 45 | EXPERIMENT 46 | { 47 | name = SEP_WeatherScan 48 | } 49 | 50 | EXPERIMENT 51 | { 52 | name = SEP_PSE 53 | requireNoAtmosphere = true 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/TarsierSpaceTechnology.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // This file contains experiment definitions for Tarsier Space Technology experiments. 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = TarsierSpaceTechnology 10 | 11 | EXPERIMENT 12 | { 13 | name = TarsierSpaceTech.SpaceTelescope 14 | 15 | // We ignore the space telescope, as it uses a special "lookingAt" 16 | // situation that we would need to re-write a lot of code to handle. 17 | ignored = true 18 | 19 | part = tarsierSpaceTelescope 20 | part = tarsierAdvSpaceTelescope 21 | } 22 | 23 | EXPERIMENT 24 | { 25 | name = TarsierSpaceTech.ChemCam 26 | 27 | part = tarsierChemCam 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/science/USI.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // This file contains experiment definitions for various Umbra Space Industries experiments. 3 | // 4 | // Author: nightingale 5 | // 6 | 7 | CC_EXPERIMENT_DEFINITIONS 8 | { 9 | name = USI 10 | 11 | EXPERIMENT 12 | { 13 | name = PakRatdataCamera 14 | } 15 | 16 | // Ignore the sounding rocket experiments 17 | EXPERIMENT 18 | { 19 | name = SRExperiment01 20 | ignored = true 21 | } 22 | EXPERIMENT 23 | { 24 | name = SRExperiment02 25 | ignored = true 26 | } 27 | EXPERIMENT 28 | { 29 | name = SRExperiment03 30 | ignored = true 31 | } 32 | EXPERIMENT 33 | { 34 | name = SRExperiment04 35 | ignored = true 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/MissionControl.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/MissionControl.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/TrackingStation.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/TrackingStation.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/eva_ac_female.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/eva_ac_female.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/eva_ac_male.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/eva_ac_male.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/eva_kerbin_female.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/eva_kerbin_female.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/eva_kerbin_male.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/eva_kerbin_male.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/eva_space_female.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/eva_space_female.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/eva_space_male.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/eva_space_male.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/iva_female.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/iva_female.dds -------------------------------------------------------------------------------- /GameData/ContractConfigurator/ui/iva_male.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/GameData/ContractConfigurator/ui/iva_male.dds -------------------------------------------------------------------------------- /GameData/ContractPacks/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains Contract Packs for the Contract Configurator mod, 2 | available from: 3 | https://github.com/jrossignol/ContractConfigurator 4 | 5 | To see a listing of available Contract Packs, please visit: 6 | http://forum.kerbalspaceprogram.com/threads/101604 7 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Detailed license files are included under the GameData directory. This file provides a summary of what falls under what license: 2 | 3 | - Contract Configurator (ContractConfigurator.dll) is licensed under the MIT License. 4 | - SCANsat integration (CC_SCANsat.dll) is licensed under the MIT License. 5 | - RemoteTech integration (CC_RemoteTech.dll) is licensed under GNU GPL v2.0. 6 | - Everything else not specified here falls under the main Contract Configurator license (MIT). 7 | -------------------------------------------------------------------------------- /assets/Agents/ContractConfigurator.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/assets/Agents/ContractConfigurator.xcf -------------------------------------------------------------------------------- /assets/Agents/Robotics.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/assets/Agents/Robotics.xcf -------------------------------------------------------------------------------- /assets/Agents/Sentinel.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/assets/Agents/Sentinel.xcf -------------------------------------------------------------------------------- /assets/MissionControl.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/assets/MissionControl.xcf -------------------------------------------------------------------------------- /assets/TrackingStation.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/assets/TrackingStation.xcf -------------------------------------------------------------------------------- /assets/cutscene.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/assets/cutscene.xcf -------------------------------------------------------------------------------- /assets/toolbar.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/assets/toolbar.xcf -------------------------------------------------------------------------------- /source/CC_RemoteTech/CelestialBodyCoverageFactory.cs: -------------------------------------------------------------------------------- 1 | using ContractConfigurator.Parameters; 2 | using Contracts; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using UnityEngine; 8 | using RemoteTech; 9 | using ContractConfigurator; 10 | 11 | namespace ContractConfigurator.RemoteTech 12 | { 13 | public class CelestialBodyCoverageFactory : ParameterFactory 14 | { 15 | protected double coverage; 16 | 17 | public override bool Load(ConfigNode configNode) 18 | { 19 | // Load base class 20 | bool valid = base.Load(configNode); 21 | 22 | // Before loading, verify the RemoteTech version 23 | valid &= Util.Version.VerifyRemoteTechVersion(); 24 | 25 | valid &= ConfigNodeUtil.ParseValue(configNode, "coverage", x => coverage = x, this, 1.0, x => Validation.BetweenInclusive(x, 0.0, 1.0)); 26 | valid &= ValidateTargetBody(configNode); 27 | 28 | return valid; 29 | } 30 | 31 | public override ContractParameter Generate(Contract contract) 32 | { 33 | // Perform another validation of the target body to catch late validation issues due to expressions 34 | if (!ValidateTargetBody()) 35 | { 36 | return null; 37 | } 38 | 39 | return new CelestialBodyCoverageParameter(coverage, targetBody, title); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/CC_RemoteTech/KSCConnectivityFactory.cs: -------------------------------------------------------------------------------- 1 | using ContractConfigurator.Parameters; 2 | using Contracts; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using UnityEngine; 8 | using RemoteTech; 9 | using ContractConfigurator; 10 | 11 | namespace ContractConfigurator.RemoteTech 12 | { 13 | public class KSCConnectivityFactory : ParameterFactory 14 | { 15 | protected bool hasConnectivity; 16 | 17 | public override bool Load(ConfigNode configNode) 18 | { 19 | // Load base class 20 | bool valid = base.Load(configNode); 21 | 22 | // Before loading, verify the RemoteTech version 23 | valid &= Util.Version.VerifyRemoteTechVersion(); 24 | 25 | valid &= ConfigNodeUtil.ParseValue(configNode, "hasConnectivity", x => hasConnectivity = x, this, true); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractParameter Generate(Contract contract) 31 | { 32 | return new KSCConnectivityParameter(hasConnectivity, title); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/CC_RemoteTech/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CC_RemoteTech")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CC_RemoteTech")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("24e6943a-32fe-4cf5-8735-a1396a1b4865")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.0")] 36 | [assembly: AssemblyFileVersion("2.0.0")] 37 | [assembly: AssemblyInformationalVersion("2.0.0")] 38 | [assembly: KSPAssembly("CC_RemoteTech", 2, 0)] 39 | [assembly: KSPAssemblyDependency("ContractConfigurator", 2, 0)] 40 | [assembly: KSPAssemblyDependency("RemoteTech", 1, 7)] 41 | -------------------------------------------------------------------------------- /source/CC_RemoteTech/RemoteTechParameter.cs: -------------------------------------------------------------------------------- 1 | using ContractConfigurator.Parameters; 2 | using Contracts; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System; 7 | using UnityEngine; 8 | using ContractConfigurator; 9 | using RemoteTech; 10 | 11 | namespace ContractConfigurator.RemoteTech 12 | { 13 | public abstract class RemoteTechParameter : VesselParameter 14 | { 15 | public RemoteTechParameter(string title) 16 | : base(title) 17 | { 18 | } 19 | 20 | protected override void OnRegister() 21 | { 22 | base.OnRegister(); 23 | RemoteTechAssistant.OnRemoteTechUpdate.Add(OnRemoteTechUpdate); 24 | } 25 | 26 | protected override void OnUnregister() 27 | { 28 | base.OnUnregister(); 29 | RemoteTechAssistant.OnRemoteTechUpdate.Remove(OnRemoteTechUpdate); 30 | } 31 | 32 | protected void OnRemoteTechUpdate(VesselSatellite s) 33 | { 34 | CheckVessel(s.parentVessel); 35 | } 36 | 37 | /// 38 | /// Check for whether we are in a valid state to check the given vessel. Checks if the 39 | /// RemoteTech logic is initialized. 40 | /// 41 | /// The vessel - ignored. 42 | /// True only if RemoteTech is initialized. 43 | protected override bool CanCheckVesselMeetsCondition(Vessel vessel) 44 | { 45 | return (RTCore.Instance != null); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/CC_RemoteTech/SignalDelayFactory.cs: -------------------------------------------------------------------------------- 1 | using ContractConfigurator.Parameters; 2 | using Contracts; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using ContractConfigurator; 8 | using UnityEngine; 9 | using RemoteTech; 10 | 11 | namespace ContractConfigurator.RemoteTech 12 | { 13 | public class SignalDelayFactory : ParameterFactory 14 | { 15 | public double minSignalDelay; 16 | public double maxSignalDelay; 17 | 18 | public override bool Load(ConfigNode configNode) 19 | { 20 | // Load base class 21 | bool valid = base.Load(configNode); 22 | 23 | // Before loading, verify the RemoteTech version 24 | valid &= Util.Version.VerifyRemoteTechVersion(); 25 | 26 | valid &= ConfigNodeUtil.ParseValue(configNode, "minSignalDelay", x => minSignalDelay = x, this, 0.0, x => Validation.GE(x, 0.0)); 27 | valid &= ConfigNodeUtil.ParseValue(configNode, "maxSignalDelay", x => maxSignalDelay = x, this, double.MaxValue, x => Validation.GE(x, 0.0)); 28 | valid &= ConfigNodeUtil.AtLeastOne(configNode, new string[] { "minSignalDelay", "maxSignalDelay" }, this); 29 | 30 | return valid; 31 | } 32 | 33 | public override ContractParameter Generate(Contract contract) 34 | { 35 | return new SignalDelayParameter(minSignalDelay, maxSignalDelay, title); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/CC_RemoteTech/VesselConnectivityFactory.cs: -------------------------------------------------------------------------------- 1 | using ContractConfigurator.Parameters; 2 | using Contracts; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using ContractConfigurator; 8 | using UnityEngine; 9 | using RemoteTech; 10 | 11 | namespace ContractConfigurator.RemoteTech 12 | { 13 | public class VesselConnectivityFactory : ParameterFactory 14 | { 15 | protected bool hasConnectivity; 16 | protected VesselIdentifier vessel; 17 | 18 | public override bool Load(ConfigNode configNode) 19 | { 20 | // Load base class 21 | bool valid = base.Load(configNode); 22 | 23 | // Before loading, verify the RemoteTech version 24 | valid &= Util.Version.VerifyRemoteTechVersion(); 25 | 26 | valid &= ConfigNodeUtil.ParseValue(configNode, "hasConnectivity", x => hasConnectivity = x, this, true); 27 | valid &= ConfigNodeUtil.ParseValue(configNode, "vessel", x => vessel = x, this); 28 | 29 | return valid; 30 | } 31 | 32 | public override ContractParameter Generate(Contract contract) 33 | { 34 | return new VesselConnectivityParameter(vessel.identifier, hasConnectivity, title); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Behaviour/ChangeVesselOwnership.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator; 9 | using ContractConfigurator.Parameters; 10 | using ContractConfigurator.ExpressionParser; 11 | 12 | namespace ContractConfigurator.Behaviour 13 | { 14 | /// 15 | /// Behaviour for changing vessel ownership. 16 | /// 17 | public class ChangeVesselOwnership : TriggeredBehaviour 18 | { 19 | private List vessels; 20 | private bool owned; 21 | 22 | public ChangeVesselOwnership() 23 | { 24 | } 25 | 26 | public ChangeVesselOwnership(State onState, List vessels, bool owned, List parameter) 27 | : base(onState, parameter) 28 | { 29 | this.vessels = vessels; 30 | this.owned = owned; 31 | } 32 | 33 | protected override void TriggerAction() 34 | { 35 | foreach (Vessel vessel in vessels.Select(v => ContractVesselTracker.Instance.GetAssociatedVessel(v))) 36 | { 37 | if (vessel != null) 38 | { 39 | vessel.DiscoveryInfo.SetLevel(owned ? DiscoveryLevels.Owned : DiscoveryLevels.Unowned); 40 | } 41 | } 42 | } 43 | 44 | protected override void OnLoad(ConfigNode configNode) 45 | { 46 | base.OnLoad(configNode); 47 | owned = ConfigNodeUtil.ParseValue(configNode, "owned"); 48 | vessels = ConfigNodeUtil.ParseValue>(configNode, "vessel", new List()); 49 | } 50 | 51 | protected override void OnSave(ConfigNode configNode) 52 | { 53 | base.OnSave(configNode); 54 | configNode.AddValue("owned", owned); 55 | foreach (string v in vessels) 56 | { 57 | configNode.AddValue("vessel", v); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Behaviour/IHasKerbalBehaviour.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ContractConfigurator; 6 | 7 | namespace ContractConfigurator 8 | { 9 | public interface IHasKerbalBehaviour 10 | { 11 | int KerbalCount { get; } 12 | Kerbal GetKerbal(int index); 13 | } 14 | 15 | public static class IHasKerbalBehaviourExtensions 16 | { 17 | public static Kerbal GetSpawnedKerbal(this ConfiguredContract contract, int index) 18 | { 19 | int current = index; 20 | int total = 0; 21 | foreach (IHasKerbalBehaviour b in contract.Behaviours.OfType()) 22 | { 23 | total += b.KerbalCount; 24 | if (current < b.KerbalCount) 25 | { 26 | return b.GetKerbal(current); 27 | } 28 | current -= b.KerbalCount; 29 | } 30 | 31 | throw new Exception("ContractConfigurator: index " + index + 32 | " is out of range for number of Kerbals spawned (" + total + "). Check the appropriate behaviour for spawning Kerbals exists on the contract."); 33 | } 34 | 35 | public static int GetSpawnedKerbalCount(this ConfiguredContract contract) 36 | { 37 | int total = 0; 38 | foreach (IHasKerbalBehaviour b in contract.Behaviours.OfType()) 39 | { 40 | total += b.KerbalCount; 41 | } 42 | 43 | return total; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/DestroyVesselFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.IO; 5 | using System.Text; 6 | using UnityEngine; 7 | using KSP; 8 | using ContractConfigurator; 9 | using ContractConfigurator.ExpressionParser; 10 | namespace ContractConfigurator.Behaviour 11 | { 12 | /// 13 | /// BehaviourFactory wrapper for DestroyVessel ContractBehaviour. 14 | /// 15 | public class DestroyVesselFactory : BehaviourFactory 16 | { 17 | protected List vessels; 18 | protected TriggeredBehaviour.State onState; 19 | protected List parameter = new List(); 20 | 21 | public override bool Load(ConfigNode configNode) 22 | { 23 | // Load base class 24 | bool valid = base.Load(configNode); 25 | 26 | valid &= ConfigNodeUtil.ParseValue(configNode, "onState", x => onState = x, this, TriggeredBehaviour.State.CONTRACT_SUCCESS); 27 | if (onState == TriggeredBehaviour.State.PARAMETER_COMPLETED || onState == TriggeredBehaviour.State.PARAMETER_FAILED) 28 | { 29 | valid &= ConfigNodeUtil.ParseValue>(configNode, "parameter", x => parameter = x, this); 30 | } 31 | valid &= ConfigNodeUtil.ParseValue>(configNode, "vessel", x => vessels = x, this); 32 | 33 | return valid; 34 | } 35 | 36 | public override ContractBehaviour Generate(ConfiguredContract contract) 37 | { 38 | return new DestroyVessel(onState, vessels, parameter); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/ExpressionFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | 8 | namespace ContractConfigurator.Behaviour 9 | { 10 | /// 11 | /// BehaviourFactory wrapper for Expression ContractBehaviour. 12 | /// 13 | public class ExpressionFactory : BehaviourFactory 14 | { 15 | Expression expression; 16 | 17 | public override bool Load(ConfigNode configNode) 18 | { 19 | // Load base class 20 | bool valid = base.Load(configNode); 21 | 22 | // Call Expression for load behaviour 23 | try 24 | { 25 | expression = Expression.Parse(configNode, dataNode, this); 26 | } 27 | catch (Exception e) 28 | { 29 | valid = false; 30 | LoggingUtil.LogError(this, "{0}: Couldn't load expression.", ErrorPrefix(configNode)); 31 | LoggingUtil.LogException(e); 32 | } 33 | 34 | return valid && expression != null; 35 | } 36 | 37 | public override ContractBehaviour Generate(ConfiguredContract contract) 38 | { 39 | return new Expression(expression); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/InvalidBehaviourFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | 8 | namespace ContractConfigurator.Behaviour 9 | { 10 | /// 11 | /// Special placeholder for factories that failed to load. 12 | /// 13 | public class InvalidBehaviourFactory : BehaviourFactory 14 | { 15 | public override bool Load(ConfigNode configNode) 16 | { 17 | base.Load(configNode); 18 | return false; 19 | } 20 | 21 | public override ContractBehaviour Generate(ConfiguredContract contract) 22 | { 23 | throw new InvalidOperationException("Cannot generate invalid behaviour."); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/OrbitGeneratorFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using ContractConfigurator; 8 | 9 | namespace ContractConfigurator.Behaviour 10 | { 11 | /// 12 | /// BehaviourFactory wrapper for OrbitGenerator ContractBehaviour. 13 | /// 14 | public class OrbitGeneratorFactory : BehaviourFactory 15 | { 16 | OrbitGenerator orbitGenerator; 17 | 18 | public override bool Load(ConfigNode configNode) 19 | { 20 | // Load base class 21 | bool valid = base.Load(configNode); 22 | 23 | // Call SpawnKerbal for load behaviour 24 | orbitGenerator = OrbitGenerator.Create(configNode, this); 25 | 26 | return valid && orbitGenerator != null; 27 | } 28 | 29 | public override ContractBehaviour Generate(ConfiguredContract contract) 30 | { 31 | return new OrbitGenerator(orbitGenerator, contract); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/RemoveKerbalFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using ContractConfigurator; 8 | 9 | namespace ContractConfigurator.Behaviour 10 | { 11 | /// 12 | /// BehaviourFactory wrapper for RemoveKerbal ContractBehaviour. 13 | /// 14 | public class RemoveKerbalFactory : BehaviourFactory 15 | { 16 | protected List kerbals; 17 | 18 | public override bool Load(ConfigNode configNode) 19 | { 20 | // Load base class 21 | bool valid = base.Load(configNode); 22 | 23 | valid &= ConfigNodeUtil.ParseValue>(configNode, "kerbal", x => kerbals = x, this); 24 | 25 | return valid; 26 | } 27 | 28 | public override ContractBehaviour Generate(ConfiguredContract contract) 29 | { 30 | return new RemoveKerbalBehaviour(kerbals); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/RunCutSceneFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using ContractConfigurator.CutScene; 8 | 9 | namespace ContractConfigurator.Behaviour 10 | { 11 | /// 12 | /// BehaviourFactory wrapper for RunCutScene ContractBehaviour. 13 | /// 14 | public class RunCutSceneFactory : BehaviourFactory 15 | { 16 | private RunCutScene.State onState; 17 | private List parameter = new List(); 18 | private string cutSceneFileURL; 19 | private CutSceneDefinition cutSceneDefinition; 20 | 21 | public override bool Load(ConfigNode configNode) 22 | { 23 | // Load base class 24 | bool valid = base.Load(configNode); 25 | 26 | valid &= ConfigNodeUtil.ParseValue(configNode, "onState", x => onState = x, this, TriggeredBehaviour.State.PARAMETER_COMPLETED); 27 | if (onState == TriggeredBehaviour.State.PARAMETER_COMPLETED || onState == TriggeredBehaviour.State.PARAMETER_FAILED) 28 | { 29 | valid &= ConfigNodeUtil.ParseValue>(configNode, "parameter", x => parameter = x, this, new List()); 30 | } 31 | 32 | if (ConfigNodeUtil.ParseValue(configNode, "cutSceneFileURL", x => cutSceneFileURL = x, this, Validation.ValidateFileURL)) 33 | { 34 | cutSceneDefinition = new CutSceneDefinition(); 35 | cutSceneDefinition.Load(cutSceneFileURL); 36 | } 37 | else 38 | { 39 | valid = false; 40 | } 41 | 42 | return valid; 43 | } 44 | 45 | public override ContractBehaviour Generate(ConfiguredContract contract) 46 | { 47 | return new RunCutScene(onState, parameter, cutSceneDefinition); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/SpawnKerbalFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using ContractConfigurator; 8 | 9 | namespace ContractConfigurator.Behaviour 10 | { 11 | /// 12 | /// BehaviourFactory wrapper for SpawnKerbal ContractBehaviour. 13 | /// 14 | public class SpawnKerbalFactory : BehaviourFactory 15 | { 16 | protected SpawnKerbal spawnKerbalTemplate; 17 | public SpawnKerbal Current 18 | { 19 | get 20 | { 21 | if (HighLogic.CurrentGame == null) 22 | { 23 | return null; 24 | } 25 | 26 | spawnKerbalTemplate.Initialize(); 27 | return spawnKerbalTemplate; 28 | } 29 | } 30 | 31 | public override bool Load(ConfigNode configNode) 32 | { 33 | // Load base class 34 | bool valid = base.Load(configNode); 35 | 36 | // Call SpawnKerbal for load behaviour 37 | spawnKerbalTemplate = SpawnKerbal.Create(configNode, this); 38 | 39 | return valid && spawnKerbalTemplate != null; 40 | } 41 | 42 | public override ContractBehaviour Generate(ConfiguredContract contract) 43 | { 44 | return new SpawnKerbal(spawnKerbalTemplate); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/SpawnVesselFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using ContractConfigurator; 8 | 9 | namespace ContractConfigurator.Behaviour 10 | { 11 | /// 12 | /// BehaviourFactory wrapper for SpawnVessel ContractBehaviour. 13 | /// 14 | public class SpawnVesselFactory : BehaviourFactory 15 | { 16 | SpawnVessel spawnVessel; 17 | 18 | public override bool Load(ConfigNode configNode) 19 | { 20 | // Load base class 21 | bool valid = base.Load(configNode); 22 | 23 | // Call SpawnKerbal for load behaviour 24 | spawnVessel = SpawnVessel.Create(configNode, this); 25 | 26 | return valid && spawnVessel != null; 27 | } 28 | 29 | public override ContractBehaviour Generate(ConfiguredContract contract) 30 | { 31 | return new SpawnVessel(spawnVessel); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/UnlockPartFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using ContractConfigurator; 8 | using ContractConfigurator.ExpressionParser; 9 | namespace ContractConfigurator.Behaviour 10 | { 11 | /// 12 | /// BehaviourFactory wrapper for UnlockPart ContractBehaviour. 13 | /// 14 | public class UnlockPartFactory : BehaviourFactory 15 | { 16 | protected List parts; 17 | protected bool unlockTech; 18 | 19 | public override bool Load(ConfigNode configNode) 20 | { 21 | // Load base class 22 | bool valid = base.Load(configNode); 23 | 24 | valid &= ConfigNodeUtil.ParseValue>(configNode, "part", x => parts = x, this); 25 | valid &= ConfigNodeUtil.ParseValue(configNode, "unlockTech", x => unlockTech = x, this, true); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractBehaviour Generate(ConfiguredContract contract) 31 | { 32 | return new UnlockPart(parts, unlockTech); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/UnlockTechFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using ContractConfigurator; 8 | using ContractConfigurator.ExpressionParser; 9 | namespace ContractConfigurator.Behaviour 10 | { 11 | /// 12 | /// BehaviourFactory wrapper for UnlockTech ContractBehaviour. 13 | /// Author: Klefenz 14 | /// 15 | public class UnlockTechFactory : BehaviourFactory 16 | { 17 | protected List techID; 18 | 19 | public override bool Load(ConfigNode configNode) 20 | { 21 | // Load base class 22 | bool valid = base.Load(configNode); 23 | 24 | valid &= ConfigNodeUtil.ParseValue>(configNode, "techID", x => techID = x, this); 25 | 26 | return valid; 27 | } 28 | 29 | public override ContractBehaviour Generate(ConfiguredContract contract) 30 | { 31 | return new UnlockTech(techID); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/ContractConfigurator/BehaviourFactory/WaypointGeneratorFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using ContractConfigurator; 8 | 9 | namespace ContractConfigurator.Behaviour 10 | { 11 | /// 12 | /// BehaviourFactory wrapper for WaypointGenerator ContractBehaviour. 13 | /// 14 | public class WaypointGeneratorFactory : BehaviourFactory 15 | { 16 | WaypointGenerator waypointGeneratorTemplate; 17 | public WaypointGenerator Current 18 | { 19 | get 20 | { 21 | if (HighLogic.CurrentGame == null || targetBody == null) 22 | { 23 | return null; 24 | } 25 | 26 | waypointGeneratorTemplate.Initialize(); 27 | return waypointGeneratorTemplate; 28 | } 29 | } 30 | 31 | public override bool Load(ConfigNode configNode) 32 | { 33 | // Load base class 34 | bool valid = base.Load(configNode); 35 | 36 | // Call SpawnKerbal for load behaviour 37 | waypointGeneratorTemplate = WaypointGenerator.Create(configNode, this); 38 | 39 | return valid && waypointGeneratorTemplate != null; 40 | } 41 | 42 | public override ContractBehaviour Generate(ConfiguredContract contract) 43 | { 44 | return new WaypointGenerator(waypointGeneratorTemplate, contract); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/ContractConfigurator/CutScene/Action/Delay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace ContractConfigurator.CutScene 8 | { 9 | /// 10 | /// Delay before moving on to the next cut scene action. 11 | /// 12 | public class Delay : CutSceneAction 13 | { 14 | public float delayTime; 15 | 16 | protected float endTime; 17 | 18 | public override string Name() 19 | { 20 | return "Delay"; 21 | } 22 | 23 | public override string Description() 24 | { 25 | return delayTime.ToString("n1") + " second" + (delayTime == 1.0f ? "" : "s"); 26 | } 27 | 28 | public override void InvokeAction() 29 | { 30 | endTime = UnityEngine.Time.fixedTime + delayTime; 31 | } 32 | 33 | public override bool ReadyForNextAction() 34 | { 35 | return UnityEngine.Time.fixedTime > endTime; 36 | } 37 | 38 | public override void OnSave(ConfigNode configNode) 39 | { 40 | configNode.AddValue("delayTime", delayTime); 41 | } 42 | 43 | public override void OnLoad(ConfigNode configNode) 44 | { 45 | delayTime = ConfigNodeUtil.ParseValue(configNode, "delayTime"); 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/ContractConfigurator/CutScene/Action/SetCamera.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace ContractConfigurator.CutScene 8 | { 9 | /// 10 | /// Delay before moving on to the next cut scene action. 11 | /// 12 | public class SetCamera : CutSceneAction 13 | { 14 | public string cameraName; 15 | 16 | public override string Name() 17 | { 18 | return "Camera: Set Current Camera"; 19 | } 20 | 21 | public override string Description() 22 | { 23 | return cameraName; 24 | } 25 | 26 | public override void InvokeAction() 27 | { 28 | cutSceneDefinition.camera(cameraName).MakeActive(); 29 | } 30 | 31 | public override bool ReadyForNextAction() 32 | { 33 | return true; 34 | } 35 | 36 | public override void OnSave(ConfigNode configNode) 37 | { 38 | base.OnSave(configNode); 39 | configNode.AddValue("cameraName", cameraName); 40 | } 41 | 42 | public override void OnLoad(ConfigNode configNode) 43 | { 44 | base.OnLoad(configNode); 45 | cameraName = ConfigNodeUtil.ParseValue(configNode, "cameraName"); 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/ContractConfigurator/CutScene/Actor/Actor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace ContractConfigurator.CutScene 8 | { 9 | public abstract class Actor : CutSceneItem 10 | { 11 | public string name; 12 | 13 | public abstract string Name(); 14 | public string FullDescription() 15 | { 16 | return Name() + " (" + name + ")"; 17 | } 18 | 19 | public virtual void OnSave(ConfigNode configNode) 20 | { 21 | configNode.AddValue("name", name); 22 | } 23 | 24 | public virtual void OnLoad(ConfigNode configNode) 25 | { 26 | name = ConfigNodeUtil.ParseValue(configNode, "name"); 27 | } 28 | 29 | public void Draw() 30 | { 31 | GUILayout.BeginHorizontal(); 32 | GUILayout.Label("Name", GUILayout.Width(CutSceneConfigurator.CutSceneConfigurator.DETAIL_LABEL_WIDTH)); 33 | name = GUILayout.TextField(name, GUILayout.Width(CutSceneConfigurator.CutSceneConfigurator.DETAIL_ENTRY_WIDTH)); 34 | GUILayout.EndHorizontal(); 35 | } 36 | 37 | public abstract Transform Transform { get; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/ContractConfigurator/CutScene/Actor/KerbalActor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace ContractConfigurator.CutScene 8 | { 9 | public class KerbalActor : Actor 10 | { 11 | public string kerbalName; 12 | 13 | public override string Name() 14 | { 15 | return "EVA Kerbal"; 16 | } 17 | 18 | public override void OnSave(ConfigNode configNode) 19 | { 20 | base.OnSave(configNode); 21 | configNode.AddValue("kerbalName", kerbalName); 22 | } 23 | 24 | public override void OnLoad(ConfigNode configNode) 25 | { 26 | base.OnLoad(configNode); 27 | kerbalName = ConfigNodeUtil.ParseValue(configNode, "kerbalName"); 28 | } 29 | 30 | protected ProtoCrewMember pcm 31 | { 32 | get 33 | { 34 | return HighLogic.CurrentGame.CrewRoster.AllKerbals().Where(cm => cm != null && cm.name == kerbalName).FirstOrDefault(); 35 | } 36 | } 37 | 38 | public Vessel vessel 39 | { 40 | get 41 | { 42 | return FlightGlobals.Vessels.SingleOrDefault(v => v.GetVesselCrew().Any(cm => cm != null && cm.name == kerbalName)); 43 | } 44 | } 45 | 46 | public Vessel eva 47 | { 48 | get 49 | { 50 | Vessel v = vessel; 51 | return v != null && v.vesselType == VesselType.EVA ? v : null; 52 | } 53 | } 54 | 55 | public override Transform Transform 56 | { 57 | get 58 | { 59 | return eva.transform; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source/ContractConfigurator/CutScene/Camera/CutSceneCamera.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using ContractConfigurator; 7 | 8 | namespace ContractConfigurator.CutScene 9 | { 10 | public abstract class CutSceneCamera : CutSceneItem 11 | { 12 | public string name; 13 | 14 | public abstract string Name(); 15 | public string FullDescription() 16 | { 17 | return Name() + " (" + name + ")"; 18 | } 19 | 20 | public abstract void OnDraw(); 21 | 22 | public virtual void OnSave(ConfigNode configNode) 23 | { 24 | configNode.AddValue("name", name); 25 | } 26 | 27 | public virtual void OnLoad(ConfigNode configNode) 28 | { 29 | name = ConfigNodeUtil.ParseValue(configNode, "name"); 30 | } 31 | 32 | public void Draw() 33 | { 34 | GUILayout.BeginHorizontal(); 35 | GUILayout.Label("Name", GUILayout.Width(CutSceneConfigurator.CutSceneConfigurator.DETAIL_LABEL_WIDTH)); 36 | name = GUILayout.TextField(name, GUILayout.Width(CutSceneConfigurator.CutSceneConfigurator.DETAIL_ENTRY_WIDTH)); 37 | GUILayout.EndHorizontal(); 38 | 39 | OnDraw(); 40 | } 41 | 42 | public abstract void MakeActive(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/ContractConfigurator/CutScene/CutSceneItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ContractConfigurator.CutScene 7 | { 8 | interface CutSceneItem 9 | { 10 | string FullDescription(); 11 | void Draw(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/IExpressionParserRegistrer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ContractConfigurator.ExpressionParser 7 | { 8 | /// 9 | /// Interface for class that registers one or more expression parsers. 10 | /// 11 | public interface IExpressionParserRegistrer 12 | { 13 | void RegisterExpressionParsers(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Parsers/Behaviours/BehaviourParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using UnityEngine; 7 | using ContractConfigurator.Behaviour; 8 | 9 | namespace ContractConfigurator.ExpressionParser 10 | { 11 | /// 12 | /// Generic parser subclass for behaviour factories. Placeholder for expressions that are common to behaviours. 13 | /// 14 | public class BehaviourParser : ClassExpressionParser where T : BehaviourFactory 15 | { 16 | public BehaviourParser() 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Parsers/Behaviours/SpawnKerbalParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using UnityEngine; 7 | using ContractConfigurator.Behaviour; 8 | 9 | namespace ContractConfigurator.ExpressionParser 10 | { 11 | /// 12 | /// Expression parser subclass for SpawnKerbal behaviour. 13 | /// 14 | public class SpawnKerbalParser : BehaviourParser, IExpressionParserRegistrer 15 | { 16 | static SpawnKerbalParser() 17 | { 18 | RegisterMethods(); 19 | } 20 | 21 | public void RegisterExpressionParsers() 22 | { 23 | RegisterParserType(typeof(SpawnKerbalFactory), typeof(SpawnKerbalParser)); 24 | } 25 | 26 | public static void RegisterMethods() 27 | { 28 | RegisterMethod(new Method>("Kerbals", 29 | skf => { 30 | if (skf.Current != null) 31 | { 32 | return skf.Current.Kerbals().ToList(); 33 | } 34 | else 35 | { 36 | CheckInitialized(skf); 37 | return new List(); 38 | } 39 | }, false)); 40 | } 41 | 42 | public SpawnKerbalParser() 43 | { 44 | } 45 | 46 | protected static void CheckInitialized(SpawnKerbalFactory skf) 47 | { 48 | foreach (DataNode dataNode in skf.dataNode.Children) 49 | { 50 | foreach (string identifier in new string[] { "name", "lat", "lon", "alt", "owned", "gender" }) 51 | { 52 | if (!dataNode.IsInitialized(identifier)) 53 | { 54 | throw new DataNode.ValueNotInitialized(dataNode.Path() + identifier); 55 | } 56 | } 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Parsers/Classes/AgentParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using UnityEngine; 7 | using Contracts.Agents; 8 | 9 | namespace ContractConfigurator.ExpressionParser 10 | { 11 | /// 12 | /// Expression parser subclass for Agent. 13 | /// 14 | public class AgentParser : ClassExpressionParser, IExpressionParserRegistrer 15 | { 16 | static AgentParser() 17 | { 18 | RegisterMethods(); 19 | } 20 | 21 | public void RegisterExpressionParsers() 22 | { 23 | RegisterParserType(typeof(Agent), typeof(AgentParser)); 24 | } 25 | 26 | public static void RegisterMethods() 27 | { 28 | RegisterGlobalFunction(new Function>("AllAgents", () => AgentList.Instance.Agencies, true)); 29 | RegisterGlobalFunction(new Function("Agent", k => k)); 30 | } 31 | 32 | public AgentParser() 33 | { 34 | } 35 | 36 | public override U ConvertType(Agent value) 37 | { 38 | if (typeof(U) == typeof(string)) 39 | { 40 | return (U)(object)(value == null ? "" : value.Title); 41 | } 42 | return base.ConvertType(value); 43 | } 44 | 45 | public override Agent ParseIdentifier(Token token) 46 | { 47 | // Try to parse more, as Agent names can have spaces 48 | Match m = Regex.Match(expression, @"^((?>\s*[\w\d-+/*!@#$%^&*()']+)+).*"); 49 | string identifier = m.Groups[1].Value; 50 | expression = (expression.Length > identifier.Length ? expression.Substring(identifier.Length) : ""); 51 | identifier = token.sval + identifier; 52 | 53 | if (identifier.Equals("null", StringComparison.CurrentCultureIgnoreCase)) 54 | { 55 | return null; 56 | } 57 | 58 | return AgentList.Instance.GetAgent(identifier); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Parsers/Classes/PrestigeParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using Contracts; 7 | 8 | namespace ContractConfigurator.ExpressionParser 9 | { 10 | /// 11 | /// Expression parser subclass for CelestialBody. 12 | /// 13 | public class PrestigeParser : EnumExpressionParser, IExpressionParserRegistrer 14 | { 15 | static PrestigeParser() 16 | { 17 | RegisterMethods(); 18 | } 19 | 20 | public void RegisterExpressionParsers() 21 | { 22 | RegisterParserType(typeof(Contract.ContractPrestige), typeof(PrestigeParser)); 23 | } 24 | 25 | public new static void RegisterMethods() 26 | { 27 | // Prestige methods 28 | RegisterMethod(new Method("Multiplier", p => GameVariables.Instance.GetContractPrestigeFactor(p))); 29 | 30 | // Prestige functions 31 | RegisterGlobalFunction(new Function("Prestige", () => 32 | ConfiguredContract.currentContract != null ? ConfiguredContract.currentContract.Prestige : Contract.ContractPrestige.Trivial, false)); 33 | RegisterGlobalFunction(new Function("ContractMultiplier", ContractMultiplier, false)); 34 | } 35 | 36 | public PrestigeParser() 37 | { 38 | } 39 | 40 | public static double ContractMultiplier() 41 | { 42 | DataNode rootNode = currentParser.currentDataNode.Root; 43 | ExpressionParser parser = BaseParser.GetParser(); 44 | return parser.ParseExpression(currentParser.currentKey, "Prestige().Multiplier() * @/targetBody.Multiplier()", currentParser.currentDataNode); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Parsers/Classes/Science/ExperimentSituationParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using UnityEngine; 7 | using ContractConfigurator.Util; 8 | 9 | namespace ContractConfigurator.ExpressionParser 10 | { 11 | /// 12 | /// Expression parser subclass for Experiment. 13 | /// 14 | public class ExperimentSituationParser : EnumExpressionParser, IExpressionParserRegistrer 15 | { 16 | public void RegisterExpressionParsers() 17 | { 18 | RegisterParserType(typeof(ExperimentSituations), typeof(ExperimentSituationParser)); 19 | } 20 | 21 | public ExperimentSituationParser() 22 | { 23 | } 24 | 25 | public override U ConvertType(ExperimentSituations value) 26 | { 27 | if (typeof(U) == typeof(string)) 28 | { 29 | return (U)(object)value.Print(); 30 | } 31 | return base.ConvertType(value); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Parsers/Classes/WaypointParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using UnityEngine; 7 | using FinePrint; 8 | 9 | namespace ContractConfigurator.ExpressionParser 10 | { 11 | /// 12 | /// Expression parser subclass for Waypoints. 13 | /// 14 | public class WaypointParser : ClassExpressionParser, IExpressionParserRegistrer 15 | { 16 | static WaypointParser() 17 | { 18 | RegisterMethods(); 19 | } 20 | 21 | public void RegisterExpressionParsers() 22 | { 23 | RegisterParserType(typeof(Waypoint), typeof(WaypointParser)); 24 | } 25 | 26 | public static void RegisterMethods() 27 | { 28 | RegisterMethod(new Method("Name", w => w == null ? "" : w.name)); 29 | RegisterMethod(new Method("Latitude", w => w == null ? 0.0 : w.latitude)); 30 | RegisterMethod(new Method("Longitude", w => w == null ? 0.0 : w.longitude)); 31 | RegisterMethod(new Method("Location", w => w == null ? null : 32 | new Location(FlightGlobals.Bodies.Where(b => b.name == w.celestialName).SingleOrDefault(), w.latitude, w.longitude))); 33 | RegisterMethod(new Method("Altitude", w => w == null ? 0.0 : w.altitude)); 34 | } 35 | 36 | public WaypointParser() 37 | { 38 | } 39 | 40 | public override U ConvertType(Waypoint value) 41 | { 42 | if (typeof(U) == typeof(string)) 43 | { 44 | return (U)(object)(value == null ? "" : value.name); 45 | } 46 | return base.ConvertType(value); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Parsers/SimpleTypes/ValueExpressionParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using UnityEngine; 7 | using KSP; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator.ExpressionParser 11 | { 12 | public class ValueExpressionParser : ExpressionParser where T : struct 13 | { 14 | public ValueExpressionParser() 15 | : base() 16 | { 17 | } 18 | } 19 | 20 | public class ComparableValueExpressionParser : ValueExpressionParser where T : struct, IComparable 21 | { 22 | public ComparableValueExpressionParser() 23 | : base() 24 | { 25 | } 26 | 27 | public override bool LT(T a, T b) 28 | { 29 | return a.CompareTo(b) < 0; 30 | } 31 | 32 | public override bool LE(T a, T b) 33 | { 34 | return a.CompareTo(b) <= 0; 35 | } 36 | 37 | public override bool EQ(T a, T b) 38 | { 39 | return a.CompareTo(b) == 0; 40 | } 41 | 42 | public override bool NE(T a, T b) 43 | { 44 | return a.CompareTo(b) != 0; 45 | } 46 | 47 | public override bool GE(T a, T b) 48 | { 49 | return a.CompareTo(b) >= 0; 50 | } 51 | 52 | public override bool GT(T a, T b) 53 | { 54 | return a.CompareTo(b) > 0; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Wrappers/Duration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ContractConfigurator 7 | { 8 | public class Duration 9 | { 10 | public double Value; 11 | 12 | public Duration(double value) 13 | { 14 | Value = value; 15 | } 16 | 17 | public Duration(string durationStr) 18 | { 19 | Value = DurationUtil.ParseDuration(durationStr); 20 | } 21 | 22 | public override string ToString() 23 | { 24 | return DurationUtil.StringValue(Value); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Wrappers/Location.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ContractConfigurator 7 | { 8 | public class Location 9 | { 10 | public CelestialBody body; 11 | public double lat; 12 | public double lon; 13 | 14 | public Location(CelestialBody body, double lat, double lon) 15 | { 16 | this.lat = lat; 17 | this.lon = lon; 18 | this.body = body; 19 | } 20 | 21 | public override string ToString() 22 | { 23 | return "Location[" + (body == null ? "null" : body.name) + ", " + lat + ", " + lon + "]"; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Wrappers/Resource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ContractConfigurator 7 | { 8 | public class Resource 9 | { 10 | public PartResourceDefinition res; 11 | 12 | public Resource(PartResourceDefinition res) 13 | { 14 | this.res = res; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return res != null ? res.name : ""; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ExpressionParser/Wrappers/VesselIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ContractConfigurator 7 | { 8 | public class VesselIdentifier 9 | { 10 | public string identifier; 11 | 12 | public VesselIdentifier(string identifier) 13 | { 14 | this.identifier = identifier; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return identifier; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Harmony/Kerbal.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | 3 | namespace ContractConfigurator.Harmony 4 | { 5 | [HarmonyPatch(typeof(global::Kerbal))] 6 | internal class PatchKerbal 7 | { 8 | [HarmonyPostfix] 9 | [HarmonyPatch("die")] 10 | internal static void Postfix_Die(global::Kerbal __instance) 11 | { 12 | if (__instance.InVessel == null) return; 13 | 14 | ContractConfigurator.OnVesselCrewDie.Fire(__instance.InVessel, __instance.protoCrewMember); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/ContractConfigurator/HarmonyPatcher.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace ContractConfigurator 4 | { 5 | [KSPAddon(KSPAddon.Startup.Instantly, true)] 6 | public class HarmonyPatcher : MonoBehaviour 7 | { 8 | internal void Start() 9 | { 10 | var harmony = new HarmonyLib.Harmony("ContractConfigurator.HarmonyPatcher"); 11 | harmony.PatchAll(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /source/ContractConfigurator/IContractConfiguratorFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ContractConfigurator.ExpressionParser; 6 | 7 | namespace ContractConfigurator 8 | { 9 | public interface IContractConfiguratorFactory 10 | { 11 | string ErrorPrefix(); 12 | string ErrorPrefix(ConfigNode configNode); 13 | 14 | Type iteratorType { get; set; } 15 | string iteratorKey { get; set; } 16 | string config { get; } 17 | string log { get; } 18 | DataNode dataNode { get; } 19 | bool hasWarnings { get; set; } 20 | Version minVersion { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/ContractConfigurator/IKerbalNameStorage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ContractConfigurator 7 | { 8 | /// 9 | /// Interface for objects that store Kerbal names. 10 | /// 11 | public interface IKerbalNameStorage 12 | { 13 | IEnumerable KerbalNames(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Parameter/AlwaysTrue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | 10 | namespace ContractConfigurator.Parameters 11 | { 12 | /// 13 | /// Special parameter wrapper which is always completed, and invisible. Use it to wrap other 14 | /// parameters that need to be hidden and not impact the contract. 15 | /// 16 | public class AlwaysTrue : ContractParameter 17 | { 18 | protected string title { get; set; } 19 | 20 | public AlwaysTrue() 21 | : base() 22 | { 23 | disableOnStateChange = false; 24 | } 25 | 26 | protected override string GetTitle() 27 | { 28 | return ""; 29 | } 30 | 31 | protected override void OnUpdate() 32 | { 33 | base.OnUpdate(); 34 | if (state != ParameterState.Complete && Root != null) 35 | { 36 | SetComplete(); 37 | } 38 | } 39 | 40 | protected override string GetHashString() 41 | { 42 | return (this.Root.MissionSeed.ToString() + this.Root.DateAccepted.ToString() + this.ID); 43 | } 44 | 45 | public static AlwaysTrue FetchOrAdd(Contract contract) 46 | { 47 | // Fetch the AlwaysTrue wrapper 48 | IEnumerable parameters = contract.AllParameters.Where(p => p.GetType() == typeof(AlwaysTrue)); 49 | if (parameters.Count() == 0) 50 | { 51 | AlwaysTrue alwaysTrue = new AlwaysTrue(); 52 | contract.AddParameter(alwaysTrue); 53 | return alwaysTrue; 54 | } 55 | else 56 | { 57 | return parameters.First() as AlwaysTrue; 58 | } 59 | } 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/AllFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory to provide logic for All. 14 | /// 15 | public class AllFactory : ParameterFactory 16 | { 17 | public override ContractParameter Generate(Contract contract) 18 | { 19 | return new Parameters.All(title); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/AnyFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for Any ContractParameter. 14 | /// 15 | public class AnyFactory : ParameterFactory 16 | { 17 | public override ContractParameter Generate(Contract contract) 18 | { 19 | return new Parameters.Any(title); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/AtLeastFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for AtLeast ContractParameter. 15 | /// 16 | public class AtLeastFactory : ParameterFactory 17 | { 18 | protected int count; 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | valid &= ConfigNodeUtil.ParseValue(configNode, "count", x => count = x, this); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractParameter Generate(Contract contract) 31 | { 32 | return new AtLeast(title, count); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/AtMostFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for AtMost ContractParameter. 15 | /// 16 | public class AtMostFactory : ParameterFactory 17 | { 18 | protected int count; 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | valid &= ConfigNodeUtil.ParseValue(configNode, "count", x => count = x, this); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractParameter Generate(Contract contract) 31 | { 32 | return new AtMost(title, count); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/HasAntennaFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for HasAntenna ContractParameter. 15 | /// 16 | public class HasAntennaFactory : ParameterFactory 17 | { 18 | protected double minAntennaPower; 19 | protected double maxAntennaPower; 20 | protected HasAntenna.AntennaType antennaType; 21 | protected float updateFrequency; 22 | 23 | public override bool Load(ConfigNode configNode) 24 | { 25 | // Load base class 26 | bool valid = base.Load(configNode); 27 | 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "minAntennaPower", x => minAntennaPower = x, this, 0.0f, x => Validation.GE(x, 0.0f)); 29 | valid &= ConfigNodeUtil.ParseValue(configNode, "maxAntennaPower", x => maxAntennaPower = x, this, double.MaxValue, x => Validation.GE(x, 0.0f)); 30 | valid &= ConfigNodeUtil.ParseValue(configNode, "antennaType", x => antennaType = x, this, HasAntenna.AntennaType.TRANSMIT); 31 | valid &= ConfigNodeUtil.AtLeastOne(configNode, new string[] { "minAntennaPower", "maxAntennaPower" }, this); 32 | valid &= ConfigNodeUtil.ParseValue(configNode, "updateFrequency", x => updateFrequency = x, this, HasAntenna.DEFAULT_UPDATE_FREQUENCY, x => Validation.GT(x, 0.0f)); 33 | 34 | return valid; 35 | } 36 | 37 | public override ContractParameter Generate(Contract contract) 38 | { 39 | return new HasAntenna(updateFrequency, minAntennaPower, maxAntennaPower, antennaType, title); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/HasAstronautFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for HasAstronaut ContractParameter. 15 | /// 16 | public class HasAstronautFactory : ParameterFactory 17 | { 18 | protected string trait; 19 | protected int minExperience; 20 | protected int maxExperience; 21 | protected int minCount; 22 | protected int maxCount; 23 | 24 | public override bool Load(ConfigNode configNode) 25 | { 26 | // Load base class 27 | bool valid = base.Load(configNode); 28 | 29 | valid &= ConfigNodeUtil.ParseValue(configNode, "trait", x => trait = x, this, (string)null); 30 | valid &= ConfigNodeUtil.ParseValue(configNode, "minExperience", x => minExperience = x, this, 0, x => Validation.Between(x, 0, 5)); 31 | valid &= ConfigNodeUtil.ParseValue(configNode, "maxExperience", x => maxExperience = x, this, 5, x => Validation.Between(x, 0, 5)); 32 | valid &= ConfigNodeUtil.ParseValue(configNode, "minCount", x => minCount = x, this, 1, x => Validation.GE(x, 0)); 33 | valid &= ConfigNodeUtil.ParseValue(configNode, "maxCount", x => maxCount = x, this, int.MaxValue, x => Validation.GE(x, minCount)); 34 | 35 | valid &= ConfigNodeUtil.AtLeastOne(configNode, new string[] { "trait", "minExperience", "maxExperience", "minCount", "maxCount" }, this); 36 | 37 | return valid; 38 | } 39 | 40 | public override ContractParameter Generate(Contract contract) 41 | { 42 | return new HasAstronaut(title, trait, minCount, maxCount, minExperience, maxExperience); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/HasCrewCapacityFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for HasCrewCapacity ContractParameter. 15 | /// 16 | public class HasCrewCapacityFactory : ParameterFactory 17 | { 18 | protected int minCapacity; 19 | protected int maxCapacity; 20 | protected PartResourceDefinition resource; 21 | 22 | public override bool Load(ConfigNode configNode) 23 | { 24 | // Load base class 25 | bool valid = base.Load(configNode); 26 | 27 | valid &= ConfigNodeUtil.ParseValue(configNode, "minCapacity", x => minCapacity = x, this, 1, x => Validation.GE(x, 0)); 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "maxCapacity", x => maxCapacity = x, this, int.MaxValue, x => Validation.GE(x, 0)); 29 | 30 | return valid; 31 | } 32 | 33 | public override ContractParameter Generate(Contract contract) 34 | { 35 | return new HasCrewCapacity(minCapacity, maxCapacity, title); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/HasPassengersFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for HasPassengers ContractParameter. 15 | /// 16 | public class HasPassengersFactory : ParameterFactory 17 | { 18 | protected int index; 19 | protected int count; 20 | protected List passengers; 21 | 22 | public override bool Load(ConfigNode configNode) 23 | { 24 | // Load base class 25 | bool valid = base.Load(configNode); 26 | 27 | valid &= ConfigNodeUtil.ParseValue(configNode, "index", x => index = x, this, 0, x => Validation.GE(x, 0)); 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "count", x => count = x, this, 0, x => Validation.GE(x, 0)); 29 | valid &= ConfigNodeUtil.ParseValue>(configNode, "kerbal", x => passengers = x, this, new List()); 30 | 31 | return valid; 32 | } 33 | 34 | public override ContractParameter Generate(Contract contract) 35 | { 36 | if (passengers.Count() > 0) 37 | { 38 | return new HasPassengers(title, passengers); 39 | } 40 | else 41 | { 42 | return new HasPassengers(title, index, count); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/InvalidParameterFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// Special placeholder for factories that failed to load. 14 | /// 15 | public class InvalidParameterFactory : ParameterFactory 16 | { 17 | public override bool Load(ConfigNode configNode) 18 | { 19 | base.Load(configNode); 20 | return false; 21 | } 22 | 23 | public override ContractParameter Generate(Contract contract) 24 | { 25 | throw new InvalidOperationException("Cannot generate invalid parameter."); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/IsNotVesselFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for IsNotVesselFactory ContractParameter. 15 | /// 16 | public class IsNotVesselFactory : ParameterFactory 17 | { 18 | protected List vessels = new List(); 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | bool foundOne = false; 26 | foreach (ConfigNode.Value v in configNode.values) 27 | { 28 | if (v.name != "vessel") 29 | continue; 30 | 31 | foundOne = true; 32 | vessels.Add(new VesselIdentifier(v.value)); 33 | } 34 | 35 | valid &= foundOne; 36 | 37 | return valid; 38 | } 39 | 40 | public override ContractParameter Generate(Contract contract) 41 | { 42 | List vStrings = new List(); 43 | foreach (var v in vessels) 44 | vStrings.Add(v.identifier); 45 | return new IsNotVessel(vStrings, title); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/KerbalDeathsFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for KerbalDeaths ContractParameter. 14 | /// 15 | public class KerbalDeathsFactory : ParameterFactory 16 | { 17 | protected int countMax; 18 | protected List kerbal; 19 | protected VesselIdentifier vessel; 20 | 21 | public override bool Load(ConfigNode configNode) 22 | { 23 | // Load base class 24 | bool valid = base.Load(configNode); 25 | 26 | valid &= ConfigNodeUtil.ParseValue(configNode, "countMax", x => countMax = x, this, 1, x => Validation.GT(x, 0)); 27 | valid &= ConfigNodeUtil.ParseValue>(configNode, "kerbal", x => kerbal = x, this, new List()); 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "vessel", x => vessel = x, this, (VesselIdentifier)null); 29 | 30 | return valid; 31 | } 32 | 33 | public override ContractParameter Generate(Contract contract) 34 | { 35 | return new KerbalDeathsCustom(countMax, kerbal, vessel, title); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/MissionTimerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for MissionTimer ContractParameter. 14 | /// 15 | public class MissionTimerFactory : ParameterFactory 16 | { 17 | protected MissionTimer.StartCriteria startCriteria; 18 | protected MissionTimer.EndCriteria endCriteria; 19 | protected string startParameter; 20 | protected string endParameter; 21 | 22 | public override bool Load(ConfigNode configNode) 23 | { 24 | // Load base class 25 | bool valid = base.Load(configNode); 26 | 27 | // Get criteria 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "startCriteria", x => startCriteria = x, this, MissionTimer.StartCriteria.CONTRACT_ACCEPTANCE); 29 | if (startCriteria == MissionTimer.StartCriteria.PARAMETER_COMPLETION) 30 | { 31 | valid &= ConfigNodeUtil.ParseValue(configNode, "startParameter", x => startParameter = x, this); 32 | } 33 | valid &= ConfigNodeUtil.ParseValue(configNode, "endCriteria", x => endCriteria = x, this, MissionTimer.EndCriteria.CONTRACT_COMPLETION); 34 | if (endCriteria == MissionTimer.EndCriteria.PARAMETER_COMPLETION) 35 | { 36 | valid &= ConfigNodeUtil.ParseValue(configNode, "endParameter", x => endParameter = x, this); 37 | } 38 | 39 | return valid; 40 | } 41 | 42 | public override ContractParameter Generate(Contract contract) 43 | { 44 | return new MissionTimer(startCriteria, endCriteria, startParameter, endParameter, title); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/NewVesselFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for the NewVessel ContractParameter. 14 | /// 15 | public class NewVesselFactory : ParameterFactory 16 | { 17 | public override ContractParameter Generate(Contract contract) 18 | { 19 | return new NewVessel(title); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/NoStagingFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for NoStaging ContractParameter. 14 | /// 15 | public class NoStagingFactory : ParameterFactory 16 | { 17 | protected bool failContract; 18 | 19 | public override bool Load(ConfigNode configNode) 20 | { 21 | // Load base class 22 | bool valid = base.Load(configNode); 23 | 24 | valid &= ConfigNodeUtil.ParseValue(configNode, "failContract", x => failContract = x, this, true); 25 | 26 | return valid; 27 | } 28 | 29 | public override ContractParameter Generate(Contract contract) 30 | { 31 | return new NoStaging(failContract, title); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/NoneFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for None ContractParameter. 15 | /// 16 | public class NoneFactory : ParameterFactory 17 | { 18 | public override ContractParameter Generate(Contract contract) 19 | { 20 | return new None(title); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/NotFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for Not ContractParameter. 15 | /// 16 | public class NotFactory : ParameterFactory 17 | { 18 | public override ContractParameter Generate(Contract contract) 19 | { 20 | return new Not(title); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/PartTestFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Behaviour; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for PartTest ContractParameter. 15 | /// 16 | public class PartTestFactory : ParameterFactory 17 | { 18 | protected AvailablePart part; 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | valid &= ConfigNodeUtil.ParseValue(configNode, "part", x => part = x, this); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractParameter Generate(Contract contract) 31 | { 32 | ConfiguredContract cc = contract as ConfiguredContract; 33 | if (!cc.Behaviours.Any(cb => cb is PartTestHandler)) 34 | { 35 | cc.AddBehaviour(new PartTestHandler()); 36 | } 37 | 38 | System.Random random = new System.Random(); 39 | return new PartTest(part, notes, PartTestConstraint.TestRepeatability.ONCEPERPART, targetBody, Vessel.Situations.LANDED, random.NextDouble().ToString(), false); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/PerformOrbitalSurveyFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for PerformOrbitalSurvey ContractParameter. 15 | /// 16 | public class PerformOrbitalSurveyFactory : ParameterFactory 17 | { 18 | public override bool Load(ConfigNode configNode) 19 | { 20 | // Load base class 21 | bool valid = base.Load(configNode); 22 | 23 | // Validate target body 24 | valid &= ValidateTargetBody(configNode); 25 | 26 | return valid; 27 | } 28 | 29 | public override ContractParameter Generate(Contract contract) 30 | { 31 | // Perform another validation of the target body to catch late validation issues due to expressions 32 | if (!ValidateTargetBody()) 33 | { 34 | return null; 35 | } 36 | 37 | return new PerformOrbitalSurvey(title, targetBody); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/PlantFlagFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for PlantFlag ContractParameter. 14 | /// 15 | public class PlantFlagFactory : ParameterFactory 16 | { 17 | public override bool Load(ConfigNode configNode) 18 | { 19 | // Load base class 20 | bool valid = base.Load(configNode); 21 | 22 | valid &= ValidateTargetBody(configNode); 23 | 24 | return valid; 25 | } 26 | 27 | public override ContractParameter Generate(Contract contract) 28 | { 29 | // Perform another validation of the target body to catch late validation issues due to expressions 30 | if (!ValidateTargetBody()) 31 | { 32 | return null; 33 | } 34 | 35 | return new PlantFlagCustom(targetBody, title); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/ReachSpaceFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for ReachSpace ContractParameter. 14 | /// 15 | [Obsolete("ReachSpace is obsolete since Contract Configurator 1.7.7, use ReachState instead.")] 16 | public class ReachSpaceFactory : ParameterFactory 17 | { 18 | public override ContractParameter Generate(Contract contract) 19 | { 20 | LoggingUtil.LogWarning(this, "ReachSpace is obsolete since Contract Configurator 1.7.7, use ReachState instead."); 21 | return new ReachSpaceCustom(title); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/RecoverKerbalFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | using ContractConfigurator.Behaviour; 11 | 12 | namespace ContractConfigurator 13 | { 14 | /// 15 | /// ParameterFactory wrapper for RecoverKerbal ContractParameter. 16 | /// 17 | public class RecoverKerbalFactory : ParameterFactory 18 | { 19 | protected List kerbals; 20 | protected int index; 21 | protected int count; 22 | 23 | public override bool Load(ConfigNode configNode) 24 | { 25 | // Load base class 26 | bool valid = base.Load(configNode); 27 | 28 | valid &= ConfigNodeUtil.ParseValue>(configNode, "kerbal", x => kerbals = x, this, new List()); 29 | valid &= ConfigNodeUtil.ParseValue(configNode, "index", x => index = x, this, 0, x => Validation.GE(x, 0)); 30 | valid &= ConfigNodeUtil.ParseValue(configNode, "count", x => count = x, this, 0, x => Validation.GE(x, 0)); 31 | 32 | return valid; 33 | } 34 | 35 | public override ContractParameter Generate(Contract contract) 36 | { 37 | return new RecoverKerbalCustom(kerbals, index, count, title); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/RecoverVesselFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | using ContractConfigurator.Behaviour; 11 | 12 | namespace ContractConfigurator 13 | { 14 | /// 15 | /// ParameterFactory wrapper for RecoverVessel ContractParameter. 16 | /// 17 | public class RecoverVesselFactory : ParameterFactory 18 | { 19 | public override ContractParameter Generate(Contract contract) 20 | { 21 | return new RecoverVessel(title); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/ResourceConsumptionFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for HasResource ContractParameter. 15 | /// 16 | public class ResourceConsumptionFactory : ParameterFactory 17 | { 18 | protected double minRate; 19 | protected double maxRate; 20 | protected PartResourceDefinition resource; 21 | protected float updateFrequency; 22 | 23 | public override bool Load(ConfigNode configNode) 24 | { 25 | // Load base class 26 | bool valid = base.Load(configNode); 27 | 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "minRate", x => minRate = x, this, double.MinValue); 29 | valid &= ConfigNodeUtil.ParseValue(configNode, "maxRate", x => maxRate = x, this, double.MaxValue); 30 | valid &= ConfigNodeUtil.ParseValue(configNode, "resource", x => resource = x, this); 31 | valid &= ConfigNodeUtil.ParseValue(configNode, "updateFrequency", x => updateFrequency = x, this, ResourceConsumption.DEFAULT_UPDATE_FREQUENCY, x => Validation.GT(x, 0.0f)); 32 | 33 | return valid; 34 | } 35 | 36 | public override ContractParameter Generate(Contract contract) 37 | { 38 | return new ResourceConsumption(minRate, maxRate, resource, updateFrequency, title); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/ReturnHomeFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for ReturnHome ContractParameter. 14 | /// 15 | public class ReturnHomeFactory : ParameterFactory 16 | { 17 | public override ContractParameter Generate(Contract contract) 18 | { 19 | return new ReturnHome(title); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/SCANsatCoverageFactory.cs: -------------------------------------------------------------------------------- 1 | using ContractConfigurator.Parameters; 2 | using Contracts; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using ContractConfigurator; 8 | using UnityEngine; 9 | 10 | namespace ContractConfigurator 11 | { 12 | public class SCANsatCoverageFactory : ParameterFactory 13 | { 14 | protected string scanType; 15 | protected double coverage; 16 | 17 | public override bool Load(ConfigNode configNode) 18 | { 19 | // Before loading, verify the SCANsat version 20 | if (!SCANsatUtil.VerifySCANsatVersion()) 21 | { 22 | return false; 23 | } 24 | 25 | // Load base class 26 | bool valid = base.Load(configNode); 27 | 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "coverage", x => coverage = x, this); 29 | valid &= ConfigNodeUtil.ParseValue(configNode, "scanType", x => scanType = x, this, SCANsatUtil.ValidateSCANname); 30 | valid &= ValidateTargetBody(configNode); 31 | 32 | return valid; 33 | } 34 | 35 | public override ContractParameter Generate(Contract contract) 36 | { 37 | // Perform another validation of the target body to catch late validation issues due to expressions 38 | if (!ValidateTargetBody()) 39 | { 40 | return null; 41 | } 42 | 43 | return new SCANsatCoverage(coverage, scanType, targetBody, title); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/SequenceFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory to provide logic for Sequence. 14 | /// 15 | public class SequenceFactory : ParameterFactory 16 | { 17 | protected List hiddenParameters; 18 | protected bool failWhenCompleteOutOfOrder; 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | valid &= ConfigNodeUtil.ParseValue>(configNode, "hiddenParameter", x => hiddenParameters = x, this, new List()); 26 | valid &= ConfigNodeUtil.ParseValue(configNode, "failWhenCompleteOutOfOrder", x => failWhenCompleteOutOfOrder = x, this, false); 27 | 28 | return valid; 29 | } 30 | 31 | public override ContractParameter Generate(Contract contract) 32 | { 33 | return new Parameters.Sequence(hiddenParameters, failWhenCompleteOutOfOrder, title); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/TargetDestroyedFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for TargetDestroyed ContractParameter. 15 | /// 16 | public class TargetDestroyedFactory : ParameterFactory 17 | { 18 | protected List vessels; 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | valid &= ConfigNodeUtil.ParseValue>(configNode, "vessel", x => vessels = x, this); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractParameter Generate(Contract contract) 31 | { 32 | return new TargetDestroyed(vessels.Select(vi => vi.identifier), title); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/TimerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ParameterFactory wrapper for Timer ContractParameter. 14 | /// 15 | public class TimerFactory : ParameterFactory 16 | { 17 | protected Duration duration; 18 | protected Timer.TimerType timerType; 19 | protected string parameter; 20 | protected bool failContract; 21 | 22 | public override bool Load(ConfigNode configNode) 23 | { 24 | // Load base class 25 | bool valid = base.Load(configNode); 26 | 27 | // Get duration 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "duration", x => duration = x, this, new Duration(0.0)); 29 | valid &= ConfigNodeUtil.ParseValue(configNode, "timerType", x => timerType = x, this, Timer.TimerType.CONTRACT_ACCEPTANCE); 30 | if (timerType == Timer.TimerType.PARAMETER_COMPLETION) 31 | { 32 | valid &= ConfigNodeUtil.ParseValue(configNode, "parameter", x => parameter = x, this); 33 | } 34 | valid &= ConfigNodeUtil.ParseValue(configNode, "failContract", x => failContract = x, this, true); 35 | 36 | return valid; 37 | } 38 | 39 | public override ContractParameter Generate(Contract contract) 40 | { 41 | return new Timer(duration.Value, timerType, parameter, failContract); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/VesselDestroyedFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for VesselDestroyed ContractParameter. 15 | /// 16 | public class VesselDestroyedFactory : ParameterFactory 17 | { 18 | protected bool mustImpactTerrain = false; 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | valid &= ConfigNodeUtil.ParseValue(configNode, "mustImpactTerrain", x => mustImpactTerrain = x, this, false, x => true); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractParameter Generate(Contract contract) 31 | { 32 | return new VesselDestroyed(title, mustImpactTerrain); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/VesselIsTypeFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for VesselIsType ContractParameter. 15 | /// 16 | public class VesselIsTypeFactory : ParameterFactory 17 | { 18 | protected VesselType vesselType; 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | valid &= ConfigNodeUtil.ParseValue(configNode, "vesselType", x => vesselType = x, this); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractParameter Generate(Contract contract) 31 | { 32 | return new VesselIsType(vesselType, title); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/VesselMassFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for VesselMass ContractParameter. 15 | /// 16 | public class VesselMassFactory : ParameterFactory 17 | { 18 | protected float minMass; 19 | protected float maxMass; 20 | protected float updateFrequency; 21 | 22 | public override bool Load(ConfigNode configNode) 23 | { 24 | // Load base class 25 | bool valid = base.Load(configNode); 26 | 27 | valid &= ConfigNodeUtil.ParseValue(configNode, "minMass", x => minMass = x, this, 0.0f, x => Validation.GE(x, 0.0f)); 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "maxMass", x => maxMass = x, this, float.MaxValue, x => Validation.GE(x, 0.0f)); 29 | valid &= ConfigNodeUtil.AtLeastOne(configNode, new string[] { "minMass", "maxMass" }, this); 30 | valid &= ConfigNodeUtil.ParseValue(configNode, "updateFrequency", x => updateFrequency = x, this, VesselMass.DEFAULT_UPDATE_FREQUENCY, x => Validation.GT(x, 0.0f)); 31 | 32 | return valid; 33 | } 34 | 35 | public override ContractParameter Generate(Contract contract) 36 | { 37 | return new VesselMass(updateFrequency, minMass, maxMass, title); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source/ContractConfigurator/ParameterFactory/VesselNotDestroyedFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using Contracts; 8 | using Contracts.Parameters; 9 | using ContractConfigurator.Parameters; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ParameterFactory wrapper for VesselNotDestroyed ContractParameter. 15 | /// 16 | public class VesselNotDestroyedFactory : ParameterFactory 17 | { 18 | protected List vessels; 19 | 20 | public override bool Load(ConfigNode configNode) 21 | { 22 | // Load base class 23 | bool valid = base.Load(configNode); 24 | 25 | valid &= ConfigNodeUtil.ParseValue>(configNode, "vessel", x => vessels = x, this, new List()); 26 | 27 | return valid; 28 | } 29 | 30 | public override ContractParameter Generate(Contract contract) 31 | { 32 | return new VesselNotDestroyed(vessels.Select(vi => vi.identifier), title); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #define CIBUILD_disabled 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("ContractConfigurator")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("ContractConfigurator")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | // The following GUID is for the ID of the typelib if this project is exposed to COM 25 | [assembly: Guid("57954ae8-d4af-4576-b994-8d13ae0eae3c")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | [assembly: AssemblyVersion("1.0")] 38 | #if CIBUILD 39 | [assembly: AssemblyFileVersion("@MAJOR@.@MINOR@.@PATCH@.@BUILD@")] 40 | [assembly: AssemblyInformationalVersion("@MAJOR@.@MINOR@.@PATCH@.@BUILD@ KSP-RO")] 41 | [assembly: KSPAssembly("ContractConfigurator", @MAJOR@, @MINOR@)] 42 | #else 43 | [assembly: AssemblyFileVersion("2.99.0")] 44 | [assembly: AssemblyInformationalVersion("2.99.0 KSP-RO")] 45 | [assembly: KSPAssembly("ContractConfigurator", 2, 99)] 46 | #endif 47 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/All.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using ContractConfigurator.Util; 9 | using KSP.Localization; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ContractRequirement set requirement. Requirement is met if all child requirements are met. 15 | /// 16 | public class AllRequirement : ContractRequirement 17 | { 18 | public override bool LoadFromConfig(ConfigNode configNode) 19 | { 20 | // Load base class 21 | bool valid = base.LoadFromConfig(configNode); 22 | 23 | return valid; 24 | } 25 | 26 | public override bool RequirementMet(ConfiguredContract contract) 27 | { 28 | bool requirementMet = true; 29 | foreach (ContractRequirement requirement in childNodes) 30 | { 31 | if (requirement.enabled) 32 | { 33 | requirementMet &= requirement.CheckRequirement(contract); 34 | } 35 | } 36 | return requirementMet; 37 | } 38 | 39 | public override void OnLoad(ConfigNode configNode) { } 40 | public override void OnSave(ConfigNode configNode) { } 41 | 42 | protected override string RequirementText() 43 | { 44 | return Localizer.Format(invertRequirement ? "#cc.req.All.x" : "#cc.req.All", MissionControlUI.RequirementHighlightColor); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/AltitudeRecordRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having reached a minimum altitude. 14 | /// 15 | public class AltitudeRecordRequirement : ContractRequirement 16 | { 17 | protected double minAltitude; 18 | 19 | public override bool LoadFromConfig(ConfigNode configNode) 20 | { 21 | // Load base class 22 | bool valid = base.LoadFromConfig(configNode); 23 | 24 | valid &= ConfigNodeUtil.ParseValue(configNode, "minAltitude", x => minAltitude = x, this, x => Validation.GT(x, 0.0)); 25 | 26 | return valid; 27 | } 28 | 29 | public override void OnSave(ConfigNode configNode) 30 | { 31 | 32 | configNode.AddValue("minAltitude", minAltitude); 33 | } 34 | 35 | public override void OnLoad(ConfigNode configNode) 36 | { 37 | minAltitude = ConfigNodeUtil.ParseValue(configNode, "minAltitude"); 38 | } 39 | 40 | public override bool RequirementMet(ConfiguredContract contract) 41 | { 42 | return ProgressTracking.Instance.altitudeRecords.record >= minAltitude; 43 | } 44 | 45 | protected override string RequirementText() 46 | { 47 | string output = Localizer.Format(invertRequirement ? "#cc.req.AltitudeRecord.x" : "#cc.req.AltitudeRecord", minAltitude.ToString("N0")); 48 | 49 | if (ProgressTracking.Instance.altitudeRecords.record < minAltitude) 50 | { 51 | output = Localizer.Format("#cc.req.AltitudeRecord.additional", output, ProgressTracking.Instance.altitudeRecords.record.ToString("N0")); 52 | } 53 | 54 | return output; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/Any.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using ContractConfigurator.Util; 9 | using KSP.Localization; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ContractRequirement set requirement. Requirement is met if any child requirement is met. 15 | /// 16 | public class AnyRequirement : ContractRequirement 17 | { 18 | public override bool LoadFromConfig(ConfigNode configNode) 19 | { 20 | // Load base class 21 | bool valid = base.LoadFromConfig(configNode); 22 | 23 | return valid; 24 | } 25 | 26 | public override bool RequirementMet(ConfiguredContract contract) 27 | { 28 | bool requirementMet = false; 29 | foreach (ContractRequirement requirement in childNodes) 30 | { 31 | if (requirement.enabled) 32 | { 33 | requirementMet |= requirement.CheckRequirement(contract); 34 | } 35 | } 36 | return requirementMet; 37 | } 38 | 39 | public override void OnLoad(ConfigNode configNode) { } 40 | public override void OnSave(ConfigNode configNode) { } 41 | 42 | protected override string RequirementText() 43 | { 44 | return Localizer.Format(invertRequirement ? "#cc.req.Any.x" : "#cc.req.Any", MissionControlUI.RequirementHighlightColor); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ExpansionRequirement.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using UnityEngine; 6 | using KSP; 7 | using Expansions; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for having certain expansion installed. 14 | /// 15 | public class ExpansionRequirement : ContractRequirement 16 | { 17 | protected enum Expansion 18 | { 19 | [Description("#cc.expansion.MakingHistory")] MakingHistory, 20 | [Description("#cc.expansion.Serenity")] Serenity 21 | } 22 | protected Expansion expansion; 23 | 24 | public override bool LoadFromConfig(ConfigNode configNode) 25 | { 26 | // Load base class 27 | bool valid = base.LoadFromConfig(configNode); 28 | 29 | valid &= ConfigNodeUtil.ParseValue(configNode, "expansion", x => expansion = x, this); 30 | 31 | // Not invertable 32 | valid &= ConfigNodeUtil.ParseValue(configNode, "invertRequirement", x => invertRequirement = x, this, false, x => Validation.EQ(x, false)); 33 | 34 | return valid; 35 | } 36 | 37 | public override void OnSave(ConfigNode configNode) 38 | { 39 | configNode.AddValue("expansion", expansion); 40 | } 41 | 42 | public override void OnLoad(ConfigNode configNode) 43 | { 44 | expansion = ConfigNodeUtil.ParseValue(configNode, "expansion"); 45 | } 46 | 47 | public override bool RequirementMet(ConfiguredContract contract) 48 | { 49 | return ExpansionsLoader.IsExpansionInstalled(expansion.ToString()); 50 | } 51 | 52 | protected override string RequirementText() 53 | { 54 | return Localizer.Format("#cc.req.Expansion", expansion.displayDescription()); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ExpressionRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using Contracts; 9 | using ContractConfigurator.ExpressionParser; 10 | 11 | namespace ContractConfigurator 12 | { 13 | /// 14 | /// ContractRequirement that executes an expression. 15 | /// 16 | public class ExpressionRequirement : ContractRequirement 17 | { 18 | protected bool expression; 19 | 20 | public ExpressionRequirement() 21 | { 22 | needsTitle = true; 23 | } 24 | 25 | public override bool LoadFromConfig(ConfigNode configNode) 26 | { 27 | // Load base class 28 | bool valid = base.LoadFromConfig(configNode); 29 | 30 | // Get expression 31 | valid &= ConfigNodeUtil.ParseValue(configNode, "expression", x => expression = x, this); 32 | 33 | return valid; 34 | } 35 | 36 | public override void OnSave(ConfigNode configNode) 37 | { 38 | configNode.AddValue("expression", expression); 39 | } 40 | 41 | public override void OnLoad(ConfigNode configNode) 42 | { 43 | expression = ConfigNodeUtil.ParseValue(configNode, "expression"); 44 | } 45 | 46 | public override bool RequirementMet(ConfiguredContract contract) 47 | { 48 | return expression; 49 | } 50 | 51 | protected override string RequirementText() 52 | { 53 | return "unknown"; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/FirstCrewToSurviveRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having had a crew recovered. 14 | /// 15 | public class FirstCrewToSurviveRequirement : ContractRequirement 16 | { 17 | public override bool RequirementMet(ConfiguredContract contract) 18 | { 19 | return ProgressTracking.Instance.firstCrewToSurvive.IsComplete; 20 | } 21 | 22 | public override void OnLoad(ConfigNode configNode) { } 23 | public override void OnSave(ConfigNode configNode) { } 24 | 25 | protected override string RequirementText() 26 | { 27 | return Localizer.GetStringByTag(invertRequirement ? "#cc.req.FirstCrewToSurvive.x" : "#cc.req.FirstCrewToSurvive"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/FirstLaunchRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player made their first launch. 14 | /// 15 | public class FirstLaunchRequirement : ContractRequirement 16 | { 17 | public override bool RequirementMet(ConfiguredContract contract) 18 | { 19 | return ProgressTracking.Instance.firstLaunch.IsComplete; 20 | } 21 | 22 | public override void OnLoad(ConfigNode configNode) { } 23 | public override void OnSave(ConfigNode configNode) { } 24 | 25 | protected override string RequirementText() 26 | { 27 | return Localizer.GetStringByTag(invertRequirement ? "#cc.req.FirstLaunch.x" : "#cc.req.FirstLaunch"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/InvalidContractRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | 9 | namespace ContractConfigurator 10 | { 11 | /// 12 | /// Special placeholder for requirements that failed to load. 13 | /// 14 | public class InvalidContractRequirement : ContractRequirement 15 | { 16 | public override bool LoadFromConfig(ConfigNode configNode) 17 | { 18 | base.LoadFromConfig(configNode); 19 | return false; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | throw new InvalidOperationException("Cannot check invalid requirement."); 25 | } 26 | 27 | public override void OnLoad(ConfigNode configNode) { } 28 | public override void OnSave(ConfigNode configNode) { } 29 | 30 | protected override string RequirementText() 31 | { 32 | return ""; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/KSCLandingRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having made their first launch. 14 | /// 15 | public class KSCLandingRequirement : ContractRequirement 16 | { 17 | public override bool RequirementMet(ConfiguredContract contract) 18 | { 19 | return ProgressTracking.Instance.KSCLanding.IsComplete; 20 | } 21 | 22 | public override void OnLoad(ConfigNode configNode) { } 23 | public override void OnSave(ConfigNode configNode) { } 24 | 25 | protected override string RequirementText() 26 | { 27 | return Localizer.GetStringByTag(invertRequirement ? "#cc.req.KSCLanding.x" : "#cc.req.KSCLanding"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/PerformOrbitalSurveyRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement for performing an orbital survey of a celestial body. 14 | /// 15 | public class PerformOrbitalSurveyRequirement : ContractRequirement 16 | { 17 | public override bool LoadFromConfig(ConfigNode configNode) 18 | { 19 | // Load base class 20 | bool valid = base.LoadFromConfig(configNode); 21 | 22 | valid &= ValidateTargetBody(configNode); 23 | 24 | return valid; 25 | } 26 | 27 | public override bool RequirementMet(ConfiguredContract contract) 28 | { 29 | // Perform another validation of the target body to catch late validation issues due to expressions 30 | if (!ValidateTargetBody()) 31 | { 32 | return false; 33 | } 34 | 35 | if (ResourceScenario.Instance == null) 36 | { 37 | return false; 38 | } 39 | 40 | return ResourceScenario.Instance.gameSettings.GetPlanetScanInfo().Where(psd => psd.PlanetId == targetBody.flightGlobalsIndex).Any(); 41 | } 42 | 43 | public override void OnLoad(ConfigNode configNode) { } 44 | public override void OnSave(ConfigNode configNode) { } 45 | 46 | protected override string RequirementText() 47 | { 48 | string body = targetBody == null ? Localizer.GetStringByTag("#cc.req.ProgressCelestialBody.genericBody") : targetBody.displayName; 49 | return Localizer.Format(invertRequirement ? "#cc.req.PerformOrbitalSurvey.x" : "#cc.req.PerformOrbitalSurvey", body); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/BaseConstructionRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having built a base on a specific CelestialBody. 14 | /// 15 | public class BaseConstructionRequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.baseConstruction; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/DockingRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having performed docking near a specific CelestialBody. 14 | /// 15 | public class DockingRequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.docking; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/EscapeRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having escaped from a specific CelestialBody. 14 | /// 15 | public class EscapeRequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.escape; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/FlyByRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having performed done a fly by of a specific CelestialBody. 14 | /// 15 | public class FlyByRequirement : ProgressCelestialBodyRequirement 16 | { 17 | public override bool LoadFromConfig(ConfigNode configNode) 18 | { 19 | // Disallow Kerbin 20 | allowKerbin = false; 21 | return base.LoadFromConfig(configNode); 22 | } 23 | 24 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 25 | { 26 | return celestialBodySubtree.flyBy; 27 | } 28 | 29 | public override bool RequirementMet(ConfiguredContract contract) 30 | { 31 | return base.RequirementMet(contract) && 32 | GetCelestialBodySubtree().IsComplete; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/LandingRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having landed on a specific CelestialBody. 14 | /// 15 | public class LandingRequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.landing; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/OrbitRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having orbited a specific CelestialBody. 14 | /// 15 | public class OrbitRequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.orbit; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/RendezvousRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having rendezvoued with a specific CelestialBody. 14 | /// 15 | public class RendezvousRequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.rendezvous; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/ReturnFromFlyByRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having performed returned from a flyby of a specific CelestialBody. 14 | /// 15 | public class ReturnFromFlyByRequirement : ProgressCelestialBodyRequirement 16 | { 17 | public override bool LoadFromConfig(ConfigNode configNode) 18 | { 19 | // Disallow Kerbin 20 | allowKerbin = false; 21 | return base.LoadFromConfig(configNode); 22 | } 23 | 24 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 25 | { 26 | return celestialBodySubtree.returnFromFlyby; 27 | } 28 | 29 | public override bool RequirementMet(ConfiguredContract contract) 30 | { 31 | return base.RequirementMet(contract) && 32 | GetCelestialBodySubtree().IsComplete; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/ReturnFromOrbitRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having performed returned from an orbit of a specific CelestialBody. 14 | /// 15 | public class ReturnFromOrbitRequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.returnFromOrbit; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/ReturnFromSurfaceRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having performed returned from the 14 | /// surface of a specific CelestialBody. 15 | /// 16 | public class ReturnFromSurfaceRequirement : ProgressCelestialBodyRequirement 17 | { 18 | public override bool LoadFromConfig(ConfigNode configNode) 19 | { 20 | // Disallow Kerbin 21 | allowKerbin = false; 22 | return base.LoadFromConfig(configNode); 23 | } 24 | 25 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 26 | { 27 | return celestialBodySubtree.returnFromSurface; 28 | } 29 | 30 | public override bool RequirementMet(ConfiguredContract contract) 31 | { 32 | // This appears bugged - returnFromSurface is null 33 | return base.RequirementMet(contract) && 34 | GetCelestialBodySubtree().IsComplete; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/SplashDownRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having splashed down on a specific CelestialBody. 14 | /// 15 | public class SplashDownRequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.splashdown; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ProgressCelestialBodyRequirement/SurfaceEVARequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having performed a surface EVA on a specific CelestialBody. 14 | /// 15 | public class SurfaceEVARequirement : ProgressCelestialBodyRequirement 16 | { 17 | protected override ProgressNode GetTypeSpecificProgressNode(CelestialBodySubtree celestialBodySubtree) 18 | { 19 | return celestialBodySubtree.surfaceEVA; 20 | } 21 | 22 | public override bool RequirementMet(ConfiguredContract contract) 23 | { 24 | return base.RequirementMet(contract) && 25 | GetCelestialBodySubtree().IsComplete; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ReachSpaceRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having reached space. 14 | /// 15 | public class ReachSpaceRequirement : ContractRequirement 16 | { 17 | public override bool RequirementMet(ConfiguredContract contract) 18 | { 19 | return ProgressTracking.Instance.reachSpace.IsComplete; 20 | } 21 | 22 | public override void OnLoad(ConfigNode configNode) { } 23 | public override void OnSave(ConfigNode configNode) { } 24 | 25 | protected override string RequirementText() 26 | { 27 | return Localizer.GetStringByTag(invertRequirement ? "#cc.req.ReachSpace.x" : "#cc.req.ReachSpace"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/RunwayLandingRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having landed on the runway. 14 | /// 15 | public class RunwayLandingRequirement : ContractRequirement 16 | { 17 | public override bool RequirementMet(ConfiguredContract contract) 18 | { 19 | return ProgressTracking.Instance.runwayLanding.IsComplete; 20 | } 21 | 22 | public override void OnLoad(ConfigNode configNode) { } 23 | public override void OnSave(ConfigNode configNode) { } 24 | 25 | protected override string RequirementText() 26 | { 27 | return Localizer.GetStringByTag(invertRequirement ? "#cc.req.RunwayLanding.x" : "#cc.req.RunwayLanding"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/SpacewalkRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using KSP.Localization; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// ContractRequirement to provide requirement for player having done a spacewalk 14 | /// 15 | public class SpacewalkRequirement : ContractRequirement 16 | { 17 | public override bool RequirementMet(ConfiguredContract contract) 18 | { 19 | return ProgressTracking.Instance.celestialBodyHome.spacewalk.IsComplete; 20 | } 21 | 22 | public override void OnLoad(ConfigNode configNode) { } 23 | public override void OnSave(ConfigNode configNode) { } 24 | 25 | protected override string RequirementText() 26 | { 27 | return Localizer.GetStringByTag(invertRequirement ? "#cc.req.Spacewalk.x" : "#cc.req.Spacewalk"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Requirement/ValidVesselRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP; 7 | using KSPAchievements; 8 | using Contracts; 9 | using ContractConfigurator.ExpressionParser; 10 | using ContractConfigurator.Util; 11 | using KSP.Localization; 12 | 13 | namespace ContractConfigurator 14 | { 15 | /// 16 | /// ContractRequirement to check if a VesselIdentifier is assigned to a valid vessel. 17 | /// 18 | public class ValidVesselRequirement : ContractRequirement 19 | { 20 | protected VesselIdentifier vessel; 21 | 22 | public override bool LoadFromConfig(ConfigNode configNode) 23 | { 24 | // Load base class 25 | bool valid = base.LoadFromConfig(configNode); 26 | 27 | // Get expression 28 | valid &= ConfigNodeUtil.ParseValue(configNode, "vessel", x => vessel = x, this); 29 | 30 | return valid; 31 | } 32 | 33 | public override void OnSave(ConfigNode configNode) 34 | { 35 | configNode.AddValue("vessel", vessel.identifier); 36 | } 37 | 38 | public override void OnLoad(ConfigNode configNode) 39 | { 40 | vessel = ConfigNodeUtil.ParseValue(configNode, "vessel"); 41 | } 42 | 43 | public override bool RequirementMet(ConfiguredContract contract) 44 | { 45 | return ContractVesselTracker.Instance != null && ContractVesselTracker.Instance.GetAssociatedVessel(vessel.identifier) != null; 46 | } 47 | 48 | protected override string RequirementText() 49 | { 50 | string title = StringBuilderCache.Format("{1}", MissionControlUI.RequirementHighlightColor, vessel.identifier); 51 | return Localizer.Format(invertRequirement ? "#cc.req.ValidVessel.x" : "#cc.req.ValidVessel", title); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Util/ContractConfiguratorException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ContractConfigurator.Parameters; 6 | 7 | namespace ContractConfigurator 8 | { 9 | public class ContractConfiguratorException : Exception 10 | { 11 | public ContractConfiguratorException(ConfiguredContract c, Exception innerException) 12 | : base(StringBuilderCache.Format("Error in contract '{0}'", c != null && c.contractType != null ? c.contractType.name : ""), innerException) 13 | { 14 | } 15 | 16 | public ContractConfiguratorException(ContractConfiguratorParameter p, Exception innerException) 17 | : this(p.Root as ConfiguredContract, innerException) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Util/ExceptionUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using ContractConfigurator.ExpressionParser; 7 | 8 | namespace ContractConfigurator 9 | { 10 | public static class ExceptionUtil 11 | { 12 | /// 13 | /// Unwraps the TargetInvocationException that reflection methods helpfully give us. 14 | /// 15 | /// Exception to unwrap 16 | /// A copy of the inner exception, for a few cases. 17 | public static Exception UnwrapTargetInvokationException(TargetInvocationException tie) 18 | { 19 | if (tie.InnerException.GetType() == typeof(DataStoreCastException)) 20 | { 21 | DataStoreCastException orig = (DataStoreCastException)tie.InnerException; 22 | return new DataStoreCastException(orig.FromType, orig.ToType, tie); 23 | } 24 | else if (tie.InnerException.GetType() == typeof(DataNode.ValueNotInitialized)) 25 | { 26 | DataNode.ValueNotInitialized orig = (DataNode.ValueNotInitialized)tie.InnerException; 27 | throw new DataNode.ValueNotInitialized(orig.key, tie); 28 | } 29 | else if (tie.InnerException.GetType() == typeof(NotSupportedException)) 30 | { 31 | NotSupportedException orig = (NotSupportedException)tie.InnerException; 32 | throw new NotSupportedException(orig.Message, tie); 33 | } 34 | return null; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Util/LocationUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ContractConfigurator 7 | { 8 | public static class LocationUtil 9 | { 10 | public static double TerrainHeight(double latitude, double longitude, CelestialBody body) 11 | { 12 | // Sun and Jool - bodies without terrain 13 | if (body.pqsController == null) 14 | { 15 | return 0; 16 | } 17 | 18 | // Figure out the terrain height 19 | double latRads = Math.PI / 180.0 * latitude; 20 | double lonRads = Math.PI / 180.0 * longitude; 21 | Vector3d radialVector = new Vector3d(Math.Cos(latRads) * Math.Cos(lonRads), Math.Sin(latRads), Math.Cos(latRads) * Math.Sin(lonRads)); 22 | return Math.Max(body.pqsController.GetSurfaceHeight(radialVector) - body.pqsController.radius, 0.0); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Util/PartUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using UnityEngine; 7 | using KSP; 8 | using ContractConfigurator.Parameters; 9 | 10 | namespace ContractConfigurator 11 | { 12 | /// 13 | /// Class for handling part related stuff. 14 | /// 15 | public static class PartUtil 16 | { 17 | /// 18 | /// Gets an enumerator of all parts that have the given module. 19 | /// 20 | /// Part enumerator to filter on. 21 | /// Part module to filter by. 22 | /// A new part enumerator 23 | public static IEnumerable WithModule(this IEnumerable parts, string partModule) 24 | { 25 | foreach (Part p in parts) 26 | { 27 | foreach (PartModule pm in p.Modules) 28 | { 29 | if (pm.moduleName == partModule) 30 | { 31 | yield return p; 32 | break; 33 | } 34 | } 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Util/PrincipiaUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using UnityEngine; 7 | 8 | namespace ContractConfigurator 9 | { 10 | public static class PrincipiaUtil 11 | { 12 | public static bool PrincipiaDetected => _PrincipiaDetectTried ? _PrincipiaDetected : FindPrincipia(); 13 | 14 | private static bool _PrincipiaDetected = false; 15 | private static bool _PrincipiaDetectTried = false; 16 | private static bool FindPrincipia() 17 | { 18 | _PrincipiaDetectTried = true; 19 | _PrincipiaDetected = AssemblyLoader.loadedAssemblies.Any(a => a.name.Equals("ksp_plugin_adapter", StringComparison.OrdinalIgnoreCase)); 20 | return _PrincipiaDetected; 21 | } 22 | 23 | public static double PrincipiaCorrectInclination(Orbit o) 24 | { 25 | if (PrincipiaDetected && o.referenceBody != (FlightGlobals.currentMainBody ?? Planetarium.fetch.Home)) 26 | { 27 | Vector3d polarAxis = o.referenceBody.BodyFrame.Z; 28 | 29 | double hSqrMag = o.h.sqrMagnitude; 30 | if (hSqrMag == 0d) 31 | { 32 | return Math.Acos(Vector3d.Dot(polarAxis, o.pos) / o.pos.magnitude) * (180.0 / Math.PI); 33 | } 34 | else 35 | { 36 | Vector3d orbitZ = o.h / Math.Sqrt(hSqrMag); 37 | return Math.Atan2((orbitZ - polarAxis).magnitude, (orbitZ + polarAxis).magnitude) * (2d * (180.0 / Math.PI)); 38 | } 39 | } 40 | else 41 | { 42 | return o.inclination; 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Util/RP0Util.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using UnityEngine; 7 | 8 | namespace ContractConfigurator 9 | { 10 | public static class RP0Util 11 | { 12 | public static bool RP0Detected => _RP0DetectTried ? _RP0Detected : FindRP0(); 13 | 14 | private static bool _RP0Detected = false; 15 | private static bool _RP0DetectTried = false; 16 | private static bool FindRP0() 17 | { 18 | _RP0DetectTried = true; 19 | _RP0Detected = AssemblyLoader.loadedAssemblies.Any(a => a.name.Equals("RP-0", StringComparison.OrdinalIgnoreCase)); 20 | return _RP0Detected; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/ContractConfigurator/Util/TipLoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | using KSP.Localization; 7 | 8 | namespace ContractConfigurator.Util 9 | { 10 | [KSPAddon(KSPAddon.Startup.Instantly, true)] 11 | public class TipLoader : MonoBehaviour 12 | { 13 | public void Start() 14 | { 15 | if (RP0Util.RP0Detected) 16 | Destroy(this); 17 | } 18 | 19 | public void Update() 20 | { 21 | // Delay until the game database has started loading (it's a short delay) 22 | if (LoadingScreen.Instance != null && GameDatabase.Instance != null && GameDatabase.Instance.root != null) 23 | { 24 | LoggingUtil.LogDebug(this, "Adding custom loading tips"); 25 | 26 | // Add the Contract Configurator tip 27 | List contractTips = new List(); 28 | contractTips.Add(Localizer.GetStringByTag("#cc.loadingtip")); 29 | 30 | // Read tips from root contract groups 31 | ConfigNode[] contractGroups = GameDatabase.Instance.GetConfigNodes("CONTRACT_GROUP"); 32 | foreach (ConfigNode groupConfig in contractGroups) 33 | { 34 | if (groupConfig.HasValue("tip")) 35 | { 36 | foreach (string tip in groupConfig.GetValues("tip")) 37 | { 38 | contractTips.Add(tip); 39 | } 40 | } 41 | } 42 | 43 | foreach (LoadingScreen.LoadingScreenState lss in LoadingScreen.Instance.Screens) 44 | { 45 | // Append our custom tips 46 | lss.tips = lss.tips.Union(contractTips).ToArray(); 47 | } 48 | 49 | Destroy(this); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source/KerKonConConExt/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("KerKonConConExt")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("KerKonConConExt")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("1a7e7d93-0fe2-4099-afa7-cefa133a985b")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("2.0")] 35 | [assembly: AssemblyFileVersion("2.0.0")] 36 | [assembly: AssemblyInformationalVersion("2.0.0")] 37 | [assembly: KSPAssembly("KerKonConConExt", 2, 0)] 38 | [assembly: KSPAssemblyDependency("ContractConfigurator", 2, 0)] 39 | [assembly: KSPAssemblyDependency("KerbalKonstructs", 0, 9)] 40 | -------------------------------------------------------------------------------- /source/KerKonConConExt/Requirements/BaseClosedRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using KSP.Localization; 3 | using KerbalKonstructs.LaunchSites; 4 | using ContractConfigurator; 5 | using ContractConfigurator.Util; 6 | 7 | namespace KerKonConConExt 8 | { 9 | public class BaseClosedRequirement : ContractRequirement 10 | { 11 | protected string basename { get; set; } 12 | 13 | public override bool LoadFromConfig(ConfigNode configNode) 14 | { 15 | bool valid = base.LoadFromConfig(configNode); 16 | 17 | valid &= ConfigNodeUtil.ParseValue(configNode, "basename", x => basename = x, this); 18 | 19 | return valid; 20 | } 21 | 22 | public override void OnSave(ConfigNode configNode) 23 | { 24 | configNode.AddValue("basename", basename); 25 | } 26 | 27 | public override void OnLoad(ConfigNode configNode) 28 | { 29 | basename = ConfigNodeUtil.ParseValue(configNode, "basename"); 30 | } 31 | 32 | public override bool RequirementMet(ConfiguredContract contract) 33 | { 34 | return !LaunchSiteManager.getIsSiteOpen(basename); 35 | } 36 | 37 | protected override string RequirementText() 38 | { 39 | return Localizer.Format(invertRequirement ? "#cc.kk.req.BaseOpen" : "#cc.kk.req.BaseClosed", 40 | StringBuilderCache.Format("{1}", MissionControlUI.RequirementHighlightColor, basename)); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /source/KerKonConConExt/Requirements/BaseExistsRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using KSP.Localization; 3 | using KerbalKonstructs.LaunchSites; 4 | using ContractConfigurator; 5 | using ContractConfigurator.Util; 6 | 7 | namespace KerKonConConExt 8 | { 9 | public class BaseExistsRequirement : ContractRequirement 10 | { 11 | protected string basename { get; set; } 12 | 13 | public override bool LoadFromConfig(ConfigNode configNode) 14 | { 15 | bool valid = base.LoadFromConfig(configNode); 16 | 17 | valid &= ConfigNodeUtil.ParseValue(configNode, "basename", x => basename = x, this); 18 | 19 | return valid; 20 | } 21 | 22 | public override void OnSave(ConfigNode configNode) 23 | { 24 | configNode.AddValue("basename", basename); 25 | } 26 | 27 | public override void OnLoad(ConfigNode configNode) 28 | { 29 | basename = ConfigNodeUtil.ParseValue(configNode, "basename"); 30 | } 31 | 32 | public override bool RequirementMet(ConfiguredContract contract) 33 | { 34 | return LaunchSiteManager.checkLaunchSiteExists(basename); 35 | } 36 | 37 | protected override string RequirementText() 38 | { 39 | return Localizer.Format(invertRequirement ? "#cc.kk.req.BaseExists.x" : "#cc.kk.req.BaseExists.x", 40 | StringBuilderCache.Format("{1}", MissionControlUI.RequirementHighlightColor, basename)); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /source/KerKonConConExt/Requirements/BaseLockedRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using KSP.Localization; 3 | using KerbalKonstructs.LaunchSites; 4 | using ContractConfigurator; 5 | using ContractConfigurator.Util; 6 | 7 | namespace KerKonConConExt 8 | { 9 | public class BaseLockedRequirement : ContractRequirement 10 | { 11 | protected string basename { get; set; } 12 | 13 | public override bool LoadFromConfig(ConfigNode configNode) 14 | { 15 | bool valid = base.LoadFromConfig(configNode); 16 | 17 | valid &= ConfigNodeUtil.ParseValue(configNode, "basename", x => basename = x, this); 18 | 19 | return valid; 20 | } 21 | 22 | public override void OnSave(ConfigNode configNode) 23 | { 24 | configNode.AddValue("basename", basename); 25 | } 26 | 27 | public override void OnLoad(ConfigNode configNode) 28 | { 29 | basename = ConfigNodeUtil.ParseValue(configNode, "basename"); 30 | } 31 | 32 | public override bool RequirementMet(ConfiguredContract contract) 33 | { 34 | return LaunchSiteManager.getIsSiteLocked(basename); 35 | } 36 | 37 | protected override string RequirementText() 38 | { 39 | return Localizer.Format(invertRequirement ? "#cc.kk.req.BaseUnlocked" : "#cc.kk.req.BaseLocked", 40 | StringBuilderCache.Format("{1}", MissionControlUI.RequirementHighlightColor, basename)); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /source/KerKonConConExt/Requirements/BaseOpenRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using KSP.Localization; 3 | using KerbalKonstructs.LaunchSites; 4 | using ContractConfigurator; 5 | using ContractConfigurator.Util; 6 | 7 | namespace KerKonConConExt 8 | { 9 | public class BaseOpenRequirement : ContractRequirement 10 | { 11 | protected string basename { get; set; } 12 | 13 | public override bool LoadFromConfig(ConfigNode configNode) 14 | { 15 | bool valid = base.LoadFromConfig(configNode); 16 | 17 | valid &= ConfigNodeUtil.ParseValue(configNode, "basename", x => basename = x, this); 18 | 19 | return valid; 20 | } 21 | 22 | public override void OnSave(ConfigNode configNode) 23 | { 24 | configNode.AddValue("basename", basename); 25 | } 26 | 27 | public override void OnLoad(ConfigNode configNode) 28 | { 29 | basename = ConfigNodeUtil.ParseValue(configNode, "basename"); 30 | } 31 | 32 | public override bool RequirementMet(ConfiguredContract contract) 33 | { 34 | return LaunchSiteManager.getIsSiteOpen(basename); 35 | } 36 | 37 | protected override string RequirementText() 38 | { 39 | return Localizer.Format(invertRequirement ? "#cc.kk.req.BaseClosed" : "#cc.kk.req.BaseOpen", 40 | StringBuilderCache.Format("{1}", MissionControlUI.RequirementHighlightColor, basename)); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /source/KerKonConConExt/Requirements/BaseUnlockedRequirement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using KSP.Localization; 3 | using KerbalKonstructs.LaunchSites; 4 | using ContractConfigurator; 5 | using ContractConfigurator.Util; 6 | 7 | namespace KerKonConConExt 8 | { 9 | public class BaseUnlockedRequirement : ContractRequirement 10 | { 11 | protected string basename { get; set; } 12 | 13 | public override bool LoadFromConfig(ConfigNode configNode) 14 | { 15 | bool valid = base.LoadFromConfig(configNode); 16 | 17 | valid &= ConfigNodeUtil.ParseValue(configNode, "basename", x => basename = x, this); 18 | 19 | return valid; 20 | } 21 | 22 | public override void OnSave(ConfigNode configNode) 23 | { 24 | configNode.AddValue("basename", basename); 25 | } 26 | 27 | public override void OnLoad(ConfigNode configNode) 28 | { 29 | basename = ConfigNodeUtil.ParseValue(configNode, "basename"); 30 | } 31 | 32 | public override bool RequirementMet(ConfiguredContract contract) 33 | { 34 | return !LaunchSiteManager.getIsSiteLocked(basename); 35 | } 36 | 37 | protected override string RequirementText() 38 | { 39 | return Localizer.Format(invertRequirement ? "#cc.kk.req.BaseLocked" : "#cc.kk.req.BaseUnlocked", 40 | StringBuilderCache.Format("{1}", MissionControlUI.RequirementHighlightColor, basename)); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /source/ksplocations_example.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\ 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/Behaviour/AwardExperience.cfg: -------------------------------------------------------------------------------- 1 | // Contract for behaviour test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestBehaviour_AwardExperience 6 | 7 | group = BehaviourTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = AwardExperience Behaviour 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | name = ParameterToComplete 20 | type = VesselParameterGroup 21 | 22 | PARAMETER 23 | { 24 | name = ReachState 25 | type = ReachState 26 | 27 | situation = FLYING 28 | targetBody = Kerbin 29 | } 30 | } 31 | 32 | BEHAVIOUR 33 | { 34 | type = AwardExperience 35 | 36 | parameter = ParameterToComplete 37 | 38 | experience = 4 39 | 40 | awardImmediately = true 41 | } 42 | 43 | BEHAVIOUR 44 | { 45 | type = AwardExperience 46 | 47 | parameter = VesselParameterGroup 48 | 49 | experience = 5 50 | 51 | awardImmediately = false 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /test/Behaviour/Orbit.cfg: -------------------------------------------------------------------------------- 1 | // Contract for behaviour test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestBehaviour_OrbitGenerator 6 | 7 | group = BehaviourTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = OrbitGenerator Behaviour 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | type = VesselParameterGroup 20 | 21 | duration = 10d 2h 22 | 23 | PARAMETER 24 | { 25 | type = ReachSpecificOrbit 26 | index = 0 27 | } 28 | } 29 | 30 | PARAMETER 31 | { 32 | type = ReachSpecificOrbit 33 | index = 1 34 | } 35 | 36 | BEHAVIOUR 37 | { 38 | type = OrbitGenerator 39 | 40 | // Use this to generate an orbit with specific parameters 41 | FIXED_ORBIT 42 | { 43 | // Actual orbit details. Note that REF represents the reference 44 | // body - but will be overriden by the targetBody. 45 | ORBIT 46 | { 47 | SMA = 1449999.99996286 48 | ECC = 1.07570816555399E-05 49 | INC = 0 50 | LPE = 270.690311604893 51 | LAN = 1.93635924563296 52 | MNA = 1.55872660382504 53 | EPH = 31.3999999999994 54 | REF = 1 55 | } 56 | } 57 | 58 | RANDOM_ORBIT 59 | { 60 | type = KOLNIYA 61 | } 62 | 63 | RANDOM_ORBIT 64 | { 65 | type = POLAR 66 | } 67 | 68 | RANDOM_ORBIT 69 | { 70 | type = TUNDRA 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /test/Behaviour/SpawnPassengers.cfg: -------------------------------------------------------------------------------- 1 | // Contract for behaviour test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestBehaviour_SpawnPassengers 6 | 7 | group = BehaviourTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = SpawnPassengers Behaviour 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | type = HasPassengers 20 | } 21 | 22 | BEHAVIOUR 23 | { 24 | type = SpawnPassengers 25 | 26 | count = 10 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/Behaviour/UnlockTech.cfg: -------------------------------------------------------------------------------- 1 | CONTRACT_TYPE 2 | { 3 | // Unique name of the contract (required) 4 | name = UnlockTech 5 | 6 | // Contract text 7 | title = UnlockTech 8 | description = A more detailed description of the contract. This is where you come in. 9 | synopsis = We want you to do a thing. 10 | completedMessage = You have done the thing. 11 | 12 | // Target Celestial body - controls where the contract must be completed, has some automated 13 | // effects on numeric parameters (increasing science, etc.) 14 | targetBody = Kerbin 15 | 16 | maxSimultaneous = 1 17 | 18 | // Contract rewards 19 | rewardScience = 100.0 20 | rewardFunds = 100000.0 21 | 22 | DATA 23 | { 24 | type = List 25 | 26 | allTech = AllTech() 27 | unlockedTech = UnlockedTech() 28 | children = @randoTech.Children() 29 | parents = @randoTech.Parents() 30 | } 31 | 32 | DATA 33 | { 34 | type = Tech 35 | 36 | randoTech = AllTech().Random() 37 | } 38 | 39 | DATA 40 | { 41 | type = int 42 | 43 | level = @randoTech.Level() 44 | } 45 | 46 | DATA 47 | { 48 | type = float 49 | 50 | cost = @randoTech.Cost() 51 | } 52 | 53 | DATA 54 | { 55 | type = bool 56 | readyToUnlock = @randoTech.IsReadyToUnlock() 57 | } 58 | 59 | PARAMETER 60 | { 61 | name = ReachState 62 | type = ReachState 63 | 64 | minAltitude = 1000 65 | } 66 | 67 | BEHAVIOUR 68 | { 69 | name = UnlockTech 70 | type = UnlockTech 71 | 72 | techID = engineering101 73 | } 74 | 75 | BEHAVIOUR 76 | { 77 | name = UnlockPart 78 | type = UnlockPart 79 | 80 | part = sensorThermometer 81 | } 82 | 83 | BEHAVIOUR 84 | { 85 | name = UnlockPart 86 | type = UnlockPart 87 | 88 | // Won't unlock unless the tech is researched 89 | part = sensorBarometer 90 | unlockTech = false 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /test/DialogBox/peppy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KSP-RO/ContractConfigurator/5459648abc41f721ecf929dd2ac9902b1134fcb5/test/DialogBox/peppy.png -------------------------------------------------------------------------------- /test/Groups.cfg: -------------------------------------------------------------------------------- 1 | // Group definitions for Contract Configurator tests 2 | CONTRACT_GROUP 3 | { 4 | name = TestGroup 5 | 6 | minVersion = 1.29.0 7 | displayName = ~Contract Configurator Tests 8 | 9 | CONTRACT_GROUP 10 | { 11 | name = RequirementTest 12 | displayName = Requirement Tests 13 | } 14 | 15 | CONTRACT_GROUP 16 | { 17 | name = ParameterTest 18 | displayName = Parameter Tests 19 | } 20 | 21 | CONTRACT_GROUP 22 | { 23 | name = BehaviourTest 24 | displayName = Behaviour Tests 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Parameter/Kerbal.cfg: -------------------------------------------------------------------------------- 1 | // Contract for parameter test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestParameter_Kerbal 6 | 7 | group = ParameterTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = Kerbal Parameters 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | type = HasAstronaut 20 | 21 | trait = Pilot 22 | minExperience = 1 23 | maxExperience = 2 24 | minCount = 2 25 | maxCount = 10 26 | } 27 | 28 | PARAMETER 29 | { 30 | type = HasAstronaut 31 | 32 | trait = Scientist 33 | maxExperience = 2 34 | maxCount = 10 35 | } 36 | 37 | PARAMETER 38 | { 39 | type = HasAstronaut 40 | 41 | trait = Engineer 42 | minCount = 5 43 | } 44 | 45 | PARAMETER 46 | { 47 | type = HasAstronaut 48 | 49 | minExperience = 1 50 | } 51 | 52 | PARAMETER 53 | { 54 | type = RecoverKerbal 55 | 56 | kerbal = Jebediah Kerman 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /test/Parameter/Miscellaneous.cfg: -------------------------------------------------------------------------------- 1 | // Contract for parameter test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestParameter_Miscellaneous 6 | 7 | group = ParameterTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = Miscellaneous Parameters 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | type = Duration 20 | 21 | duration = 10d 4h 16m 53s 22 | startCriteria = NEXT_LAUNCH 23 | 24 | preWaitText = Waiting for launch... 25 | waitingText = Countdown 26 | completionText = Blastoff! 27 | } 28 | 29 | PARAMETER 30 | { 31 | type = MissionTimer 32 | } 33 | 34 | // PartTest is for testing parts (or just activating them, for staged parts). This parameter 35 | // supports child parameters - you will only be able to complete the part test if all child 36 | // parameters are also completed. 37 | PARAMETER 38 | { 39 | type = PartTest 40 | 41 | part = SmallGearBay 42 | notes = Test this part anywhere, no other requirements! 43 | } 44 | 45 | PARAMETER 46 | { 47 | type = TargetDestroyed 48 | 49 | vessel = Target 1 50 | vessel = Target 2 51 | vessel = Target 3 52 | } 53 | 54 | PARAMETER 55 | { 56 | type = Timer 57 | 58 | duration = 10d 30m 59 | failContract = false 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /test/Parameter/Negative.cfg: -------------------------------------------------------------------------------- 1 | // Contract for parameter test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestParameter_Negative 6 | 7 | group = ParameterTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = Negative Parameters 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | type = KerbalDeaths 20 | 21 | countMax = 2 22 | } 23 | 24 | PARAMETER 25 | { 26 | type = KerbalDeaths 27 | 28 | vessel = Kerbal Vessel 29 | } 30 | 31 | PARAMETER 32 | { 33 | type = KerbalDeaths 34 | 35 | kerbal = Jebediah Kerman 36 | kerbal = Valentina Kerman 37 | } 38 | 39 | PARAMETER 40 | { 41 | type = NoStaging 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/Parameter/Planetary.cfg: -------------------------------------------------------------------------------- 1 | // Contract for parameter test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestParameter_Planetary 6 | 7 | group = ParameterTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = Planetary Parameters 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | type = PerformOrbitalSurvey 20 | } 21 | 22 | PARAMETER 23 | { 24 | type = PlantFlag 25 | } 26 | 27 | PARAMETER:NEEDS[SCANsat] 28 | { 29 | type = SCANsatCoverage 30 | 31 | coverage = 60.0 32 | scanType = ResourceLoRes 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/Parameter/Progression.cfg: -------------------------------------------------------------------------------- 1 | // Contract for parameter test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestParameter_Progression 6 | 7 | group = ParameterTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = Progression Parameters 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | type = ReachSpace 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/Parameter/RemoteTech.cfg: -------------------------------------------------------------------------------- 1 | // Contract for RemoteTech parameter test 2 | CONTRACT_TYPE:NEEDS[RemoteTech] 3 | { 4 | // Unique name of the contract (required) 5 | name = TestParameter_RemoteTech 6 | 7 | group = ParameterTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = RemoteTech Parameters 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | PARAMETER 18 | { 19 | type = VesselParameterGroup 20 | 21 | PARAMETER 22 | { 23 | type = KSCConnectivity 24 | 25 | hasConnectivity = true 26 | 27 | disableOnStateChange = false 28 | } 29 | 30 | PARAMETER 31 | { 32 | type = SignalDelay 33 | 34 | minSignalDelay = 1.0 35 | maxSignalDelay = 70.0 36 | 37 | disableOnStateChange = false 38 | } 39 | 40 | PARAMETER 41 | { 42 | type = HasAntenna 43 | 44 | minCount = 1 45 | maxCount = 3 46 | 47 | targetBody = Duna 48 | 49 | antennaType = Dish 50 | 51 | minRange = 36000000000 52 | } 53 | } 54 | 55 | PARAMETER 56 | { 57 | type = CelestialBodyCoverage 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /test/PartTest.cfg: -------------------------------------------------------------------------------- 1 | CONTRACT_TYPE 2 | { 3 | name = PartTest 4 | 5 | // Contract text 6 | title = Part Test 7 | description = A more detailed description of the contract. This is where you come in. 8 | synopsis = We want you to do a thing. 9 | completedMessage = You have done the thing. 10 | 11 | targetBody = Kerbin 12 | 13 | // Contract rewards 14 | rewardFunds = 1000000.0 15 | rewardScience = 100.0 16 | 17 | maxSimultaneous = 1 18 | 19 | PARAMETER 20 | { 21 | type = PartTest 22 | 23 | part = SmallGearBay 24 | } 25 | 26 | PARAMETER 27 | { 28 | type = PartTest 29 | 30 | part = structuralPylon 31 | } 32 | 33 | BEHAVIOUR 34 | { 35 | type = ExperimentalPart 36 | 37 | part = SmallGearBay 38 | part = structuralPylon 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/Requirement/Contract.cfg: -------------------------------------------------------------------------------- 1 | // Contract for requirement test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestRequirement_Contract 6 | 7 | group = RequirementTest 8 | maxSimultaneous = 1 9 | 10 | // Contract text 11 | title = Contract Requirements 12 | description = description 13 | synopsis = synopsis 14 | completedMessage = completedMessage 15 | 16 | // Need at least one parameter 17 | PARAMETER 18 | { 19 | type = ReachSpace 20 | } 21 | 22 | REQUIREMENT 23 | { 24 | type = AcceptContract 25 | 26 | contractType = SimpleTestContract 27 | } 28 | 29 | REQUIREMENT 30 | { 31 | type = AcceptContract 32 | invertRequirement = true 33 | 34 | contractType = SimpleTestContract 35 | } 36 | 37 | REQUIREMENT 38 | { 39 | type = CompleteContract 40 | 41 | contractType = SimpleTestContract 42 | } 43 | 44 | REQUIREMENT 45 | { 46 | type = CompleteContract 47 | invertRequirement = true 48 | 49 | 50 | contractType = SimpleTestContract 51 | } 52 | 53 | REQUIREMENT 54 | { 55 | type = CompleteContract 56 | 57 | cooldownDuration = 2d 58 | contractType = SimpleTestContract 59 | } 60 | 61 | REQUIREMENT 62 | { 63 | type = CompleteContract 64 | invertRequirement = true 65 | 66 | cooldownDuration = 2d 67 | contractType = SimpleTestContract 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /test/Requirement/Miscellaneous.cfg: -------------------------------------------------------------------------------- 1 | // Contract for requirement test 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = TestRequirement_Miscellaneous 6 | 7 | group = RequirementTest 8 | maxSimultaneous = 1 9 | targetBody = Kerbin 10 | 11 | // Contract text 12 | title = Miscellaneous Requirements 13 | description = description 14 | synopsis = synopsis 15 | completedMessage = completedMessage 16 | 17 | // Need at least one parameter 18 | PARAMETER 19 | { 20 | type = ReachSpace 21 | } 22 | 23 | REQUIREMENT 24 | { 25 | type = Expansion 26 | expansion = MakingHistory 27 | } 28 | 29 | REQUIREMENT 30 | { 31 | type = Expansion 32 | expansion = Serenity 33 | } 34 | 35 | REQUIREMENT 36 | { 37 | type = Expression 38 | 39 | title = Target body is Minmus 40 | expression = @/targetBody == Minmus 41 | } 42 | 43 | REQUIREMENT 44 | { 45 | type = Expression 46 | 47 | invertRequirement = true 48 | title = Target body is not Minmus 49 | expression = @/targetBody == Minmus 50 | } 51 | 52 | REQUIREMENT 53 | { 54 | type = ValidVessel 55 | 56 | vessel = Tranquility Base 57 | } 58 | 59 | REQUIREMENT 60 | { 61 | type = ValidVessel 62 | 63 | invertRequirement = true 64 | vessel = Tranquility Base 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /test/VesselTracking.cfg: -------------------------------------------------------------------------------- 1 | // This contract shows all the different parameters that can be used. 2 | CONTRACT_TYPE 3 | { 4 | // Unique name of the contract (required) 5 | name = VesselTracking 6 | 7 | // Contract text 8 | title = Vessel Tracking 9 | description = A more detailed description of the contract. This is where you come in. 10 | synopsis = We want you to do a thing. 11 | completedMessage = You have done the thing. 12 | 13 | maxSimultaneous = 1 14 | 15 | // Target Celestial body - controls where the contract must be completed, has some automated 16 | // effects on numeric parameters (increasing science, etc.) 17 | targetBody = Kerbin 18 | 19 | // Contract rewards 20 | rewardScience = 100.0 21 | rewardFunds = 100000.0 22 | 23 | PARAMETER 24 | { 25 | name = VesselParameterGroup1 26 | type = VesselParameterGroup 27 | 28 | define = My Vessel 29 | 30 | // The text to display. 31 | // Default - Do the following for 32 | //title = 33 | 34 | PARAMETER 35 | { 36 | name = Docking 37 | type = Docking 38 | 39 | defineDockedVessel = My New Vessel 40 | } 41 | } 42 | } 43 | --------------------------------------------------------------------------------