diff --git a/crates/horizon-client/src/game/control.rs b/crates/horizon-client/src/game/control.rs index e7a1567ec..d778fe856 100644 --- a/crates/horizon-client/src/game/control.rs +++ b/crates/horizon-client/src/game/control.rs @@ -592,11 +592,15 @@ impl Game<'_> { } "chat" => { let text = line.trim_start().strip_prefix("chat").unwrap_or("").trim(); - if self.remote.is_some() { - self.send_chat(text); - return ok(); + // As if typed in the chat box (`handle_chat_input`): a client + // mod's command is intercepted first, else the line goes to the + // server. The socket used to send raw to the server in remote + // mode, which never reached a client mod — the #147 step 3.1 + // bench needs `/airdef` to deploy a battle on the default + // server-thread path too. + if self.remote.is_none() { + self.require_world()?; } - self.require_world()?; self.handle_chat_input(text); Ok(Some( json!({ "ok": true, "chat": self.ui.chat.recent_lines(5) }), @@ -695,9 +699,12 @@ impl Game<'_> { } "chat-log" => { let n = words.get(1).map_or(Ok(10), |n| n.parse())?; - let lines = self - .remote_chat(n) - .unwrap_or_else(|| self.ui.chat.recent_lines(n)); + // The chat the player sees: the server's lines are mirrored here + // (`chat_line`) and a client mod's own lines land here too + // (`add_mod_chat_line`), which the connection's raw buffer + // (`remote_chat`) never holds — the #147 step 3.1 bench reads the + // mod's `/airdef stats` feedback on the server-thread path. + let lines = self.ui.chat.recent_lines(n); Ok(Some(json!({ "chat": lines }))) } "stats" => {