Skip to content

Commit

Permalink
Понижение макс громкости и радиуса слышимости
Browse files Browse the repository at this point in the history
  • Loading branch information
VigersRay committed Jun 21, 2024
1 parent 5f190a2 commit 3669529
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Content.Server/_Sunrise/TapePlayer/TapePlayerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/_Sunrise/TapePlayer/TapePlayerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions Resources/Prototypes/Entities/Structures/Machines/jukebox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -40,6 +41,7 @@
- type: TapePlayer
rolloffFactor: 1
maxDistance: 20
decreaseVolume: 0
- type: MeleeWeapon
attackRate: 0.75
damage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3669529

Please sign in to comment.