|
3 | 3 | using System.Linq; |
4 | 4 | using System.Text; |
5 | 5 | using TestFlightAPI; |
| 6 | +using ModuleWheels; |
6 | 7 |
|
7 | 8 | namespace TestFlight.Flight_Recorders |
8 | 9 | { |
9 | 10 | public class FlightDataRecorder_Wheels : FlightDataRecorderBase |
10 | 11 | { |
11 | | - private ModuleWheel wheel; |
| 12 | + private ModuleWheelSteering wheelSteering; |
| 13 | + private ModuleWheelBrakes wheelBrakes; |
| 14 | + private ModuleWheelBase wheel; |
| 15 | + private ModuleWheelMotor wheelMotor; |
12 | 16 | public override void OnStart(PartModule.StartState state) |
13 | 17 | { |
14 | 18 | base.OnStart(state); |
15 | | - wheel = base.part.FindModuleImplementing<ModuleWheel>(); |
| 19 | + wheel = base.part.FindModuleImplementing<ModuleWheelBase>(); |
| 20 | + wheelSteering = base.part.FindModuleImplementing<ModuleWheelSteering>(); |
| 21 | + wheelBrakes = base.part.FindModuleImplementing<ModuleWheelBrakes>(); |
| 22 | + wheelMotor = base.part.FindModuleImplementing<ModuleWheelMotor>(); |
16 | 23 | } |
17 | 24 | public override void OnAwake() |
18 | 25 | { |
19 | 26 | base.OnAwake(); |
20 | 27 | } |
21 | 28 | public override bool IsPartOperating() |
22 | 29 | { |
23 | | - bool isGrounded = false; |
24 | | - for (int i = 0; i < this.wheel.wheels.Count; i++) |
25 | | - { |
26 | | - if (this.wheel.wheels[i].whCollider.isGrounded) |
27 | | - { |
28 | | - isGrounded = true; |
29 | | - break; |
30 | | - } |
31 | | - } |
| 30 | + bool isGrounded = wheel.isGrounded; |
| 31 | + |
32 | 32 | if (!isGrounded) |
33 | 33 | { |
34 | 34 | return false; |
35 | 35 | } |
36 | 36 |
|
37 | 37 | if ((float)base.vessel.horizontalSrfSpeed > 0f) |
38 | 38 | { |
39 | | - if (!this.wheel.steeringLocked && Math.Abs(this.wheel.steeringInput) > 0f) |
| 39 | + if (this.wheelSteering.steeringEnabled && Math.Abs(this.wheelSteering.steeringInput) > 0f) |
40 | 40 | { |
41 | 41 | return true; |
42 | 42 | } |
43 | | - if (this.wheel.brakesEngaged) |
| 43 | + if (this.wheelBrakes.brakeInput < 0f) |
44 | 44 | { |
45 | 45 | return true; |
46 | 46 | } |
47 | | - if (wheel.motorEnabled && Math.Abs(wheel.throttleInput) > 0f) |
| 47 | + if (wheelMotor.motorEnabled && Math.Abs(wheelMotor.driveOutput) > 0f) |
48 | 48 | { |
49 | 49 | return true; |
50 | 50 | } |
|
0 commit comments