Fixed server NaN contamination
This commit is contained in:
@@ -528,6 +528,10 @@ public class NetServer implements ApplicationListener{
|
|||||||
serverPacketReliable(player, type, contents);
|
serverPacketReliable(player, type, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean invalid(float f){
|
||||||
|
return Float.isInfinite(f) || Float.isNaN(f);
|
||||||
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.client, unreliable = true)
|
@Remote(targets = Loc.client, unreliable = true)
|
||||||
public static void clientSnapshot(
|
public static void clientSnapshot(
|
||||||
Player player,
|
Player player,
|
||||||
@@ -545,6 +549,16 @@ public class NetServer implements ApplicationListener{
|
|||||||
NetConnection con = player.con;
|
NetConnection con = player.con;
|
||||||
if(con == null || snapshotID < con.lastReceivedClientSnapshot) return;
|
if(con == null || snapshotID < con.lastReceivedClientSnapshot) return;
|
||||||
|
|
||||||
|
//validate coordinates just in case
|
||||||
|
if(invalid(x)) x = 0f;
|
||||||
|
if(invalid(y)) y = 0f;
|
||||||
|
if(invalid(xVelocity)) xVelocity = 0f;
|
||||||
|
if(invalid(yVelocity)) yVelocity = 0f;
|
||||||
|
if(invalid(pointerX)) pointerX = 0f;
|
||||||
|
if(invalid(pointerY)) pointerY = 0f;
|
||||||
|
if(invalid(rotation)) rotation = 0f;
|
||||||
|
if(invalid(baseRotation)) baseRotation = 0f;
|
||||||
|
|
||||||
boolean verifyPosition = !player.dead() && netServer.admins.getStrict() && headless;
|
boolean verifyPosition = !player.dead() && netServer.admins.getStrict() && headless;
|
||||||
|
|
||||||
if(con.lastReceivedClientTime == 0) con.lastReceivedClientTime = Time.millis() - 16;
|
if(con.lastReceivedClientTime == 0) con.lastReceivedClientTime = Time.millis() - 16;
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
//limit speed to minimum formation speed to preserve formation
|
//limit speed to minimum formation speed to preserve formation
|
||||||
if(unit instanceof Commanderc && ((Commanderc)unit).isCommanding()){
|
if(unit instanceof Commanderc && ((Commanderc)unit).isCommanding()){
|
||||||
//add a tiny multiplier to let units catch up just in case
|
//add a tiny multiplier to let units catch up just in case
|
||||||
baseSpeed = ((Commanderc)unit).minFormationSpeed() * 0.98f;
|
baseSpeed = ((Commanderc)unit).minFormationSpeed() * 0.95f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float speed = baseSpeed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation) * strafePenalty;
|
float speed = baseSpeed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation) * strafePenalty;
|
||||||
|
|||||||
Reference in New Issue
Block a user