mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
Clear chat after meeting
This commit is contained in:
1 parent
d5aa092852
commit
2841974d22
3 files changed
+14
-1
No files matched your search
@@ -19,6 +19,11 @@ class ChatPatch
|
||||
public static List<string> ChatHistory = [];
|
||||
public static int CurrentHistorySelection = -1;
|
||||
|
||||
public static void ClearChat()
|
||||
{
|
||||
HudManager.Instance.Chat.chatBubblePool.ReclaimAll();
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.RpcSendChat))]
|
||||
class RpcSendChatPatch
|
||||
{
|
||||
|
||||
@@ -36,9 +36,11 @@ class CommandsPatch
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsOnCooldown = 3f - __instance.timeSinceLastMessage > 0f;
|
||||
|
||||
string text = __instance.freeChatField.textArea.text;
|
||||
|
||||
if (!text.StartsWith(CommandPrefix) || 3f - __instance.timeSinceLastMessage > 0f)
|
||||
if (!text.StartsWith(CommandPrefix) || IsOnCooldown)
|
||||
{
|
||||
if (GameState.IsInGame && !GameState.IsLobby && !GameState.IsFreePlay && !GameState.IsMeeting && !GameState.IsExilling && PlayerControl.LocalPlayer.IsAlive())
|
||||
return false;
|
||||
|
||||
@@ -2,6 +2,7 @@ using AmongUs.GameOptions;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Modules.AntiCheat;
|
||||
using BetterAmongUs.Patches;
|
||||
using HarmonyLib;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
@@ -220,5 +221,10 @@ class MeetingHudPatch
|
||||
{
|
||||
timeOpen = 0f;
|
||||
Logger.LogHeader("Meeting Has Ended");
|
||||
|
||||
if (Main.ChatInGameplay.Value && !GameState.IsFreePlay && PlayerControl.LocalPlayer.IsAlive())
|
||||
{
|
||||
ChatPatch.ClearChat();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user