var linearInput = Vector2.Zero;
var brakeInput = 0f;
var angularInput = 0f;
+ var linearCount = 0;
+ var brakeCount = 0;
+ var angularCount = 0;
foreach (var (pilotUid, pilot, _, consoleXform) in pilots)
{
if (brakes > 0f)
{
brakeInput += brakes;
+ brakeCount++;
}
if (strafe.Length() > 0f)
{
var offsetRotation = consoleXform.LocalRotation;
linearInput += offsetRotation.RotateVec(strafe);
+ linearCount++;
}
if (rotation != 0f)
{
angularInput += rotation;
+ angularCount++;
}
}
- var count = pilots.Count;
- linearInput /= count;
- angularInput /= count;
- brakeInput /= count;
+ // Don't slow down the shuttle if there's someone just looking at the console
+ linearInput /= Math.Max(1, linearCount);
+ angularInput /= Math.Max(1, angularCount);
+ brakeInput /= Math.Max(1, brakeCount);
// Handle shuttle movement
if (brakeInput > 0f)