Fixed floorSpeedMultiplier being squared
This commit is contained in:
@@ -53,7 +53,7 @@ public class FormationAI extends AIController implements FormationMember{
|
|||||||
|
|
||||||
Vec2 realtarget = vec.set(target).add(leader.vel);
|
Vec2 realtarget = vec.set(target).add(leader.vel);
|
||||||
|
|
||||||
float speed = unit.realSpeed() * Time.delta;
|
float speed = unit.speed() * Time.delta;
|
||||||
unit.approach(Mathf.arrive(unit.x, unit.y, realtarget.x, realtarget.y, unit.vel, speed, 0f, speed, 1f).scl(1f / Time.delta));
|
unit.approach(Mathf.arrive(unit.x, unit.y, realtarget.x, realtarget.y, unit.vel, speed, 0f, speed, 1f).scl(1f / Time.delta));
|
||||||
|
|
||||||
if(unit.canMine() && leader.canMine()){
|
if(unit.canMine() && leader.canMine()){
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public class LogicAI extends AIController{
|
|||||||
|
|
||||||
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / smooth, -1f, 1f);
|
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / smooth, -1f, 1f);
|
||||||
|
|
||||||
vec.setLength(unit.realSpeed() * length);
|
vec.setLength(unit.speed() * length);
|
||||||
if(length < -0.5f){
|
if(length < -0.5f){
|
||||||
vec.rotate(180f);
|
vec.rotate(180f);
|
||||||
}else if(length < 0){
|
}else if(length < 0){
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
Unit unit = player.unit();
|
Unit unit = player.unit();
|
||||||
|
|
||||||
long elapsed = Math.min(Time.timeSinceMillis(con.lastReceivedClientTime), 1500);
|
long elapsed = Math.min(Time.timeSinceMillis(con.lastReceivedClientTime), 1500);
|
||||||
float maxSpeed = unit.realSpeed();
|
float maxSpeed = unit.speed();
|
||||||
|
|
||||||
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.2f;
|
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.2f;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
|||||||
|
|
||||||
void moveAt(Vec2 vector, float acceleration){
|
void moveAt(Vec2 vector, float acceleration){
|
||||||
Vec2 t = tmp1.set(vector); //target vector
|
Vec2 t = tmp1.set(vector); //target vector
|
||||||
tmp2.set(t).sub(vel).limit(acceleration * vector.len() * Time.delta * floorSpeedMultiplier()); //delta vector
|
tmp2.set(t).sub(vel).limit(acceleration * vector.len() * Time.delta); //delta vector
|
||||||
vel.add(tmp2);
|
vel.add(tmp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,15 +104,18 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
return type.hasWeapons();
|
return type.hasWeapons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return speed with boost & floor multipliers factored in. */
|
||||||
public float speed(){
|
public float speed(){
|
||||||
float strafePenalty = isGrounded() || !isPlayer() ? 1f : Mathf.lerp(1f, type.strafePenalty, Angles.angleDist(vel().angle(), rotation) / 180f);
|
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
|
//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(){
|
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. */
|
/** Iterates through this unit and everything it is controlling. */
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ public class AIController implements UnitController{
|
|||||||
|
|
||||||
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / smooth, -1f, 1f);
|
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / smooth, -1f, 1f);
|
||||||
|
|
||||||
vec.setLength(unit.realSpeed() * length);
|
vec.setLength(unit.speed() * length);
|
||||||
if(length < -0.5f){
|
if(length < -0.5f){
|
||||||
vec.rotate(180f);
|
vec.rotate(180f);
|
||||||
}else if(length < 0){
|
}else if(length < 0){
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
protected void updateMovement(Unit unit){
|
protected void updateMovement(Unit unit){
|
||||||
boolean omni = unit.type.omniMovement;
|
boolean omni = unit.type.omniMovement;
|
||||||
|
|
||||||
float speed = unit.realSpeed();
|
float speed = unit.speed();
|
||||||
float xa = Core.input.axis(Binding.move_x);
|
float xa = Core.input.axis(Binding.move_x);
|
||||||
float ya = Core.input.axis(Binding.move_y);
|
float ya = Core.input.axis(Binding.move_y);
|
||||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||||
|
|||||||
@@ -872,7 +872,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
targetPos.set(Core.camera.position);
|
targetPos.set(Core.camera.position);
|
||||||
float attractDst = 15f;
|
float attractDst = 15f;
|
||||||
|
|
||||||
float speed = unit.realSpeed();
|
float speed = unit.speed();
|
||||||
float range = unit.hasWeapons() ? unit.range() : 0f;
|
float range = unit.hasWeapons() ? unit.range() : 0f;
|
||||||
float bulletSpeed = unit.hasWeapons() ? type.weapons.first().bullet.speed : 0f;
|
float bulletSpeed = unit.hasWeapons() ? type.weapons.first().bullet.speed : 0f;
|
||||||
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());
|
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());
|
||||||
|
|||||||
Reference in New Issue
Block a user