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

- Merge master changes into 310-dev in prep for merging back into master

This commit is contained in:
DrakiaXYZ 2024-11-26 21:54:24 -08:00
commit 270bac8592
5 changed files with 60 additions and 9 deletions

View File

@ -13,6 +13,7 @@ SPT.Debugging | Debug utilities (disabled in release builds)
SPT.Reflection | Reflection utilities used across the project SPT.Reflection | Reflection utilities used across the project
SPT.SinglePlayer | Simulating online game while offline SPT.SinglePlayer | Simulating online game while offline
## Privacy ## Privacy
SPT is an open source project. Your commit credentials as author of a commit will be visible by anyone. Please make sure you understand this before submitting a PR. SPT is an open source project. Your commit credentials as author of a commit will be visible by anyone. Please make sure you understand this before submitting a PR.
Feel free to use a "fake" username and email on your commits by using the following commands: Feel free to use a "fake" username and email on your commits by using the following commands:
@ -21,6 +22,7 @@ git config --local user.name "USERNAME"
git config --local user.email "USERNAME@SOMETHING.com" git config --local user.email "USERNAME@SOMETHING.com"
``` ```
## Requirements ## Requirements
- Escape From Tarkov 33420 - Escape From Tarkov 33420
- Visual Studio Code -OR- Visual Studio 2022 - Visual Studio Code -OR- Visual Studio 2022

View File

@ -7,6 +7,7 @@ namespace SPT.Core.Utils
public static class ValidationUtil public static class ValidationUtil
{ {
public static string _crashHandler = "0"; public static string _crashHandler = "0";
private static bool _hasRun = false;
public static bool Validate() public static bool Validate()
{ {
@ -29,10 +30,14 @@ namespace SPT.Core.Utils
new FileInfo(Path.Combine(v2, "UnityCrashHandler64.exe")) new FileInfo(Path.Combine(v2, "UnityCrashHandler64.exe"))
}; };
if (!_hasRun)
{
_crashHandler = Gfs(v2, "UnityCrashHandler64.exe")?.Length.ToString() ?? "0"; _crashHandler = Gfs(v2, "UnityCrashHandler64.exe")?.Length.ToString() ?? "0";
ServerLog.Debug("SPT.Core", _crashHandler); ServerLog.Debug("SPT.Core", _crashHandler);
ServerLog.Debug("SPT.Core", Gfs(v2, "Uninstall.exe")?.Length.ToString() ?? "0"); ServerLog.Debug("SPT.Core", Gfs(v2, "Uninstall.exe")?.Length.ToString() ?? "0");
ServerLog.Debug("SPT.Core", Gfs(v2, "Register.bat")?.Length.ToString() ?? "0"); ServerLog.Debug("SPT.Core", Gfs(v2, "Register.bat")?.Length.ToString() ?? "0");
_hasRun = true;
}
v0 = v4.Length - 1; v0 = v4.Length - 1;

View File

@ -1,4 +1,5 @@
using EFT; using EFT;
using System.Collections.Generic;
namespace SPT.Custom.CustomAI namespace SPT.Custom.CustomAI
{ {
@ -33,5 +34,44 @@ namespace SPT.Custom.CustomAI
var nicknameContainsPScvCharacter = botOwner.Profile.Info.Nickname?.Contains("("); var nicknameContainsPScvCharacter = botOwner.Profile.Info.Nickname?.Contains("(");
return nicknameContainsPScvCharacter.HasValue && nicknameContainsPScvCharacter.Value && role == WildSpawnType.assault; return nicknameContainsPScvCharacter.HasValue && nicknameContainsPScvCharacter.Value && role == WildSpawnType.assault;
} }
public static List<BotOwner> GetAllMembers(this BotsGroup group)
{
List<BotOwner> members = new List<BotOwner>();
if (group != null)
{
for (int m = 0; m < group.MembersCount; m++)
{
members.Add(group.Member(m));
}
}
return members;
}
/// <summary>
/// Returns true if the player is found in the collection by searching for matching player Id's
/// </summary>
/// <param name="players"></param>
/// <param name="playerToCheck"></param>
/// <returns></returns>
public static bool ContainsPlayer(this IEnumerable<IPlayer> players, IPlayer playerToCheck)
{
if (playerToCheck == null)
{
return false;
}
foreach (IPlayer player in players)
{
if (player != null && player.Id == playerToCheck.Id)
{
return true;
}
}
return false;
}
} }
} }

View File

@ -95,9 +95,12 @@ namespace SPT.Custom.Patches
path = BundleManager.GetBundlePath(bundleInfo); path = BundleManager.GetBundlePath(bundleInfo);
// only download when connected externally // only download when connected externally
if (await BundleManager.ShouldReaquire(bundleInfo)) if (await BundleManager.ShouldAcquire(bundleInfo))
{
if (VFS.Exists(BundleManager.GetBundleFilePath(bundleInfo)))
{ {
VFS.DeleteFile(BundleManager.GetBundleFilePath(bundleInfo)); VFS.DeleteFile(BundleManager.GetBundleFilePath(bundleInfo));
}
await BundleManager.DownloadBundle(bundleInfo); await BundleManager.DownloadBundle(bundleInfo);
} }

View File

@ -51,7 +51,8 @@ namespace SPT.Custom.Utils
await VFS.WriteFileAsync(filepath, data); await VFS.WriteFileAsync(filepath, data);
} }
public static async Task<bool> ShouldReaquire(BundleItem bundle) // Handles both the check for initially acquiring and also re-acquiring a file.
public static async Task<bool> ShouldAcquire(BundleItem bundle)
{ {
// read cache // read cache
var filepath = GetBundleFilePath(bundle); var filepath = GetBundleFilePath(bundle);