From 043eee550b7a1914531a4d82a4672ee4b7fcec6f Mon Sep 17 00:00:00 2001 From: Twist Date: Thu, 26 Dec 2024 07:50:58 +0000 Subject: [PATCH] Fix: Prevent spectators, covert, and long range corpse searches from making sound (#1698) --- CHANGELOG.md | 1 + gamemodes/terrortown/gamemode/server/sv_corpse.lua | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 777411cec..714531e03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel - Fixed the beacon not being properly translated when placed (by @Histalek) - Fixed binoculars zooming not being predicted (by @Histalek) - Fixed an error when trying to pickup a placed equipment (e.g. beacon) (by @Histalek) +- Fixed corpse searching sound playing when searched by a spectator, searched covertly, or searched long range (by @TW1STaL1CKY) ### Changed diff --git a/gamemodes/terrortown/gamemode/server/sv_corpse.lua b/gamemodes/terrortown/gamemode/server/sv_corpse.lua index 03833c1c5..b3ec0a5a1 100644 --- a/gamemodes/terrortown/gamemode/server/sv_corpse.lua +++ b/gamemodes/terrortown/gamemode/server/sv_corpse.lua @@ -316,12 +316,14 @@ function CORPSE.ShowSearch(ply, rag, isCovert, isLongRange) ply.searchID = sceneData.searchUID -- play sound when the body was searched - -- note: These sounds are pretty quiet and are therefore played thrice to increase the volume - local soundSelected = table.Random(soundsSearch) + if ply:IsTerror() and not isCovert and not isLongRange then + -- note: These sounds are pretty quiet and are therefore played thrice to increase the volume + local soundSelected = table.Random(soundsSearch) - rag:EmitSound(soundSelected, 100) - rag:EmitSound(soundSelected, 100) - rag:EmitSound(soundSelected, 100) + rag:EmitSound(soundSelected, 100) + rag:EmitSound(soundSelected, 100) + rag:EmitSound(soundSelected, 100) + end local roleData = ply:GetSubRoleData() if ply:IsActive() and roleData.isPolicingRole and roleData.isPublicRole and not isCovert then