forked from KSP-RO/TestFlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlightDataRecorder_Resources.cs
45 lines (35 loc) · 1.14 KB
/
FlightDataRecorder_Resources.cs
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
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_Resources : FlightDataRecorderBase
{
[KSPField]
public double emptyThreshold = 0.1;
public override void OnAwake()
{
base.OnAwake();
}
public override bool IsRecordingFlightData()
{
bool isRecording = false;
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 (resource.amount > emptyThreshold)
return true;
}
return isRecording;
}
}
}