From bdf3c891e78193e7217416d3d4e0799cb5667c9a Mon Sep 17 00:00:00 2001 From: Perry Fraser Date: Tue, 15 Jul 2025 13:02:36 -0400 Subject: [PATCH] Mostly fix reaction sound effect stacking :( (#38999) * fix: band-aid the reaction sound effect stacking It's so funny I'm so sad I'm writing this commit :( * fix: remove unused hashset Drive by fix. 'Tis never read from. * fix: switch to just making it server only * fix: uncomment the if lol Commented it out for recording video oopsie --- .../Chemistry/Reaction/ChemicalReactionSystem.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs b/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs index 25781d2966..351a51ecc1 100644 --- a/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs +++ b/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs @@ -1,3 +1,5 @@ +using System.Collections.Frozen; +using System.Linq; using Content.Shared.Administration.Logs; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; @@ -5,10 +7,9 @@ using Content.Shared.Database; using Content.Shared.EntityEffects; using Content.Shared.FixedPoint; using Robust.Shared.Audio.Systems; +using Robust.Shared.Network; using Robust.Shared.Prototypes; using Robust.Shared.Utility; -using System.Collections.Frozen; -using System.Linq; namespace Content.Shared.Chemistry.Reaction @@ -25,9 +26,10 @@ namespace Content.Shared.Chemistry.Reaction /// private const int MaxReactionIterations = 20; + [Dependency] private readonly INetManager _netMan = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!; /// @@ -225,7 +227,11 @@ namespace Content.Shared.Chemistry.Reaction effect.Effect(args); } - _audio.PlayPvs(reaction.Sound, soln); + // Someday, some brave soul will thread through an optional actor + // argument in from every call of OnReaction up, all just to pass + // it to PlayPredicted. I am not that brave soul. + if (_netMan.IsServer) + _audio.PlayPvs(reaction.Sound, soln); } /// @@ -235,7 +241,6 @@ namespace Content.Shared.Chemistry.Reaction /// private bool ProcessReactions(Entity soln, SortedSet reactions, ReactionMixerComponent? mixerComponent) { - HashSet toRemove = new(); List? products = null; // attempt to perform any applicable reaction @@ -243,7 +248,6 @@ namespace Content.Shared.Chemistry.Reaction { if (!CanReact(soln, reaction, mixerComponent, out var unitReactions)) { - toRemove.Add(reaction); continue; } -- 2.52.0