From 9cc3d1c85799b1ec4a2aed6393d70b62af8cfe04 Mon Sep 17 00:00:00 2001 From: Tim Goll Date: Tue, 10 Oct 2023 16:08:19 +0200 Subject: [PATCH] handling non-public policing roles --- gamemodes/terrortown/gamemode/client/cl_search.lua | 4 ++-- gamemodes/terrortown/gamemode/server/sv_corpse.lua | 8 -------- lua/ttt2/libraries/targetid.lua | 8 ++++---- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/gamemodes/terrortown/gamemode/client/cl_search.lua b/gamemodes/terrortown/gamemode/client/cl_search.lua index 1c03ea3a40..e6a20b255d 100644 --- a/gamemodes/terrortown/gamemode/client/cl_search.lua +++ b/gamemodes/terrortown/gamemode/client/cl_search.lua @@ -203,7 +203,7 @@ function SEARCHSCRN:Show(data) }, 62) elseif bodysearch.CanReportBody(data.ragOwner) and not bodysearch.IsConfirmed(data.ragOwner) - and not clientRD.isPolicingRole and not clientRD.isPublicRole + and not (clientRD.isPolicingRole and clientRD.isPublicRole) then local searchMode = bodysearch.GetInspectConfirmMode() @@ -320,7 +320,7 @@ function SEARCHSCRN:Show(data) buttonConfirm.DoClick = function(btn) local creditsOnly = playerCanTakeCredits and GetConVar("ttt2_inspect_confirm_mode"):GetInt() > 0 - and not clientRD.isPolicingRole and not clientRD.isPublicRole + and not (clientRD.isPolicingRole and clientRD.isPublicRole) bodysearch.ClientConfirmsCorpse(data.rag, data.searchUID, data.lrng, creditsOnly) diff --git a/gamemodes/terrortown/gamemode/server/sv_corpse.lua b/gamemodes/terrortown/gamemode/server/sv_corpse.lua index de13aabe0d..d5d19652cc 100644 --- a/gamemodes/terrortown/gamemode/server/sv_corpse.lua +++ b/gamemodes/terrortown/gamemode/server/sv_corpse.lua @@ -78,14 +78,6 @@ function CORPSE.IdentifyBody(ply, rag, searchUID) return end - local roleData = ply:GetSubRoleData() - - --if bodysearch.GetInspectConfirmMode() == 2 and not roleData.isPolicingRole and not roleData.isPublicRole then - -- LANG.Msg(ply, "inspect_detective_only", nil, MSG_MSTACK_WARN) - - -- return false - --end - --- -- @realm server if not hook.Run("TTTCanIdentifyCorpse", ply, rag) then return end diff --git a/lua/ttt2/libraries/targetid.lua b/lua/ttt2/libraries/targetid.lua index 32e84e80ba..c9539bfb21 100644 --- a/lua/ttt2/libraries/targetid.lua +++ b/lua/ttt2/libraries/targetid.lua @@ -491,15 +491,15 @@ function targetid.HUDDrawTargetIDRagdolls(tData) if tData:GetEntityDistance() <= 100 then if client:IsSpec() then tData:SetSubtitle(ParT("corpse_hint_spec", key_params)) - elseif bodysearch.GetInspectConfirmMode() == 2 and not roleDataClient.isPolicingRole and not roleDataClient.isPublicRole then + elseif bodysearch.GetInspectConfirmMode() == 2 and not (roleDataClient.isPolicingRole and roleDataClient.isPublicRole) then -- a detective added search results, this should change the targetID - if ent.bodySearchResult and ent.bodySearchResult.base and ent.bodySearchResult.base.isPublicPolicingSearch then + if ent.bodySearchResult and ent.bodySearchResult.base.isPublicPolicingSearch then tData:SetSubtitle(ParT("corpse_hint_public_policing_searched", key_params)) else tData:SetSubtitle(ParT("corpse_hint_no_inspect", key_params)) end tData:AddDescriptionLine(TryT("corpse_hint_no_inspect_details")) - elseif bodysearch.GetInspectConfirmMode() == 1 and not roleDataClient.isPolicingRole and not roleDataClient.isPublicRole then + elseif bodysearch.GetInspectConfirmMode() == 1 and not (roleDataClient.isPolicingRole and roleDataClient.isPublicRole) then tData:SetSubtitle(ParT("corpse_hint_inspect_only", key_params)) tData:AddDescriptionLine(TryT("corpse_hint_inspect_only_details")) else @@ -528,7 +528,7 @@ function targetid.HUDDrawTargetIDRagdolls(tData) end -- add info if searched by detectives - if ent.bodySearchResult and ent.bodySearchResult.base and ent.bodySearchResult.base.isPublicPolicingSearch then + if ent.bodySearchResult and ent.bodySearchResult.base.isPublicPolicingSearch then tData:AddDescriptionLine( TryT("corpse_searched_by_detective"), roles.DETECTIVE.ltcolor,