Better rejection logs

This commit is contained in:
Joshua Barretto 2023-06-22 13:14:07 +01:00
parent dda28d5621
commit 98493fd511

View File

@ -436,15 +436,20 @@ impl<'a> System<'a> for Sys {
}; };
if let Some(rejection) = rejection { if let Some(rejection) = rejection {
let alias = maybe_player.map(|p| &p.alias);
match rejection { match rejection {
Rejection::TooFar { old, new } => warn!("Rejected player physics update (new position {:?} is too far from old position {:?})", new, old), Rejection::TooFar { old, new } => warn!("Rejected physics for player {alias:?} (new position {new:?} is too far from old position {old:?})"),
Rejection::TooFast { vel } => warn!("Rejected player physics update (new velocity {:?} is too fast)", vel), Rejection::TooFast { vel } => warn!("Rejected physics for player {alias:?} (new velocity {vel:?} is too fast)"),
} }
if let Some(mut setting) = new_player_physics_setting.as_mut() { /*
// Perhaps this is overzealous? // Perhaps this is overzealous?
//setting.server_force = true; if let Some(mut setting) = new_player_physics_setting.as_mut() {
setting.server_force = true;
warn!("Switching player {alias:?} to server-side physics");
} }
*/
// Reject the change and force the server's view of the physics state // Reject the change and force the server's view of the physics state
force_update.as_mut().map(|fu| fu.update()); force_update.as_mut().map(|fu| fu.update());