Clear chat after meeting

This commit is contained in:
D1GQ committed 2025-01-20 11:56:25 -06:00
1 parent d5aa092852
commit 2841974d22
3 files changed
+14 -1

No files matched your search

+5
View File
@@ -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
{
+3 -1
View File
@@ -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;
+6
View File
@@ -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();
}
}
}