From b0918f3be1cc93b5ee286fef80242bf5531eeaab Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 06:07:43 +0100 Subject: [PATCH] /stopsound: send each targeted server player the stop-sound packet StopSoundCommand sends ClientboundStopSoundPacket to every target. The command stopped the server's own sounds instead, so on the server thread (single player's default) and for LAN guests nothing stopped. Co-Authored-By: Claude Opus 5.5 --- .../src/game/commands/world_cmds.rs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/game/commands/world_cmds.rs b/crates/horizon-client/src/game/commands/world_cmds.rs index 1f7504d8a..d7e47417c 100644 --- a/crates/horizon-client/src/game/commands/world_cmds.rs +++ b/crates/horizon-client/src/game/commands/world_cmds.rs @@ -345,7 +345,26 @@ impl Game<'_> { Some(Arg::Resource(s)) => Some(s.clone()), _ => None, }; - self.audio.stop_sounds(sound.as_deref(), source); + // StopSoundCommand: each target's connection gets the packet; the + // window's own player stops its sounds. + let packet = C::StopSound(play::StopSound { + source: source.map(|s| s as i32), + sound: sound.clone(), + }); + for &t in &targets { + match t { + Target::Player if self.lan_acting.is_some() => { + self.guest_packets.push(packet.clone()); + } + Target::Player => self.audio.stop_sounds(sound.as_deref(), source), + Target::Guest(conn) => { + if let Some(host) = self.lan.as_ref() { + host.hub.send_to(conn, &packet); + } + } + _ => {} + } + } let key = match (source, &sound) { (Some(_), Some(_)) => "commands.stopsound.success.source.sound", (Some(_), None) => "commands.stopsound.success.source.any",