From 4477b12f0a236f9a4828acc1978dca85c88f7d0b Mon Sep 17 00:00:00 2001 From: WiseDev <83840010+wisedevik@users.noreply.github.com> Date: Sun, 23 Aug 2026 11:19:26 +0300 Subject: [PATCH] stop the home logic once the battle starts the client sends EndClientTurnMessage during the battle too, but its tick and checksum belong to the battle, not to the home. we kept comparing them against the home checksum and answered with OutOfSyncMessage, which is the "Client and server are out of sync!" dialog on tick 60. HomeMode carries the stopped flag now and returns an empty turn result while it is set, and sector_state_for raises it, so both the mission and the matchmaking entry points are covered. --- crates/game-service/src/home_mode.rs | 12 +++++++++++- crates/game-service/src/service.rs | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/game-service/src/home_mode.rs b/crates/game-service/src/home_mode.rs index e9efc73..e64f6f7 100644 --- a/crates/game-service/src/home_mode.rs +++ b/crates/game-service/src/home_mode.rs @@ -32,6 +32,7 @@ pub struct TurnResult { } pub struct HomeMode { logic: LogicHomeMode, + home_logic_stopped: bool, } impl HomeMode { pub fn from_profile(profile: &PlayerProfile, current_timestamp: i32) -> Self { @@ -43,7 +44,13 @@ impl HomeMode { logic.restore_free_chest_timer(profile.free_chest_end_timestamp); let cycle = ShopCycle::at(current_timestamp); logic.set_shop(cycle.seed, cycle.seconds_to_cycle, cycle.weekday_index); - Self { logic } + Self { + logic, + home_logic_stopped: false, + } + } + pub fn stop_home_logic(&mut self) { + self.home_logic_stopped = true; } pub fn shop_cycle(&self) -> ShopCycle { ShopCycle::at(self.logic.current_timestamp()) @@ -164,6 +171,9 @@ impl HomeMode { shop: &ShopCatalog, ) -> TurnResult { let mut result = TurnResult::default(); + if self.home_logic_stopped { + return result; + } let ticked = self .logic .fast_forward_to_tick(turn.tick, MAX_FAST_FORWARD_TICKS); diff --git a/crates/game-service/src/service.rs b/crates/game-service/src/service.rs index 94e979c..bde1365 100644 --- a/crates/game-service/src/service.rs +++ b/crates/game-service/src/service.rs @@ -84,6 +84,12 @@ impl GameService { ) -> RpcResult> { let profile = self.profile(account).await?; let avatar = build_avatar(&profile); + self.sessions + .get_or_open(account, &profile, unix_seconds() as i32) + .await + .lock() + .await + .stop_home_logic(); let location = npc .data() .map(|row| LogicDataRef::by_name(table::LOCATIONS, row.string("Location")))