mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Safeguard ScavRepAdjustmentpatch to only run when its your player doing the killing. Added notes so Gclass ref doesnt get updated incorrectly (!132)
Reviewed-on: SPT/Modules#132
This commit is contained in:
parent
d452c24c9b
commit
d6dd573e88
@ -12,14 +12,22 @@ namespace SPT.SinglePlayer.Patches.ScavMode
|
|||||||
// TODO: REMAP/UPDATE GCLASS REF
|
// TODO: REMAP/UPDATE GCLASS REF
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(GClass1798), nameof(GClass1798.OnEnemyKill));
|
// Correct Gclass has sessionCounters
|
||||||
|
return AccessTools.Method(typeof(GClass1800), nameof(GClass1800.OnEnemyKill));
|
||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
private static void PatchPrefix(string playerProfileId, out Tuple<Player, bool> __state)
|
private static void PatchPrefix(DamageInfo damage, string playerProfileId, out Tuple<Player, bool> __state)
|
||||||
{
|
{
|
||||||
var player = Singleton<GameWorld>.Instance.MainPlayer;
|
|
||||||
__state = new Tuple<Player, bool>(null, false);
|
__state = new Tuple<Player, bool>(null, false);
|
||||||
|
var player = (Player)damage.Player.iPlayer;
|
||||||
|
|
||||||
|
// Add safeguards to make sure no calculations happen from other bots
|
||||||
|
if (!player.IsYourPlayer)
|
||||||
|
{
|
||||||
|
Logger.LogError("This shouldn't be happening. Are you sure we are using the correct GClass?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (player.Profile.Side != EPlayerSide.Savage)
|
if (player.Profile.Side != EPlayerSide.Savage)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user