@@ -25,6 +25,8 @@ public class TestFlightFailureBase : PartModule, ITestFlightFailure
2525 public float duRepair = 0f ;
2626 [ KSPField ]
2727 public bool oneShot = false ;
28+ [ KSPField ]
29+ public bool awardDuInPreLaunch = true ;
2830
2931 [ KSPField ( isPersistant = true ) ]
3032 public bool failed ;
@@ -98,7 +100,7 @@ public virtual void DoFailure()
98100 {
99101 string failMessage ;
100102 var failTime = KSPUtil . PrintTimeCompact ( ( int ) Math . Floor ( this . vessel . missionTime ) , false ) ;
101- if ( ! previouslyFailed )
103+ if ( ! previouslyFailed && ( awardDuInPreLaunch || vessel . situation != Vessel . Situations . PRELAUNCH ) )
102104 {
103105 core . ModifyFlightData ( duFail , true ) ;
104106 failMessage = $ "[{ failTime } ] { core . Title } has failed with { failureTitle } , but this failure has given us valuable data";
@@ -127,7 +129,7 @@ public virtual float DoRepair()
127129 {
128130 Failed = false ;
129131 ITestFlightCore core = TestFlightUtil . GetCore ( this . part , Configuration ) ;
130- if ( core != null )
132+ if ( core != null && ( awardDuInPreLaunch || vessel . situation != Vessel . Situations . PRELAUNCH ) )
131133 core . ModifyFlightData ( duRepair , true ) ;
132134 return 0 ;
133135 }
@@ -160,6 +162,7 @@ public virtual void SetActiveConfig(string alias)
160162 currentConfig . TryGetValue ( "duFail" , ref duFail ) ;
161163 currentConfig . TryGetValue ( "duRepair" , ref duRepair ) ;
162164 currentConfig . TryGetValue ( "oneShot" , ref oneShot ) ;
165+ currentConfig . TryGetValue ( "awardDuInPreLaunch" , ref awardDuInPreLaunch ) ;
163166 }
164167
165168 public virtual List < string > GetTestFlightInfo ( ) => new List < string > ( ) ;
0 commit comments