From 46a6d0b3d6a7a94c5264b0da99b6e56c292803bb Mon Sep 17 00:00:00 2001 From: Kaeno Date: Fri, 5 Jul 2024 07:42:11 +0000 Subject: [PATCH] Renamed Variables to hopefully improve reading. Check role instead of side to tell if they are PMCs. (!145) Renamed a few things to make it easier to read. Use role instead of side to know if they are pmcs. Cant test since one of patches fail due to remapping should be ok Reviewed-on: https://dev.sp-tarkov.com/SPT/Modules/pulls/145 Co-authored-by: Kaeno Co-committed-by: Kaeno --- .../Patches/ScavMode/ScavRepAdjustmentPatch.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/ScavRepAdjustmentPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/ScavRepAdjustmentPatch.cs index 6a743e8..4078cf7 100644 --- a/project/SPT.SinglePlayer/Patches/ScavMode/ScavRepAdjustmentPatch.cs +++ b/project/SPT.SinglePlayer/Patches/ScavMode/ScavRepAdjustmentPatch.cs @@ -33,26 +33,27 @@ namespace SPT.SinglePlayer.Patches.ScavMode return; } - if (Singleton.Instance.GetEverExistedPlayerByID(playerProfileId) is Player killedPlayer) + if (Singleton.Instance.GetEverExistedPlayerByID(playerProfileId) is Player killedBot) { - __state = new Tuple(killedPlayer, killedPlayer.AIData.IsAI); + __state = new Tuple(killedBot, killedBot.AIData.IsAI); + var killedPlayerSettings = killedBot.Profile.Info.Settings; // Extra check to ensure we only set playerscavs to IsAI = false - if (killedPlayer.Profile.Info.Settings.Role == WildSpawnType.assault && killedPlayer.Profile.Nickname.Contains("(")) + if (killedPlayerSettings.Role == WildSpawnType.assault && killedBot.Profile.Nickname.Contains("(")) { - killedPlayer.AIData.IsAI = false; + killedBot.AIData.IsAI = false; } // If Victim is a PMC and has killed a Scav or Marksman. - if (killedPlayer.Side == EPlayerSide.Bear || killedPlayer.Side == EPlayerSide.Usec) + if (killedPlayerSettings.Role == WildSpawnType.pmcBEAR || killedPlayerSettings.Role == WildSpawnType.pmcUSEC) { - if(HasBotKilledScav(killedPlayer)) + if (HasBotKilledScav(killedBot)) { - player.Profile.FenceInfo.AddStanding(killedPlayer.Profile.Info.Settings.StandingForKill, EFT.Counters.EFenceStandingSource.ScavHelp); + player.Profile.FenceInfo.AddStanding(killedPlayerSettings.StandingForKill, EFT.Counters.EFenceStandingSource.ScavHelp); } } else { - player.Loyalty.method_1(killedPlayer); + player.Loyalty.method_1(killedBot); } } }