Actual speed fix

This commit is contained in:
Anuken 2019-09-25 20:29:26 -04:00
parent d79ec83817
commit 94d245246c
2 changed files with 18 additions and 11 deletions

View File

@ -419,15 +419,6 @@ public class NetServer implements ApplicationListener{
player.con.hasDisconnected = true;
}
private static float compound(float speed, float drag){
float total = 0f;
for(int i = 0; i < 50; i++){
total *= (1f - drag);
total += speed;
}
return total;
}
@Remote(targets = Loc.client, unreliable = true)
public static void onClientShapshot(
Player player,
@ -455,8 +446,8 @@ public class NetServer implements ApplicationListener{
long elapsed = Time.timeSinceMillis(connection.lastRecievedClientTime);
float maxSpeed = boosting && !player.mech.flying ? player.mech.boostSpeed : player.mech.speed;
float maxMove = elapsed / 1000f * 60f * compound(maxSpeed, player.mech.drag) * 1.1f;
float maxSpeed = boosting && !player.mech.flying ? player.mech.compoundSpeedBoost : player.mech.compoundSpeed;
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.05f;
player.pointerX = pointerX;
player.pointerY = pointerY;

View File

@ -28,6 +28,7 @@ public class Mech extends UnlockableContent{
public int itemCapacity = 30;
public boolean turnCursor = true;
public boolean canHeal = false;
public float compoundSpeed, compoundSpeedBoost;
public float weaponOffsetX, weaponOffsetY, engineOffset = 5f, engineSize = 2.5f;
public Weapon weapon;
@ -69,6 +70,21 @@ public class Mech extends UnlockableContent{
public void onLand(Player player){
}
@Override
public void init(){
super.init();
for(int i = 0; i < 500; i++){
compoundSpeed += speed;
compoundSpeed *= (1f - drag);
}
for(int i = 0; i < 500; i++){
compoundSpeedBoost += boostSpeed;
compoundSpeedBoost *= (1f - drag);
}
}
@Override
public void displayInfo(Table table){
ContentDisplay.displayMech(table, this);