mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-04 15:29:22 +00:00
Move many mods to Deprecated folder, fix spelling
This commit is contained in:
parent
5e822cec8d
commit
0042590aa6
539 changed files with 7475 additions and 3120 deletions
|
@ -0,0 +1,38 @@
|
|||
using ABI_RC.Core.Player;
|
||||
|
||||
namespace NAK.BetterContentLoading;
|
||||
|
||||
public partial class DownloadManager
|
||||
{
|
||||
private float CalculatePriority(DownloadTask task)
|
||||
{
|
||||
return task.Type switch
|
||||
{
|
||||
DownloadTaskType.Avatar => CalculateAvatarPriority(task),
|
||||
// DownloadTaskType.Prop => CalculatePropPriority(task2),
|
||||
// DownloadTaskType.World => CalculateWorldPriority(task2),
|
||||
_ => task.Info.FileSize
|
||||
};
|
||||
}
|
||||
|
||||
private float CalculateAvatarPriority(DownloadTask task)
|
||||
{
|
||||
float priority = task.Info.FileSize;
|
||||
|
||||
foreach (string target in task.InstantiationTargets)
|
||||
{
|
||||
if (IsPlayerLocal(target)) return 0f;
|
||||
|
||||
if (!TryGetPlayerEntity(target, out CVRPlayerEntity player))
|
||||
return priority;
|
||||
|
||||
if (PrioritizeFriends && IsPlayerFriend(target))
|
||||
priority *= 0.5f;
|
||||
|
||||
if (PrioritizeDistance && IsPlayerWithinPriorityDistance(player))
|
||||
priority *= 0.75f;
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue