Skip to content

Commit

Permalink
Add New Sounding Rockets Contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
pap1723 committed Jul 31, 2017
1 parent 4b4bb9b commit 59ef741
Show file tree
Hide file tree
Showing 9 changed files with 1,192 additions and 183 deletions.
1 change: 0 additions & 1 deletion GameData/RP-0/Contracts/Groups.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ CONTRACT_GROUP
{
name = SoundingRockets
displayName = Sounding Rocket Contracts
maxSimultaneous = 2
minVersion = 1.22.2
sortKey = 20
}
Expand Down
25 changes: 25 additions & 0 deletions GameData/RP-0/Contracts/RP0_Contract_Resources.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
RESOURCE_DEFINITION
{
name = SoundingPayload
density = 0.0002
unitCost = 0.05
flowMode = ALL_VESSEL
transfer = PUMP
isTweakable = true
isVisible = true
volume = 1
}

@TANK_DEFINITION[Fuselage|ServiceModule]:FOR[RP-0]:NEEDS[RealFuels]
{

TANK
{
name = SoundingPayload
mass = 0
utilization = 1
fillable = True
amount = 0.0
maxAmount = 0.0
}
}
48 changes: 45 additions & 3 deletions GameData/RP-0/Contracts/Records/AltRecord.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,30 @@ CONTRACT_TYPE
maxSimultaneous = 1

// Contract rewards
rewardFunds = 200.0 + @uncrewedTargetAltitude*0.005
rewardReputation = 4.0 + @uncrewedTargetAltitude*0.00001
rewardFunds = @rewardFundsInternal
rewardReputation = @rewardReputationInternal

DATA
{
type = List<float>

//NOTE: SoundingRocket contracts refer into this list by index, to track reached altitude. If you change this list, you must also update them.
soundingAlts = [ 10000, 20000, 30000, 40000, 50000, 60000, 80000, 100000, 120000, 140000, 160000, 180000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000 ]
soundingAlts = [ 10000, 20000, 30000, 40000, 50000, 60000, 80000, 100000, 120000, 140000, 160000, 180000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000 ]
}

DATA
{
type = float
rewardFundsInternal = 200.0 + Min(@uncrewedTargetAltitude*0.005, 5000 + @uncrewedTargetAltitude*0.0005)
}


DATA
{
type = float
rewardReputationInternal = 3.0 + Min(@uncrewedTargetAltitude*0.00001, 10 + @uncrewedTargetAltitude*0.000001)
}

// Break this into two steps to work around ContractConfigurator#260
DATA
{
Expand All @@ -58,6 +71,13 @@ CONTRACT_TYPE

uncrewedTargetAltitudeKM = @uncrewedTargetAltitude*0.001
}

DATA
{
type = float
newMaxSoundingDifficulty = Max($RP0_SoundingDifficulty, @uncrewedTargetAltitudeKM * 60)

}

PARAMETER
{
Expand All @@ -77,7 +97,29 @@ CONTRACT_TYPE
RP0_SoundingAltitudeIndex = RP0_SoundingAltitudeIndex + 1
}
}

BEHAVIOUR
{
name = SetMaxSoundingDifficulty
type = Expression

CONTRACT_COMPLETED_SUCCESS
{
RP0_SoundingDifficulty = @/newMaxSoundingDifficulty
}
}

BEHAVIOUR
{
name = SetMaxSoundingAltitude
type = Expression

CONTRACT_COMPLETED_SUCCESS
{
RP0_SoundingMaxAltitudeKM = @/uncrewedTargetAltitudeKM
}
}

