Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Aug 19, 2023
2 parents 37ca950 + 27834ee commit 41c3d96
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 96 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 2.7


- name: Build metadata
shell: bash
run: |
Expand Down
9 changes: 4 additions & 5 deletions TestFlight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestFlight</RootNamespace>
<AssemblyName>TestFlight</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ReleaseVersion>0.4.0</ReleaseVersion>
<TargetFrameworkProfile />
Expand Down Expand Up @@ -44,8 +44,8 @@
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>bin\Release\Assembly-CSharp.dll</HintPath>
<Reference Include="Assembly-CSharp">
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -59,8 +59,7 @@
<Reference Include="UnityEngine">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine.CoreModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
Expand Down
8 changes: 4 additions & 4 deletions TestFlightAPI/TestFlightAPI/EngineModuleWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,16 @@ public void SetFuelFlowMult(float multiplier)
{
if (engineType == EngineModuleType.UNKNOWN)
return;
moduleEngine.multIsp = multiplier;

moduleEngine.multFlow = multiplier;
}

public void SetFuelIspMult(float multiplier)
{
if (engineType == EngineModuleType.UNKNOWN)
return;
moduleEngine.multFlow = multiplier;

moduleEngine.multIsp = multiplier;
}

public void SetIgnitionCount(int numIgnitions)
Expand Down
14 changes: 2 additions & 12 deletions TestFlightAPI/TestFlightAPI/TestFlightAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<OutputType>Library</OutputType>
<RootNamespace>TestFlightAPI</RootNamespace>
<AssemblyName>TestFlightAPI</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ReleaseVersion>0.4.0</ReleaseVersion>
<TargetFrameworkProfile />
<LangVersion>6</LangVersion>
Expand Down Expand Up @@ -49,22 +49,12 @@
<Reference Include="UnityEngine">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine.CoreModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
7 changes: 5 additions & 2 deletions TestFlightAPI/TestFlightAPI/TestFlightFailure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class TestFlightFailureBase : PartModule, ITestFlightFailure
public float duRepair = 0f;
[KSPField]
public bool oneShot = false;
[KSPField]
public bool awardDuInPreLaunch = true;

