mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 07:50:46 -05:00
Fix quest counters triggering while ending the HideoutGame (!78)
When exiting the hideout, the HideoutPlayer class ends up triggering a call in Player that calculates quest counter changes. This causes issues with quests that require not dying The Player class however wraps these calls in a null check on the QuestController, so we can set it to null before ending the hideout session, and restore it afterwards to skip quest counter calculations As Hideout Game end only triggers on start of a new raid, and not when you actually close the hideout, I can't think of any reason that quest counters should trigger in this scenario Resolves: SPT-AKI/Issues#471 Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: SPT-AKI/Modules#78 Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com> Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
2e11148618
commit
3853a413f6
@ -62,6 +62,7 @@ namespace Aki.SinglePlayer
|
|||||||
new PurchaseTraderServicePatch().Enable();
|
new PurchaseTraderServicePatch().Enable();
|
||||||
new ScavSellAllPriceStorePatch().Enable();
|
new ScavSellAllPriceStorePatch().Enable();
|
||||||
new ScavSellAllRequestPatch().Enable();
|
new ScavSellAllRequestPatch().Enable();
|
||||||
|
new HideoutQuestIgnorePatch().Enable();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
using Aki.Reflection.Patching;
|
||||||
|
using EFT;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Aki.SinglePlayer.Patches.Progression
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* There is no reason to update quest counters when exiting the hideout, so set the
|
||||||
|
* player's QuestController to null while calling HideoutPlayer.OnGameSessionEnd to
|
||||||
|
* avoid the quest controller counters from being triggered
|
||||||
|
*
|
||||||
|
* Note: Player.OnGameSessionEnd handles the player's quest controller not being set gracefully
|
||||||
|
*/
|
||||||
|
public class HideoutQuestIgnorePatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(HideoutPlayer), nameof(HideoutPlayer.OnGameSessionEnd));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPrefix]
|
||||||
|
private static void PatchPrefix(AbstractQuestControllerClass __state, ref AbstractQuestControllerClass ____questController)
|
||||||
|
{
|
||||||
|
__state = ____questController;
|
||||||
|
____questController = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPostfix]
|
||||||
|
private static void PatchPostfix(AbstractQuestControllerClass __state, ref AbstractQuestControllerClass ____questController)
|
||||||
|
{
|
||||||
|
____questController = __state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user