Skip to content

Commit 6a40b20

Browse files
authored
Fallback evaluators fixed (#153)
1 parent db27acb commit 6a40b20

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

RasterPropMonitor/Core/RPMVCEvaluators.cs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ internal double FallbackEvaluateDragForce()
6767
Vector3 bodyLift = p.transform.rotation * (p.bodyLiftScalar * p.DragCubes.LiftForce);
6868
bodyLift = Vector3.ProjectOnPlane(bodyLift, -p.dragVectorDir);
6969
pureLiftV += bodyLift;
70+
}
7071

71-
for (int m = 0; m < p.Modules.Count; m++)
72+
for (int m = 0; m < p.Modules.Count; m++)
73+
{
74+
PartModule pm = p.Modules[m];
75+
if (pm.isEnabled && pm is ModuleLiftingSurface)
7276
{
73-
PartModule pm = p.Modules[m];
74-
if (pm.isEnabled && pm is ModuleLiftingSurface)
77+
ModuleLiftingSurface liftingSurface = pm as ModuleLiftingSurface;
78+
if (!p.ShieldedFromAirstream)
7579
{
76-
ModuleLiftingSurface liftingSurface = pm as ModuleLiftingSurface;
77-
if (!p.ShieldedFromAirstream)
78-
{
79-
pureLiftV += liftingSurface.liftForce;
80-
pureDragV += liftingSurface.dragForce;
81-
}
80+
pureLiftV += liftingSurface.liftForce;
81+
pureDragV += liftingSurface.dragForce;
8282
}
8383
}
8484
}
@@ -129,18 +129,18 @@ internal double FallbackEvaluateLiftForce()
129129
Vector3 bodyLift = p.transform.rotation * (p.bodyLiftScalar * p.DragCubes.LiftForce);
130130
bodyLift = Vector3.ProjectOnPlane(bodyLift, -p.dragVectorDir);
131131
pureLiftV += bodyLift;
132+
}
132133

133-
for (int m = 0; m < p.Modules.Count; m++)
134+
for (int m = 0; m < p.Modules.Count; m++)
135+
{
136+
PartModule pm = p.Modules[m];
137+
if (pm.isEnabled && pm is ModuleLiftingSurface)
134138
{
135-
PartModule pm = p.Modules[m];
136-
if (pm.isEnabled && pm is ModuleLiftingSurface)
139+
ModuleLiftingSurface liftingSurface = pm as ModuleLiftingSurface;
140+
if (!p.ShieldedFromAirstream)
137141
{
138-
ModuleLiftingSurface liftingSurface = pm as ModuleLiftingSurface;
139-
if (!p.ShieldedFromAirstream)
140-
{
141-
pureLiftV += liftingSurface.liftForce;
142-
pureDragV += liftingSurface.dragForce;
143-
}
142+
pureLiftV += liftingSurface.liftForce;
143+
pureDragV += liftingSurface.dragForce;
144144
}
145145
}
146146
}
@@ -175,23 +175,23 @@ internal double FallbackEvaluateTerminalVelocity()
175175
Vector3 bodyLift = p.transform.rotation * (p.bodyLiftScalar * p.DragCubes.LiftForce);
176176
bodyLift = Vector3.ProjectOnPlane(bodyLift, -p.dragVectorDir);
177177
pureLiftV += bodyLift;
178+
}
178179

179-
for (int m = 0; m < p.Modules.Count; m++)
180+
for (int m = 0; m < p.Modules.Count; m++)
181+
{
182+
PartModule pm = p.Modules[m];
183+
if (!pm.isEnabled)
180184
{
181-
PartModule pm = p.Modules[m];
182-
if (!pm.isEnabled)
183-
{
184-
continue;
185-
}
185+
continue;
186+
}
186187

187-
if (pm is ModuleLiftingSurface)
188-
{
189-
ModuleLiftingSurface liftingSurface = (ModuleLiftingSurface)pm;
190-
if (p.ShieldedFromAirstream)
191-
continue;
192-
pureLiftV += liftingSurface.liftForce;
193-
pureDragV += liftingSurface.dragForce;
194-
}
188+
if (pm is ModuleLiftingSurface)
189+
{
190+
ModuleLiftingSurface liftingSurface = (ModuleLiftingSurface)pm;
191+
if (p.ShieldedFromAirstream)
192+
continue;
193+
pureLiftV += liftingSurface.liftForce;
194+
pureDragV += liftingSurface.dragForce;
195195
}
196196
}
197197
}

0 commit comments

Comments
 (0)