Port over the Fix for the activation audio bug (#5648)

Fixed the two-handed activated sound bug. (#38070)

* Fixed the two-handed activated sound bug.

* Tightened up yml.

* Yaml changes were not necessary.

---------

Co-authored-by: RedBookcase <crazykid1590@gmail.com>
Co-authored-by: RedBookcase <Usualmoves@gmail.com>
Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
This commit is contained in:
Sir Warock 2026-04-10 19:26:07 +02:00 committed by GitHub
parent 456bb629b8
commit 9ecdc75b2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,7 @@ using Content.Shared.Wieldable;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Network;
using Robust.Shared.Timing;
namespace Content.Shared.Item.ItemToggle;
/// <summary>
@ -23,6 +24,7 @@ public sealed class ItemToggleSystem : EntitySystem
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
private EntityQuery<ItemToggleComponent> _query;
@ -315,8 +317,7 @@ public sealed class ItemToggleSystem : EntitySystem
/// </summary>
private void TurnOnOnWielded(Entity<ItemToggleComponent> ent, ref ItemWieldedEvent args)
{
// FIXME: for some reason both client and server play sound
TryActivate((ent, ent.Comp));
TryActivate((ent, ent.Comp), args.User);
}
public bool IsActivated(Entity<ItemToggleComponent?> ent)
@ -340,6 +341,9 @@ public sealed class ItemToggleSystem : EntitySystem
/// </summary>
private void UpdateActiveSound(Entity<ItemToggleActiveSoundComponent> ent, ref ItemToggledEvent args)
{
if (!_gameTiming.IsFirstTimePredicted)
return;
var (uid, comp) = ent;
if (!args.Activated)
{