From 3669529743ad6592cce4b235e148b71c6150eca2 Mon Sep 17 00:00:00 2001 From: VigersRay Date: Fri, 21 Jun 2024 04:26:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BD=D0=B8=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BC=D0=B0=D0=BA=D1=81=20=D0=B3=D1=80=D0=BE?= =?UTF-8?q?=D0=BC=D0=BA=D0=BE=D1=81=D1=82=D0=B8=20=D0=B8=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B4=D0=B8=D1=83=D1=81=D0=B0=20=D1=81=D0=BB=D1=8B=D1=88=D0=B8?= =?UTF-8?q?=D0=BC=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Server/_Sunrise/TapePlayer/TapePlayerSystem.cs | 7 +++++-- Content.Shared/_Sunrise/TapePlayer/TapePlayerComponent.cs | 4 ++++ .../Prototypes/Entities/Structures/Machines/jukebox.yml | 5 +++-- .../_Sunrise/Entities/Objects/Devices/boombox.yml | 6 ++++-- .../_Sunrise/Entities/Objects/Devices/tape_player.yml | 5 +++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Content.Server/_Sunrise/TapePlayer/TapePlayerSystem.cs b/Content.Server/_Sunrise/TapePlayer/TapePlayerSystem.cs index c95f8ef05c7..d14c5db07d6 100644 --- a/Content.Server/_Sunrise/TapePlayer/TapePlayerSystem.cs +++ b/Content.Server/_Sunrise/TapePlayer/TapePlayerSystem.cs @@ -84,8 +84,10 @@ private void OnTapePlayerPlay(EntityUid uid, TapePlayerComponent component, ref return; } + var volume = SharedAudioSystem.GainToVolume(component.Volume) - component.DecreaseVolume; + var audioParams = AudioParams.Default - .WithVolume(SharedAudioSystem.GainToVolume(component.Volume)) + .WithVolume(volume) .WithMaxDistance(component.MaxDistance) .WithRolloffFactor(component.RolloffFactor) .WithLoop(component.Loop); @@ -119,7 +121,8 @@ private void OnTapePlayerSetTime(EntityUid uid, TapePlayerComponent component, T private void OnTapePlayerSetVolume(EntityUid uid, TapePlayerComponent component, TapePlayerSetVolumeMessage args) { component.Volume = args.Volume; - Audio.SetVolume(component.AudioStream, SharedAudioSystem.GainToVolume(args.Volume)); + var volume = SharedAudioSystem.GainToVolume(component.Volume) - component.DecreaseVolume; + Audio.SetVolume(component.AudioStream, volume); Dirty(uid, component); } diff --git a/Content.Shared/_Sunrise/TapePlayer/TapePlayerComponent.cs b/Content.Shared/_Sunrise/TapePlayer/TapePlayerComponent.cs index fa9d807eebd..3f5295b9906 100644 --- a/Content.Shared/_Sunrise/TapePlayer/TapePlayerComponent.cs +++ b/Content.Shared/_Sunrise/TapePlayer/TapePlayerComponent.cs @@ -24,6 +24,10 @@ public sealed partial class TapePlayerComponent : Component [ViewVariables] public float Volume = 0.5f; + [DataField] + [ViewVariables] + public float DecreaseVolume = 0f; + [DataField] [ViewVariables(VVAccess.ReadWrite)] public float RolloffFactor = 1f; diff --git a/Resources/Prototypes/Entities/Structures/Machines/jukebox.yml b/Resources/Prototypes/Entities/Structures/Machines/jukebox.yml index 3144f31ade5..8e751f275ff 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/jukebox.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/jukebox.yml @@ -13,8 +13,9 @@ anchored: true # Sunrise-Start - type: TapePlayer - rolloffFactor: 1 - maxDistance: 20 + rolloffFactor: 1.5 + maxDistance: 15 + decreaseVolume: 5 tapeSlot: insertSound: /Audio/_Sunrise/TapePlayer/insert_tape.ogg ejectSound: /Audio/_Sunrise/TapePlayer/eject_tape.ogg diff --git a/Resources/Prototypes/_Sunrise/Entities/Objects/Devices/boombox.yml b/Resources/Prototypes/_Sunrise/Entities/Objects/Devices/boombox.yml index dadce97c050..5a08448e48a 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Objects/Devices/boombox.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Objects/Devices/boombox.yml @@ -12,8 +12,9 @@ - state: "off" map: ["enum.TapePlayerVisualLayers.Base"] - type: TapePlayer - rolloffFactor: 1.2 - maxDistance: 15 + rolloffFactor: 2 + maxDistance: 10 + decreaseVolume: 5 - type: MeleeWeapon attackRate: 0.75 damage: @@ -40,6 +41,7 @@ - type: TapePlayer rolloffFactor: 1 maxDistance: 20 + decreaseVolume: 0 - type: MeleeWeapon attackRate: 0.75 damage: diff --git a/Resources/Prototypes/_Sunrise/Entities/Objects/Devices/tape_player.yml b/Resources/Prototypes/_Sunrise/Entities/Objects/Devices/tape_player.yml index 7c7e32e4e72..744400c8794 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Objects/Devices/tape_player.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Objects/Devices/tape_player.yml @@ -11,8 +11,9 @@ - state: "off" map: ["enum.TapePlayerVisualLayers.Base"] - type: TapePlayer - rolloffFactor: 1.2 - maxDistance: 10 + rolloffFactor: 3 + maxDistance: 5 + decreaseVolume: 10 tapeSlot: insertSound: /Audio/_Sunrise/TapePlayer/insert_tape.ogg ejectSound: /Audio/_Sunrise/TapePlayer/eject_tape.ogg