Fixed floorSpeedMultiplier being squared

This commit is contained in:
Anuken
2021-08-22 15:53:07 -04:00
parent 3ba2498815
commit 5cc50b0ff3
8 changed files with 13 additions and 10 deletions

View File

@@ -104,15 +104,18 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
return type.hasWeapons();
}
/** @return speed with boost & floor multipliers factored in. */
public float speed(){
float strafePenalty = isGrounded() || !isPlayer() ? 1f : Mathf.lerp(1f, type.strafePenalty, Angles.angleDist(vel().angle(), rotation) / 180f);
float boost = Mathf.lerp(1f, type.canBoost ? type.boostMultiplier : 1f, elevation);
//limit speed to minimum formation speed to preserve formation
return (isCommanding() ? minFormationSpeed * 0.98f : type.speed) * strafePenalty;
return (isCommanding() ? minFormationSpeed * 0.98f : type.speed) * strafePenalty * boost * floorSpeedMultiplier();
}
/** @return speed with boost multipliers factored in. */
/** @deprecated use speed() instead */
@Deprecated
public float realSpeed(){
return Mathf.lerp(1f, type.canBoost ? type.boostMultiplier : 1f, elevation) * speed() * floorSpeedMultiplier();
return speed();
}
/** Iterates through this unit and everything it is controlling. */