Skip to content

Commit

Permalink
Merge pull request #201 from SpicyDarkFox/dbg
Browse files Browse the repository at this point in the history
Чиним - не чинится
  • Loading branch information
SpicyDarkFox authored Sep 25, 2024
2 parents 804110d + d674557 commit 41465d4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Content.Client/Corvax/TTS/TTSSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private void OnPlayTTS(PlayTTSEvent ev)
#endif
if (!canPlay)
return;

//_sawmill.Debug($"Play TTS audio {ev.Data.Length} bytes from {ev.SourceUid} entity");

var volume = AdjustVolume(ev.IsWhisper);
Expand Down Expand Up @@ -112,11 +113,11 @@ private void OnPlayTTS(PlayTTSEvent ev)
if (ev.SourceUid != null)
{
var sourceUid = GetEntity(ev.SourceUid.Value);
Filter sources = Filter.Pvs(player ?? EntityUid.Invalid);
Filter sources = Filter.Pvs(sourceUid);
var sourceExists = false;
foreach (var src in sources.Recipients)
{
if (src.AttachedEntity != null && src.AttachedEntity == sourceUid)
if (src.AttachedEntity != null && src.AttachedEntity == player)
{
sourceExists = true;
break;
Expand All @@ -127,17 +128,17 @@ private void OnPlayTTS(PlayTTSEvent ev)
if (!sourceExists) //если в диапазоне Pvs нет источника, то звук не проигрывается
return;

Logger.Warning($"Playing TTS on Entity {sourceUid}");
//Logger.Warning($"Playing TTS on Entity {sourceUid}");
_audio.PlayEntity(soundPath, new EntityUid(), sourceUid); // recipient arg ignored on client
}
else
{
Logger.Warning("Playing TTS Globally");
//Logger.Warning("Playing TTS Globally");
_audio.PlayGlobal(soundPath, Filter.Local(), false);
}

_contentRoot.RemoveFile(filePath);
Logger.Warning($"TTS File successfully removed!");
//Logger.Warning($"TTS File successfully removed!");
}

private float AdjustVolume(bool isWhisper)
Expand Down

0 comments on commit 41465d4

Please sign in to comment.