mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Add DataFlagRateLimiter
This commit is contained in:
1 parent
f4f54fbc46
commit
7650ac302d
10 files changed
+656
-472
No files matched your search
@@ -1,26 +1,24 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using AmongUs.GameOptions;
|
||||
using Hazel;
|
||||
using Il2CppInterop.Runtime.InteropTypes.Arrays;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
using static EHR.GameStates;
|
||||
using Hazel;
|
||||
using Il2CppInterop.Runtime.InteropTypes.Arrays;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EHR.Modules;
|
||||
|
||||
public abstract class GameOptionsSender
|
||||
{
|
||||
protected abstract bool IsDirty { get; set; }
|
||||
protected abstract bool IsDirty { get; set; }
|
||||
|
||||
protected virtual int TargetClientId => -1;
|
||||
|
||||
private Il2CppStructArray<byte> BuildOptionArray()
|
||||
{
|
||||
IGameOptions opt = BuildGameOptions();
|
||||
var currentGameMode = AprilFoolsMode.IsAprilFoolsModeToggledOn ? opt.AprilFoolsOnMode : opt.GameMode;
|
||||
private Il2CppStructArray<byte> BuildOptionArray()
|
||||
{
|
||||
IGameOptions opt = BuildGameOptions();
|
||||
var currentGameMode = AprilFoolsMode.IsAprilFoolsModeToggledOn ? opt.AprilFoolsOnMode : opt.GameMode;
|
||||
|
||||
// option => byte[]
|
||||
MessageWriter writer = MessageWriter.Get();
|
||||
@@ -79,7 +77,7 @@ public abstract class GameOptionsSender
|
||||
|
||||
private static void SendOptionsArray(Il2CppStructArray<byte> optionArray, byte logicOptionsIndex, int targetClientId)
|
||||
{
|
||||
try
|
||||
DataFlagRateLimiter.Enqueue(() =>
|
||||
{
|
||||
MessageWriter writer = MessageWriter.Get(SendOption.Reliable);
|
||||
|
||||
@@ -104,11 +102,10 @@ public abstract class GameOptionsSender
|
||||
|
||||
AmongUsClient.Instance.SendOrDisconnect(writer);
|
||||
writer.Recycle();
|
||||
}
|
||||
catch (Exception ex) { Logger.Fatal(ex.ToString(), "GameOptionsSender.SendOptionsArray"); }
|
||||
});
|
||||
}
|
||||
|
||||
public abstract IGameOptions BuildGameOptions();
|
||||
public abstract IGameOptions BuildGameOptions();
|
||||
|
||||
protected virtual bool AmValid()
|
||||
{
|
||||
@@ -172,4 +169,4 @@ public abstract class GameOptionsSender
|
||||
protected static bool ForceWaitFrame;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user