Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pehvbot committed Dec 4, 2021
0 parents commit 5c793fc
Show file tree
Hide file tree
Showing 34 changed files with 335 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
44 changes: 44 additions & 0 deletions FlightDataRecorder_LRAvionics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

using TestFlightAPI;

namespace TestFlight
{

// Method for determing distance from kerbal to part
// float kerbalDistanceToPart = Vector3.Distance(kerbal.transform.position, targetPart.collider.ClosestPointOnBounds(kerbal.transform.position));
public class FlightDataRecorder_LRAvionics : FlightDataRecorderBase
{
[KSPField]
public double emptyThreshold = 0.1;
[KSPField]
public string resourceName = "";

public override void OnAwake()
{
base.OnAwake();
}

public override bool IsRecordingFlightData()
{
if (!isEnabled)
return false;

//if (this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
// return false;

PartModuleList mods = this.part.Modules;
ModuleCommand mod = (ModuleCommand)mods.GetModule("ModuleCommand");
//hibernating protects the probe
if(!mod.IsHibernating)
if (mod.ModuleState == ModuleCommand.ModuleControlState.Nominal || mod.ModuleState == ModuleCommand.ModuleControlState.PartialProbe)
return true;

return false;
}
}
}
54 changes: 54 additions & 0 deletions FlightDataRecorder_LRResources.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

using TestFlightAPI;