[KSPField(isPersistant=true)]
public bool failed;
Expand Down Expand Up @@ -98,7 +100,7 @@ public virtual void DoFailure()
{
string failMessage;
var failTime = KSPUtil.PrintTimeCompact((int)Math.Floor(this.vessel.missionTime), false);
if (!previouslyFailed)
if (!previouslyFailed && (awardDuInPreLaunch || vessel.situation != Vessel.Situations.PRELAUNCH))
{
core.ModifyFlightData(duFail, true);
failMessage = $"[{failTime}] {core.Title} has failed with {failureTitle}, but this failure has given us valuable data";
Expand Down Expand Up @@ -127,7 +129,7 @@ public virtual float DoRepair()
{
Failed = false;
ITestFlightCore core = TestFlightUtil.GetCore(this.part, Configuration);
if (core != null)
if (core != null && (awardDuInPreLaunch || vessel.situation != Vessel.Situations.PRELAUNCH))
core.ModifyFlightData(duRepair, true);
return 0;
}
Expand Down Expand Up @@ -160,6 +162,7 @@ public virtual void SetActiveConfig(string alias)
currentConfig.TryGetValue("duFail", ref duFail);
currentConfig.TryGetValue("duRepair", ref duRepair);
currentConfig.TryGetValue("oneShot", ref oneShot);
currentConfig.TryGetValue("awardDuInPreLaunch", ref awardDuInPreLaunch);
}

public virtual List<string> GetTestFlightInfo() => new List<string>();
Expand Down
14 changes: 2 additions & 12 deletions TestFlightContracts/TestFlightContracts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<OutputType>Library</OutputType>
<RootNamespace>TestFlightContracts</RootNamespace>
<AssemblyName>TestFlightContracts</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ReleaseVersion>0.4.0</ReleaseVersion>
<TargetFrameworkProfile />
<LangVersion>6</LangVersion>
Expand Down Expand Up @@ -48,22 +48,12 @@
<Reference Include="ContractConfigurator">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\bin\Release\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="UnityEngine.CoreModule">
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\bin\Release\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\bin\Release\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
62 changes: 11 additions & 51 deletions TestFlightCore/TestFlightCore/TestFlightCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<OutputType>Library</OutputType>
<RootNamespace>TestFlightCore</RootNamespace>
<AssemblyName>TestFlightCore</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ReleaseVersion>0.4.0</ReleaseVersion>
<TargetFrameworkProfile />
<LangVersion>6</LangVersion>
Expand Down Expand Up @@ -39,83 +39,43 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="Assembly-CSharp">
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine">
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="KSPAssets">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AnimationModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.AnimationModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine.AnimationModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine.CoreModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.ImageConversionModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine.ImageConversionModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine.IMGUIModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine.InputLegacyModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.TextRenderingModule.dll</HintPath>
<Reference Include="UnityEngine.TextRenderingModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine.UIModule">
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\bin\Release\UnityEngine.UIModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
10 changes: 7 additions & 3 deletions TestFlightFailure_IgnitionFail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ public override void DoFailure()
ITestFlightCore core = TestFlightUtil.GetCore(this.part, Configuration);
if (core != null)
{
core.ModifyFlightData(duFail, true);
if (awardDuInPreLaunch || vessel.situation != Vessel.Situations.PRELAUNCH)
{
core.ModifyFlightData(duFail, true);
}

string met = KSPUtil.PrintTimeCompact((int)Math.Floor(this.vessel.missionTime), false);
if (dynPressurePenalties)
{
Expand All @@ -291,9 +295,9 @@ public override void DoFailure()
multiplier = 1f;
}

if (multiplier > float.Epsilon)
if (multiplier < 0.99)
{
FlightLogger.eventLog.Add($"[{met}] {core.Title} failed: Ignition Failure. {(float)(part.dynamicPressurekPa * 1000d)}Pa dynamic pressure caused a {(1f-multiplier) * 100f}% reduction in normal ignition reliability.");
FlightLogger.eventLog.Add($"[{met}] {core.Title} failed: Ignition Failure. {(float)(part.dynamicPressurekPa * 1000d)}Pa dynamic pressure caused a {(1f-multiplier) * 100f:0.#}% reduction in normal ignition reliability.");
}
else
{
Expand Down
6 changes: 2 additions & 4 deletions TestFlightSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public class TestFlightGameSettings : GameParameters.CustomParameterNode
public override int SectionOrder { get { return 1; } }
public override bool HasPresets { get { return true; } }

[GameParameters.CustomParameterUI("Pre-Launch Ignition Failures Enabled?", toolTip = "Set to enable ignition failures on the Launch Pad.")]
[GameParameters.CustomParameterUI("Pre-Launch Ignition Failures", toolTip = "Set to enable ignition failures on the Launch Pad.")]
public bool preLaunchFailures = true;

[GameParameters.CustomParameterUI("Penalty For High Dynamic Pressure Enabled?", toolTip = "Whether engine ignition chance will suffer a penalty based on dynamic pressure.")]
[GameParameters.CustomParameterUI("Ignition Chance Penalty For High Dynamic Pressure", toolTip = "Whether engine ignition chance will suffer a penalty based on dynamic pressure.")]
public bool dynPressurePenalties = true;

public override void SetDifficultyPreset(GameParameters.Preset preset)
Expand All @@ -34,11 +34,9 @@ public override void SetDifficultyPreset(GameParameters.Preset preset)
case GameParameters.Preset.Normal:
case GameParameters.Preset.Moderate:
preLaunchFailures = false;
dynPressurePenalties = false;
break;
case GameParameters.Preset.Hard:
preLaunchFailures = true;
dynPressurePenalties = true;
break;
}
}
Expand Down

0 comments on commit 41c3d96

Please sign in to comment.