From 6b31ffea3e4dd0d19176381c45c110f419bae908 Mon Sep 17 00:00:00 2001 From: Isse Date: Tue, 26 Sep 2023 12:18:55 +0200 Subject: [PATCH] attempt to fix timeout with high timescale --- client/src/lib.rs | 30 +++++++++++++++++++----------- common/net/src/msg/server.rs | 6 +++--- common/src/resources.rs | 4 ++++ common/state/src/state.rs | 9 ++++++++- server/src/client.rs | 2 +- server/src/cmd.rs | 6 +++++- server/src/sys/entity_sync.rs | 5 ++++- server/src/sys/msg/ping.rs | 4 ++-- 8 files changed, 46 insertions(+), 20 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index 34ed295b39..21a482e56b 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1929,9 +1929,9 @@ impl Client { self.tick_terrain()?; // Send a ping to the server once every second - if self.state.get_time() - self.last_server_ping > 1. { + if self.state.get_true_time() - self.last_server_ping > 1. { self.send_msg_err(PingMsg::Ping)?; - self.last_server_ping = self.state.get_time(); + self.last_server_ping = self.state.get_true_time(); } // 6) Update the server about the player's physics attributes. @@ -2266,9 +2266,16 @@ impl Client { return Err(Error::Other("Failed to find entity from uid.".into())); } }, - ServerGeneral::TimeOfDay(time_of_day, calendar, new_time, time_scale) => { + ServerGeneral::TimeOfDay( + time_of_day, + calendar, + new_time, + new_true_time, + time_scale, + ) => { self.target_time_of_day = Some(time_of_day); *self.state.ecs_mut().write_resource() = calendar; + *self.state.ecs_mut().write_resource() = new_true_time; let mut time = self.state.ecs_mut().write_resource::