namespace TestFlight
{

// Method for determing distance from kerbal to part
// float kerbalDistanceToPart = Vector3.Distance(kerbal.transform.position, targetPart.collider.ClosestPointOnBounds(kerbal.transform.position));
public class FlightDataRecorder_LRResources : FlightDataRecorderBase
{
[KSPField]
public double emptyThreshold = 0.1;
[KSPField]
public string resourceName = "";

public override void OnAwake()
{
base.OnAwake();
}

public override bool IsRecordingFlightData()
{
bool isRecording = true;

if (!isEnabled)
return false;

if (this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
return false;

List<PartResource> partResources = this.part.Resources.ToList();
foreach (PartResource resource in partResources)
{
if (resourceName == "ALL")
{
if (resource.amount <= emptyThreshold)
isRecording = false;
}
else if (resourceName == "" || resourceName == resource.resourceName)
{
isRecording = false;
if (resource.amount > emptyThreshold)
return true;
}
}
return isRecording;
}
}
}
79 changes: 79 additions & 0 deletions FlightDataRecorder_LRTanks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

using TestFlightAPI;

namespace TestFlight
{

// Method for determing distance from kerbal to part
// float kerbalDistanceToPart = Vector3.Distance(kerbal.transform.position, targetPart.collider.ClosestPointOnBounds(kerbal.transform.position));
public class FlightDataRecorder_LRTanks : FlightDataRecorderBase
{
[KSPField]
public double emptyThreshold = 0.1;
[KSPField]
public string resourceNames = "";

public override void OnAwake()
{
base.OnAwake();
}

public override bool IsRecordingFlightData()
{
if (!isEnabled)
return false;

if (this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
return false;

bool isRecording = false;

//strip spaces
resourceNames = String.Concat(resourceNames.Where(c => !Char.IsWhiteSpace(c)));
string[] names = resourceNames.Split(',');

List<PartResource> partResources = this.part.Resources.ToList();

if (resourceNames.ToUpper() == "ALL")
{
isRecording = true;
foreach (PartResource resource in partResources)
{
if (resource.amount < emptyThreshold || !resource.flowState)
isRecording = false;
}
}
else if(resourceNames == "")
{
foreach (PartResource resource in partResources)
{
if (resource.amount >= emptyThreshold && resource.flowState)
isRecording = true;
}
}
else
{
isRecording = true;

foreach (PartResource resource in partResources)
{
bool hasName = false;
foreach (string name in names)
{
if (resource.resourceName == name)
hasName = true;
}
if (!hasName || resource.amount < emptyThreshold|| !resource.flowState)
isRecording = false;
}
}

return isRecording;
}
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 pehvbot

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 57 additions & 0 deletions LRTF.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CB940433-173F-4662-9AAB-1235E7073DDD}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>LRTF</RootNamespace>
<AssemblyName>LRTF</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\dlls_1_12_2\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\dlls_1_12_2\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="TestFlightAPI">
<HintPath>..\dlls_1_12_2\TestFlightAPI.dll</HintPath>
</Reference>
<Reference Include="TestFlightCore">
<HintPath>..\dlls_1_12_2\TestFlightCore.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\dlls_1_12_2\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\dlls_1_12_2\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FlightDataRecorder_LRResources.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="FlightDataRecorder_LRTanks.cs" />
<Compile Include="FlightDataRecorder_LRAvionics.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
27 changes: 27 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("LRTF")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("${AuthorCopyright}")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
[assembly: KSPAssemblyDependency("TestFlightAPI", 1, 0)]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# LRTF
Less Real Test Flight: TestFlight for stock KSP
Binary file added bin/.DS_Store
Binary file not shown.
Binary file added bin/Debug/.DS_Store
Binary file not shown.
Binary file added bin/Debug/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file added bin/Debug/Assembly-CSharp.dll
Binary file not shown.
Binary file added bin/Debug/LRTF.pdb
Binary file not shown.
Binary file added bin/Debug/TestFlightAPI.dll
Binary file not shown.
Binary file added bin/Debug/TestFlightCore.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.AnimationModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.CoreModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.IMGUIModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.InputLegacyModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.JSONSerializeModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.PhysicsModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.TextRenderingModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UI.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UIModule.dll
Binary file not shown.
Binary file not shown.
Binary file added bin/Debug/UnityEngine.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
Binary file added obj/Debug/LRTF.csproj.AssemblyReference.cache
Binary file not shown.
Empty file.
1 change: 1 addition & 0 deletions obj/Debug/LRTF.csproj.CoreCompileInputs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cbb18e671488c66969291190467a5dced89955a9
44 changes: 44 additions & 0 deletions obj/Debug/LRTF.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/LRTF.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/LRTF.pdb
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/Assembly-CSharp-firstpass.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/Assembly-CSharp.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/TestFlightAPI.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/TestFlightCore.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.CoreModule.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.PhysicsModule.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.UI.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.AnimationModule.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.IMGUIModule.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.UnityWebRequestModule.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.TextRenderingModule.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.UIModule.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.InputLegacyModule.dll
/Users/haslam/Projects/LRTF/LRTF/bin/Debug/UnityEngine.JSONSerializeModule.dll
/Users/haslam/Projects/LRTF/LRTF/obj/Debug/LRTF.csproj.AssemblyReference.cache
/Users/haslam/Projects/LRTF/LRTF/obj/Debug/LRTF.csproj.CoreCompileInputs.cache
/Users/haslam/Projects/LRTF/LRTF/obj/Debug/LRTF.csproj.CopyComplete
/Users/haslam/Projects/LRTF/LRTF/obj/Debug/LRTF.dll
/Users/haslam/Projects/LRTF/LRTF/obj/Debug/LRTF.pdb
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/LRTF.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/LRTF.pdb
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/Assembly-CSharp-firstpass.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/Assembly-CSharp.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/TestFlightAPI.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/TestFlightCore.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.CoreModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.UI.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.IMGUIModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.PhysicsModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.UIModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.InputLegacyModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.AnimationModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.UnityWebRequestModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.TextRenderingModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/bin/Debug/UnityEngine.JSONSerializeModule.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/obj/Debug/LRTF.csproj.CoreCompileInputs.cache
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/obj/Debug/LRTF.csproj.CopyComplete
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/obj/Debug/LRTF.dll
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/obj/Debug/LRTF.pdb
/Users/haslam/Google Drive/kerbal/LRTF/LRTF/obj/Debug/LRTF.csproj.AssemblyReference.cache
Binary file added obj/Debug/LRTF.dll
Binary file not shown.
Binary file added obj/Debug/LRTF.pdb
Binary file not shown.

0 comments on commit 5c793fc

Please sign in to comment.