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")))