]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Mostly fix reaction sound effect stacking :( (#38999)
authorPerry Fraser <perryprog@users.noreply.github.com>
Tue, 15 Jul 2025 17:02:36 +0000 (13:02 -0400)
committerGitHub <noreply@github.com>
Tue, 15 Jul 2025 17:02:36 +0000 (19:02 +0200)
* 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

Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs

index 25781d2966a0fa5b06ee71b68b1bb945551d8169..351a51ecc1607cc5d39b5017a853218ad7f8dd95 100644 (file)
@@ -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
         /// </summary>
         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!;
 
         /// <summary>
@@ -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);
         }
 
         /// <summary>
@@ -235,7 +241,6 @@ namespace Content.Shared.Chemistry.Reaction
         /// </summary>
         private bool ProcessReactions(Entity<SolutionComponent> soln, SortedSet<ReactionPrototype> reactions, ReactionMixerComponent? mixerComponent)
         {
-            HashSet<ReactionPrototype> toRemove = new();
             List<string>? 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;
                 }