forked from severedsolo/CleverSat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCleverSatConstellation.cfg
116 lines (105 loc) · 4.07 KB
/
CleverSatConstellation.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
CONTRACT_TYPE
{
name = CleverSatConstellation
title = #CleverSat_CleverSatConstellation_title // Work on a Satellite Constellation
group = CleverSat
description = #CleverSat_CleverSatConstellation_desc // Poor @/targetSat is looking lonely. We'd like you to move it into sync with @/groupSat - maybe they will be friends?
genericDescription = #CleverSat_CleverSatConstellation_genericDesc // One of our satellites is lonely. Move it into a constellation.
targetBody = @/targetBody1
synopsis = #CleverSat_CleverSatConstellation_synopsis // Move @/targetSat into the specified orbit
completedMessage = #CleverSat_CleverSatConstellation_completedMessage // Well, that should hold them for a while. Until they ask us to move the thing again of course.
targetBody = @/targetBody1
rewardFunds = Random(20000,40000)
rewardReputation = Random(2.0, 5.0)
maxSimultaneous = 1
//make a list of every CleverSat
DATA
{
type = List<VesselIdentifier>
validGroup = $SatList.Add(Group Sat).Where(g => Vessel(g).IsOrbiting())
hidden = true
}
//pick one at random. This is the satellite which will form the basis of our constellation.
DATA
{
type = Vessel
uniquenessCheck = GROUP_ACTIVE
groupSat = @validGroup.Random()
title =#CleverSat_CleverSatConstellation_DATA2 // Must have a satellite that falls within pre-defined orbital parameters
}
//define the maximum deviation we'd be willing to accept when forming a constellation.
DATA
{
type = double
orbitalParameter = Prestige() == Trivial ? 1000000 : Prestige() == Significant ? 2000000 : 5000000
targetApMin = @groupSat.Orbit().Apoapsis() - @orbitalParameter
targetApMax = @groupSat.Orbit().Apoapsis() + @orbitalParameter
targetPeMin = @groupSat.Orbit().Periapsis() - @orbitalParameter
targetPeMax = @groupSat.Orbit().Periapsis() + @orbitalParameter
targetInMin = @groupSat.Orbit().Inclination() - 10
targetInMax = @groupSat.Orbit().Inclination() + 10
targetLanMin = @groupSat.Orbit().LAN() - 100
targetLanMax = @groupSat.Orbit().LAN() + 100
hidden = true
}
//find a vessel that is within the parameters specified above.
DATA
{
type = List<VesselIdentifier>
validTarget = $SatList.Add(Target).Where(t => Vessel(t).IsOrbiting() && Vessel(t).Orbit().Apoapsis() > @/targetApMin && Vessel(t).Orbit().Apoapsis() < @/targetApMax && Vessel(t).Orbit().Periapsis() > @/targetPeMin && Vessel(t).Orbit().Periapsis() < @/targetPeMax && Vessel(t).Orbit().Inclination() > @/targetInMin && Vessel(t).Orbit().Inclination() < @/targetInMax && Vessel(t).CelestialBody() == @/targetBody1 && Vessel(t).Orbit().Apoapsis()[email protected]().Apoapsis() && Vessel(t).Orbit().LAN() > @/targetLanMin && Vessel(t).Orbit().LAN() < @/targetLanMax)
hidden = true
}
//pick one of those at random
DATA
{
type = Vessel
uniquenessCheck = GROUP_ACTIVE
targetSat = @validTarget.SelectUnique()
title = #CleverSat_CleverSatConstellation_DATA // Must have a satellite that is close enough to form a constellation.
}
DATA
{
type = CelestialBody
targetBody1 = @/groupSat.CelestialBody()
hidden = true
}
//check the target is not already part of a Constellation
DATA
{
type = List<VesselIdentifier>
requiredValue = false
validConstellation = $ConstellationList.Add(Valid).Where(v => Vessel(v) == @targetSat)
hidden = true
}
//this should just grab the "base" satellite and copy it's orbit.
BEHAVIOUR
{
name = OrbitGenerator
type = OrbitGenerator
FIXED_ORBIT
{
ORBIT = @/groupSat.Orbit()
}
}
PARAMETER
{
name = VesselParameterGroup
type = VesselParameterGroup
vessel = @/targetSat
defineList = ConstellationList
PARAMETER
{
name = Orbit
type = ReachSpecificOrbit
index = 0
deviationWindow = Prestige() == Trivial ? 10.0 : Prestige() == Significant ? 7.0 : 5.0
}
}
REQUIREMENT
{
name = GroupCheck
type = Expression
expression = (((@/groupSat.Orbit().Apoapsis()-@/targetSat.Orbit().Apoapsis())>1000000) || ((@/targetSat.Orbit().Apoapsis()-@/targetSat.Orbit().Apoapsis())>1000000))
title = #CleverSat_CleverSatConstellation_Req // Double check that the target still meets the requirements.
}
}