mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 02:50:45 -05:00
Add Util to Allow Modders to Access Changes for Scav Raids (!38)
Added `Utils.ScavMode.ScavRaidChangesUtil` class so mods can easily access the change in map settings (currently just escape time) for Scav raids. This will allow mods like Questing Bots, DONUTS, etc. easily be able to alter spawn settings based on "real" raid time. Currently, each mod has to cache original raid settings and calculate the difference in escape times, which is performing redundant work. I'm not sure what your conventions are for naming and stuff, so feel free to hack this up. Co-authored-by: dwesterwick <dwesterwick@yahoo.com> Reviewed-on: SPT-AKI/Modules#38 Co-authored-by: DanW <danw@noreply.dev.sp-tarkov.com> Co-committed-by: DanW <danw@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
006ccf7ab1
commit
b85c27c8a8
@ -62,6 +62,7 @@ namespace Aki.SinglePlayer.Patches.ScavMode
|
||||
var serverResult = Json.Deserialize<RaidTimeResponse>(json);
|
||||
|
||||
// Set new raid time
|
||||
Utils.ScavMode.ScavRaidChangesUtil.SetRaidTimeReduction(____raidSettings.SelectedLocation.EscapeTimeLimit - serverResult.RaidTimeMinutes);
|
||||
____raidSettings.SelectedLocation.EscapeTimeLimit = serverResult.RaidTimeMinutes;
|
||||
|
||||
// Handle survival time changes
|
||||
|
@ -0,0 +1,29 @@
|
||||
namespace Aki.SinglePlayer.Utils.ScavMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Allow mods to access changes made to map settings for Scav raids
|
||||
/// </summary>
|
||||
public static class ScavRaidChangesUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// The reduction in the escape time for the most recently loaded map, in minutes
|
||||
/// </summary>
|
||||
public static int RaidTimeReductionMinutes { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The reduction in the escape time for the most recently loaded map, in seconds
|
||||
/// </summary>
|
||||
public static int RaidTimeReductionSeconds => RaidTimeReductionMinutes * 60;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the most recent raid-time reduction so it can be accessed by mods.
|
||||
///
|
||||
/// This should be internal because mods shouldn't be able to call it.
|
||||
/// </summary>
|
||||
/// <param name="raidTimeReduction">The raid-time reduction applied to the most recent Scav raid, in minutes</param>
|
||||
internal static void SetRaidTimeReduction(int raidTimeReduction)
|
||||
{
|
||||
RaidTimeReductionMinutes = raidTimeReduction;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user