REQUIREMENT
{
type = Expression
Expand Down
267 changes: 267 additions & 0 deletions GameData/RP-0/Contracts/Sounding Rockets/SoundingAltitude.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
CONTRACT_TYPE
{
name = SoundingRocketAltitude
group = SoundingRockets

title = Sounding Rocket (Altitude)

description = Design, build and launch a sounding rocket to reach a new altitude of @/targetAltitudeKM.Print() km.
genericDescription = Test a sounding rocket that can reach the specified altitude. This contract will stretch your capabilites and enable harder contracts.

synopsis = Launch a sounding rocket test to @/targetAltitudeKM.Print() km.

completedMessage = Congratulations on a successful launch! The rocket reached the specified altitude

minExpiry = 1.0
maxExpiry = 30.0
deadline = 90
cancellable = true
declinable = true
autoAccept = false

targetBody = HomeWorld()

maxCompletions = 0
maxSimultaneous = 1
prestige = Trivial

// reward block
advanceFunds = 400.0 + @/launchCost * 3
rewardFunds = @advanceFunds + 1000
failureFunds = @advanceFunds



DATA
{
type = float
soundingMaxAlt = $RP0_SoundingMaxAltitudeKM
}

DATA
{
type = float
soundingDifficulty = $RP0_SoundingDifficulty
}

DATA
{
type = float
maxDifficulty = @soundingDifficulty > (60 * @targetAltitudeKM) ? @soundingDifficulty : (60 * @targetAltitudeKM )

}

DATA
{
type = int
altitudeRoundingFactor = int(@soundingMaxAlt <= 100 ? 5 : (@soundingMaxAlt <= 500 ? 10 : (@soundingMaxAlt <= 1500 ? 100 : 250)))
}

DATA
{
type = int
targetAltitudeKMInternal = Round(float(@soundingMaxAlt * 1.2), @altitudeRoundingFactor)
}


DATA
{ //extend the max possible height by a factor based off the current max
type = int
targetAltitudeKM = int( Min(6000, @targetAltitudeKMInternal))
}

DATA
{ //Counts our techs and divides by 100
type = float
techVals = UnlockedTech().Count() /100
title = reward decreasing multiplier for having more tech
}

DATA:NEEDS[TestFlight]
{ //reliability factor for rewards - should be set if test flight is loaded
type = float
reliabiliyFactor = 1.25 - Min( 0.2, @techVals)
title = exponent on launches for TF reliability
}

DATA:NEEDS[!TestFlight]
{ //reliability factor for rewards if test flight is not installed
type = float
reliabiliyFactor = 1
title = exponent on launches for TF reliability
}

DATA
{ //reduces the reward as player tech improves (marginally) to account for better engines/tanks
type = float
techFactor = Max(0.7, 1 - @techVals)
title = reward decreasing multiplier for having more tech
}


DATA
{ // Minimum possible launch cost, as determined by Maxsimal from play experience
type = float
launchCost = 11 + @/techFactor * @/targetAltitudeKM / 10
title = Rough minimum expected launch cost
}

REQUIREMENT
{
name = All of the below most be completed
type = All

REQUIREMENT
{
name = AltitudeRecord100k // Karman line
type = AltitudeRecord
minAltitude = 100000
title = Must have reached 100 km
}

REQUIREMENT
{
name = Not over max altitude // 6000 km
type = Expression
expression = $RP0_SoundingMaxAltitudeKM < 6000
title = Must not have reached 6000 km or more before
}

REQUIREMENT
{
name = AcceptContract
type = AcceptContract
contractType = SoundingRocketDifficult
title = Have not accepted @contractType Contract
invertRequirement = true
}

REQUIREMENT
{
name = AcceptContract
type = AcceptContract
contractType = SoundingRocketIntermediate
title = Have not accepted @contractType Contract
invertRequirement = true
}

REQUIREMENT
{
name = AcceptContract
type = AcceptContract
contractType = SoundingRocketEasy
title = Have not accepted @contractType Contract
invertRequirement = true
}


REQUIREMENT
{
name = CompleteSoundingDifficult
type = CompleteContract

contractType = SoundingRocketDifficult

minCount = 0

// complete before we can attempt again.
cooldownDuration = 4d
}

REQUIREMENT
{
name = CompleteSoundingIntermediate
type = CompleteContract

contractType = SoundingRocketIntermediate

minCount = 0

// complete before we can attempt again.
cooldownDuration = 4d
}

REQUIREMENT
{
name = CompleteSoundingEasy
type = CompleteContract

contractType = SoundingRocketEasy

minCount = 0

// complete before we can attempt again.
cooldownDuration = 4d
}

REQUIREMENT
{
name = CompleteSoundingAltitude
type = CompleteContract

contractType = SoundingRocketAltitude

minCount = 0

// complete before we can attempt again.
cooldownDuration = 4d
}

}


BEHAVIOUR
{//set the new difficulty
name = SetMaxSoundingDifficulty
type = Expression

CONTRACT_COMPLETED_SUCCESS
{
RP0_SoundingDifficulty = @/maxDifficulty
}
}


BEHAVIOUR
{ //reset the max height if it grew
name = SetRP0_SoundingMaxAltitudeKM
type = Expression

CONTRACT_COMPLETED_SUCCESS
{
RP0_SoundingMaxAltitudeKM = @/targetAltitudeKM
}
}

PARAMETER
{
name = VesselGroup
type = VesselParameterGroup

title = Reach @/targetAltitudeKM.Print() km.

PARAMETER
{
name = NewVessel
type = NewVessel
title = Launch a New Vessel
hideChildren = true
}
PARAMETER
{
name = Crewmembers
type = HasCrew
minCrew = 0
maxCrew = 0
title = Uncrewed
hideChildren = true
}

PARAMETER
{
name = ReachAlt
type = ReachState
minAltitude = @/targetAltitudeKM * 1000
}
}
}

0 comments on commit 59ef741

Please sign in to comment.