mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
idk
This commit is contained in:
parent
83c101f5ee
commit
1acf58d161
5 changed files with 88 additions and 38 deletions
54
BadAnimatorFix/BadAnimatorFixManager.cs
Normal file
54
BadAnimatorFix/BadAnimatorFixManager.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using ABI_RC.Core.IO;
|
||||
|
||||
namespace NAK.Melons.BadAnimatorFix;
|
||||
|
||||
public static class BadAnimatorFixManager
|
||||
{
|
||||
public static List<BadAnimatorFix> badAnimatorFixes = new List<BadAnimatorFix>();
|
||||
private static int currentIndex = 0;
|
||||
|
||||
public static void Add(BadAnimatorFix bad)
|
||||
{
|
||||
if (!badAnimatorFixes.Contains(bad))
|
||||
{
|
||||
badAnimatorFixes.Add(bad);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Remove(BadAnimatorFix bad)
|
||||
{
|
||||
if (badAnimatorFixes.Contains(bad))
|
||||
{
|
||||
badAnimatorFixes.Remove(bad);
|
||||
}
|
||||
}
|
||||
|
||||
// Runs every 5 seconds to see if an animator has played longer than PlayableTimeLimit
|
||||
public static void CheckNextAnimator()
|
||||
{
|
||||
if (badAnimatorFixes.Count == 0) return;
|
||||
|
||||
if (currentIndex >= badAnimatorFixes.Count) currentIndex = 0;
|
||||
|
||||
BadAnimatorFix currentAnimatorFix = badAnimatorFixes[currentIndex];
|
||||
if (currentAnimatorFix.GetTime() > BadAnimatorFixMod.EntryPlayableTimeLimit.Value)
|
||||
{
|
||||
currentAnimatorFix.AttemptRewindAnimator();
|
||||
}
|
||||
|
||||
currentIndex++;
|
||||
}
|
||||
|
||||
public static void ToggleJob(bool enable)
|
||||
{
|
||||
var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "CheckNextAnimator").Job;
|
||||
if (enable && job == null)
|
||||
{
|
||||
SchedulerSystem.AddJob(new SchedulerSystem.Job(BadAnimatorFixManager.CheckNextAnimator), 0f, 5f, -1);
|
||||
}
|
||||
else if (!enable && job != null)
|
||||
{
|
||||
SchedulerSystem.RemoveJob(job);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue