0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 17:10:44 -05:00

Add FirearmControllerShowIncompatibleNotificationClass (!171)

This patch aims to prevent the player from incorrectly receiving the incompatible ammo notification if an AI fails to shoot because of incompatible ammo. Tested with no errors, should probably be added and let users report whether it still occurs as it is hard to reliably reproduce.

Co-authored-by: Lacyway <20912169+Lacyway@users.noreply.github.com>
Reviewed-on: SPT/Modules#171
Co-authored-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com>
Co-committed-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com>
This commit is contained in:
Lacyway 2024-10-17 16:32:40 +00:00 committed by chomp
parent 16185f64f6
commit d8c0abfe04
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,23 @@
using EFT;
using SPT.Reflection.Patching;
using System.Reflection;
namespace SPT.SinglePlayer.Patches.RaidFix
{
/// <summary>
/// This patch stops the player from receiving the incompatible ammo notification if it's triggered by an AI
/// </summary>
public class FirearmControllerShowIncompatibleNotificationClass : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(Player.FirearmController.GClass1748).GetMethod(nameof(Player.FirearmController.GClass1748.ShowIncompatibleNotification));
}
[PatchPrefix]
public static bool Prefix(Player ___player_0)
{
return ___player_0.IsYourPlayer;
}
}
}

View File

@ -62,6 +62,7 @@ namespace SPT.SinglePlayer
new FixLocalRaidPatch().Enable();
new ScavIsPlayerEnemyPatch().Enable();
new BotOwnerManualUpdatePatch().Enable();
new FirearmControllerShowIncompatibleNotificationClass().Enable();
}
catch (Exception ex)
{