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
This commit is contained in:
Perry Fraser
2025-07-15 13:02:36 -04:00
committed by GitHub
parent 1d4c945561
commit bdf3c891e7

View 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;
}