1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Factor in connection latency when respawning player, bump LiteRustLib (with fix #143)

This commit is contained in:
NG (Graham)
2026-08-09 15:27:16 -04:00
parent 7147df2a9c
commit 961190a467
6 changed files with 29 additions and 12 deletions

View File

@@ -1298,6 +1298,12 @@ impl BattleArenaLogic {
};
if let Some(player_desc) = generic.user_descriptor(player_id) {
let connections = generic.users.read().await.values().map(|player_info| player_info.connection.clone()).collect();
let my_connection_latency = generic.users.read().await
.iter()
.filter(|(user_player_id, _)| **user_player_id == player_id)
.next()
.unwrap()
.1.connection.connection.latency();
tokio::task::spawn(super::respawn_player_after(
respawn_timestamp,
connections,
@@ -1305,6 +1311,7 @@ impl BattleArenaLogic {
Some(self.map_center.clone()),
player_id,
player_desc.machine.is_alive.clone(),
my_connection_latency,
));
} else {
log::error!("Player {} cannot respawn because they are not in the game!?", player_id);