Skip to content

Commit 59872a2

Browse files
committed
Break out the contract-specific code into its own DLL to make it so that ContractConfigurator is optional.
1 parent dca4bfe commit 59872a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3431
-30
lines changed

ProgressiveColonizationSystem.sln

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26730.8
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31019.35
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{27CF42F2-488E-4A31-9927-011A311F9FAB}"
77
ProjectSection(SolutionItems) = preProject
@@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProgressiveColonizationSyst
2020
EndProject
2121
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateRelease", "src\CreateRelease\CreateRelease.csproj", "{5A6E9033-4E91-4844-8F7D-F68072F4C82A}"
2222
EndProject
23+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProgressiveColonizationSystem.Contracts", "src\ProgressiveColonizationSystem.Contracts\ProgressiveColonizationSystem.Contracts.csproj", "{321AA6C6-4AAA-4E91-A0B3-D39A7681FC4D}"
24+
EndProject
2325
Global
2426
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2527
CodeAnalysis|Any CPU = CodeAnalysis|Any CPU
@@ -45,6 +47,12 @@ Global
4547
{5A6E9033-4E91-4844-8F7D-F68072F4C82A}.Debug|Any CPU.Build.0 = Debug|Any CPU
4648
{5A6E9033-4E91-4844-8F7D-F68072F4C82A}.Release|Any CPU.ActiveCfg = Release|Any CPU
4749
{5A6E9033-4E91-4844-8F7D-F68072F4C82A}.Release|Any CPU.Build.0 = Release|Any CPU
50+
{321AA6C6-4AAA-4E91-A0B3-D39A7681FC4D}.CodeAnalysis|Any CPU.ActiveCfg = CodeAnalysis|Any CPU
51+
{321AA6C6-4AAA-4E91-A0B3-D39A7681FC4D}.CodeAnalysis|Any CPU.Build.0 = CodeAnalysis|Any CPU
52+
{321AA6C6-4AAA-4E91-A0B3-D39A7681FC4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53+
{321AA6C6-4AAA-4E91-A0B3-D39A7681FC4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
54+
{321AA6C6-4AAA-4E91-A0B3-D39A7681FC4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{321AA6C6-4AAA-4E91-A0B3-D39A7681FC4D}.Release|Any CPU.Build.0 = Release|Any CPU
4856
EndGlobalSection
4957
GlobalSection(SolutionProperties) = preSolution
5058
HideSolutionNode = FALSE
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<#@ template debug="false" hostspecific="true" language="C#" #>
2+
<#@ import namespace="System.IO" #>
3+
<#@ output extension=".cs" #>
4+
5+
<#@ assembly name="EnvDTE" #><# /* This assembly provides access to Visual Studio project properties. */ #>
6+
<#
7+
8+
// Instructions
9+
// 1. Add a new Text Template to the project
10+
// 2. Copy this file into the new template
11+
// 3. Update the string: versionfile with the complete path to the .version file
12+
// 4. Remove the following line from the file AssemblyInfo.cs (usually located in the "Property" folder inside your C# project):
13+
// [assembly: AssemblyVersion("1.0.0.0")]
14+
// 5. Add the following to the PreBuild steps:
15+
// set textTemplatingPath="%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe"
16+
//
17+
// if %textTemplatingPath%=="\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" set textTemplatingPath="%CommonProgramFiles%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe"
18+
//
19+
// %textTemplatingPath% "$(ProjectDir)AssemblyFileVersion.tt"
20+
21+
int major = 0;
22+
int minor = 0;
23+
int build = 0;
24+
int patch = 0;
25+
bool versionSection = false;
26+
27+
int i = 0;
28+
int i2 = 0;
29+
string s;
30+
31+
string versionfile = @"..\..\GameData\ProgressiveColonizationSystem\ProgressiveColonizationSystem.version";
32+
if (!File.Exists(versionfile))
33+
{
34+
Write("CWD: " + Environment.CurrentDirectory);
35+
Write("File: " + versionfile + " missing\n");
36+
}
37+
38+
try
39+
{
40+
foreach (var line in File.ReadAllLines(versionfile))
41+
{
42+
if (line != null)
43+
{
44+
if (!versionSection)
45+
{
46+
if (line.Contains("\"VERSION\""))
47+
versionSection = true;
48+
}
49+
else
50+
{
51+
if (line.Contains("}"))
52+
versionSection = false;
53+
i = line.IndexOf(":");
54+
i2 = line.IndexOf(",");
55+
if (i2 == -1)
56+
i2 = line.Length;
57+
if (i >= 0 && i2 >= 0)
58+
{
59+
s = line.Substring(i + 1, i2 - i - 1);
60+
61+
if (line.Contains("MAJOR"))
62+
Int32.TryParse(s, out major);
63+
64+
if (line.Contains("MINOR"))
65+
Int32.TryParse(s, out minor);
66+
67+
if (line.Contains("PATCH"))
68+
Int32.TryParse(s, out patch);
69+
70+
if (line.Contains("BUILD"))
71+
Int32.TryParse(s, out build);
72+
}
73+
}
74+
}
75+
}
76+
}
77+
catch
78+
{
79+
major = 0;
80+
minor = 0;
81+
patch = 0;
82+
build = 0;
83+
}
84+
//Write("File done");
85+
86+
#>
87+
// This code was generated by a tool. Any changes made manually will be lost
88+
// the next time this code is regenerated.
89+
//
90+
91+
using System.Reflection;
92+
93+
[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@PART[*]:HAS[#CrewCapacity[1],!RESOURCE[LifeSupport]]
2+
{
3+
RESOURCE
4+
{
5+
name = Snacks-Tier4
6+
amount = 3
7+
maxAmount = 3
8+
}
9+
}
10+
@PART[*]:HAS[#CrewCapacity[2],!RESOURCE[LifeSupport],@MODULE[ModuleCommand]]
11+
{
12+
RESOURCE
13+
{
14+
name = Snacks-Tier4
15+
amount = 6
16+
maxAmount = 6
17+
}
18+
}
19+
@PART[*]:HAS[#CrewCapacity[3],!RESOURCE[LifeSupport],@MODULE[ModuleCommand]]
20+
{
21+
RESOURCE
22+
{
23+
name = Snacks-Tier4
24+
amount = 45
25+
maxAmount = 45
26+
}
27+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This adds a category for PKS parts.
2+
3+
@CCKExtraFilterConfig:NEEDS[CCK]
4+
{
5+
Item
6+
{
7+
name = Progressive Colonization
8+
tag = cck-pks
9+
normalIcon = ProgressiveColonizationSystem/Textures/icon_filter_n
10+
selectedIcon = ProgressiveColonizationSystem/Textures/icon_filter_s
11+
usedByMod = Extraplanetary Launchpads
12+
}
13+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
CONTRACT_TYPE
2+
{
3+
// See https://github.com/jrossignol/ContractConfigurator/wiki/Contract-Type
4+
name = PksDunaOrbitalRescue
5+
title = Format("Rescue <<1>> from orbit of <<2>> and bring <<P:1>> to your base on <<3>>", [@adventurer.DisplayName(), @/stuckAtBody, @/goingToBody])
6+
genericTitle = Space Adventurer Rescue
7+
// complains its not needed: contractGroup = SpaceAdventurers
8+
description = Format("<<1>> really likes the color white. The whole reason why <<p:1>> joined KSP in the first place is because of the spiffy white suits, and the only reason why <<p:1>> wasn't on the short list of colonists for Duna was because of <<o:1>> insistance that Duna was white and a little red rather than the accepted answer of red with maybe a little white. But <<1>> resolved to prove them all wrong and go to Duna! But <<2>> didn't get far enough in the Kerbonaut program to learn how to land, and is gonna need a little help.", [@/adventurer.DisplayName(), @adventurer.FirstName(), @/stuckAtBody.DisplayName()])
9+
genericDescription = KSP goes through a highly selective vetting process for crewing stations, but sometimes kerbals feel like their amazing talents went unappreciated and set out for your colonies on their own. Usually with mixed results.
10+
synopsis = We want you to rescue a kerbal
11+
completedMessage = Format("<<1>> has joined your colony on <<2>>!", [@adventurer.FirstName(), @/goingToBody.DisplayName()])
12+
prestige = Significant
13+
group = PksRescueContractGroup
14+
15+
DATA
16+
{
17+
title = This is where we're going to tote the kerbal to
18+
hidden = true
19+
type = CelestialBody
20+
goingToBody = Duna
21+
}
22+
DATA
23+
{
24+
title = This is where we're going to pick up the kerbal
25+
hidden = true
26+
type = CelestialBody
27+
stuckAtBody = Duna
28+
}
29+
DATA
30+
{
31+
title = This is who we're going to pick up
32+
hidden = true
33+
type = Kerbal
34+
adventurer = NewKerbal()
35+
}
36+
37+
PARAMETER
38+
{
39+
name = GetToNewHome
40+
type = PksOnStationParameter
41+
42+
// Here we're saying that the place the kerbal arrives has to have at least one tier-3 farm on it
43+
researchCategory = agriculture
44+
tier = 3
45+
46+
// And it has to be on the target world
47+
body = @/goingToBody
48+
49+
// And of course this is the kerbal that has to be there.
50+
kerbal = @/adventurer
51+
}
52+
53+
REQUIREMENT
54+
{
55+
name = FarmingResearched
56+
type = PksTier
57+
58+
// Here we're saying that we're not going to offer the contract unless the contract is for a
59+
// body with the right tech.
60+
researchCategory = agriculture
61+
tier = 2
62+
targetBody = @/goingToBody
63+
}
64+
65+
BEHAVIOUR
66+
{
67+
name = SpawnVessel
68+
type = SpawnVessel
69+
deferVesselCreation = false
70+
VESSEL
71+
{
72+
name = Format("<<1>>'s <<2>>", [@/adventurer.ToString().FirstWord(), "shipwreck"])
73+
craftPart = mk1pod
74+
targetBody = @/stuckAtBody
75+
76+
CREW
77+
{
78+
addToRoster = true
79+
name = @/adventurer
80+
}
81+
82+
ORBIT
83+
{
84+
SMA = 686959.99593236914
85+
ECC = 0.012323694153547126
86+
INC = 21.6764731898754832
87+
LPE = 190.54953904110772
88+
LAN = 27.840941925294942
89+
MNA = 2.3937970792114149
90+
EPH = 128775571.8225528
91+
REF = 6 // Ignored
92+
}
93+
}
94+
}
95+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CONTRACT_GROUP
2+
{
3+
// See https://github.com/jrossignol/ContractConfigurator/wiki/Contract-Group
4+
5+
name = PksRescueContractGroup
6+
7+
displayName = Colonist rescues
8+
minVersion = 1.15.0
9+
maxSimultaneous = 2
10+
agent = Rescue and Recovery
11+
12+
tip = Calculating Victor's vector
13+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
CONTRACT_TYPE
2+
{
3+
// See https://github.com/jrossignol/ContractConfigurator/wiki/Contract-Type
4+
name = PksSurfaceRescue
5+
title = Format("Rescue <<1>> from the surface of <<2>> and bring them to your base", [Format("<<1>>", [@adventurer]).FirstWord(), @/goingToBody])
6+
genericTitle = Space Adventurer Rescue
7+
// complains its not needed: contractGroup = SpaceAdventurers
8+
description = Format("Okay, so maybe there were reasons why <<1>> wasn't chosen to be a colonist on <<3>>. Sure, <<2>> might not have the skills, abilities, disposition, temperment, and all-around intellect that the kerbals KSP chose have, but <<2>> makes up for it with sheer goforit. However, <<2>> isn't so good at precision landings... A little help?", [@/adventurer, Format("<<1>>", [@adventurer]).FirstWord(), @/goingToBody])
9+
genericDescription = KSP goes through a highly selective vetting process for crewing stations, but sometimes kerbals feel like their amazing talents went unappreciated and set out for your colonies on their own. Usually with mixed results.
10+
synopsis = We want you to rescue a kerbal
11+
completedMessage = Format("Good news! <<1>> has joined your colony on <<2>>", [Format("<<1>>", [@adventurer]).FirstWord(), @/goingToBody])
12+
prestige = Significant
13+
group = PksRescueContractGroup
14+
15+
DATA
16+
{
17+
title = This is where we're going to tote the kerbal to
18+
hidden = true
19+
type = CelestialBody
20+
goingToBody = [Ike,Duna,Eve,Gilly,Laythe,Val,Pol,Bop,Tylo,Eloo,Dres].Random()
21+
}
22+
DATA
23+
{
24+
title = This is who we're going to pick up
25+
hidden = true
26+
type = Kerbal
27+
adventurer = NewKerbal()
28+
}
29+
DATA
30+
{
31+
title = This is the crashsite latitude
32+
hidden = true
33+
type = double
34+
// Tend towards locations closer to the equator.
35+
latitude = (Random(-1.0,1.0) * Random(-1.0,1)) * 89.9
36+
}
37+
DATA
38+
{
39+
title = This is the crashsite latitude
40+
hidden = true
41+
type = double
42+
longitude = Random(0, 359.9)
43+
}
44+
45+
PARAMETER
46+
{
47+
name = GetToNewHome
48+
type = PksOnStationParameter
49+
50+
// Here we're saying that the place the kerbal arrives has to have at least one tier-3 farm on it
51+
researchCategory = agriculture
52+
tier = 3
53+
54+
// And it has to be on the target world
55+
body = @/goingToBody
56+
57+
// And this is the kerbal that has to be there.
58+
kerbal = @/adventurer
59+
}
60+
61+
REQUIREMENT
62+
{
63+
name = FarmingResearched
64+
type = PksTier
65+
66+
// Here we're saying that we're not going to offer the contract unless the contract is for a
67+
// body with the right tech.
68+
researchCategory = agriculture
69+
tier = 3
70+
targetBody = @/goingToBody
71+
}
72+
73+
BEHAVIOUR
74+
{
75+
// https://github.com/jrossignol/ContractConfigurator/wiki/SpawnVessel-Behaviour
76+
name = SpawnVessel
77+
type = SpawnVessel
78+
deferVesselCreation = false
79+
VESSEL
80+
{
81+
name = Format("<<1>>'s <<2>>", [Format("<<1>>", [@/adventurer]).FirstWord(), "shipwreck"])
82+
craftPart = mk1pod
83+
targetBody = @/goingToBody
84+
85+
lat = @/latitude
86+
lon = @/longitude
87+
}
88+
}
89+
90+
BEHAVIOUR
91+
{
92+
// https://github.com/jrossignol/ContractConfigurator/wiki/SpawnKerbal-Behaviour
93+
name = SpawnKerbal
94+
type = SpawnKerbal
95+
96+
KERBAL
97+
{
98+
kerbal = @/adventurer
99+
addToRoster = true
100+
targetBody = @/goingToBody
101+
lat = @/latitude + 0.01
102+
lon = @/longitude + 0.01
103+
}
104+
}
105+
}

0 commit comments

Comments
 (0)