mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-19 15:51:52 +00:00
Better vent tracking and chat censoring
This commit is contained in:
1 parent
e63ffc152d
commit
6e648692a8
7 files changed
+64
-26
No files matched your search
@@ -253,18 +253,20 @@ internal static class PlayerControlHelper
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
if (player.inVent || player.walkingToVent)
|
||||
return true;
|
||||
if (player.IsLocalPlayer())
|
||||
{
|
||||
return player.inVent || player.walkingToVent;
|
||||
}
|
||||
else
|
||||
{
|
||||
var extendedData = player.ExtendedData();
|
||||
if (extendedData != null)
|
||||
{
|
||||
return extendedData.GameplayInfo.InVent;
|
||||
}
|
||||
}
|
||||
|
||||
var physics = player.MyPhysics;
|
||||
if (physics == null)
|
||||
return false;
|
||||
|
||||
var animations = physics.Animations;
|
||||
if (animations == null)
|
||||
return false;
|
||||
|
||||
return animations.IsPlayingEnterVentAnimation();
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,6 +2,7 @@ using AmongUs.GameOptions;
|
||||
using BetterAmongUs.Attributes;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Managers;
|
||||
using BetterAmongUs.Mono.Extended;
|
||||
using Hazel;
|
||||
|
||||
namespace BetterAmongUs.Modules.AntiCheat.RPCHandlers;
|
||||
@@ -21,4 +22,9 @@ internal sealed class EnterVentHandler : RPCHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Handle(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
sender.ExtendedData().GameplayInfo.InVent = true;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using AmongUs.GameOptions;
|
||||
using BetterAmongUs.Attributes;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Managers;
|
||||
using BetterAmongUs.Mono.Extended;
|
||||
using Hazel;
|
||||
|
||||
namespace BetterAmongUs.Modules.AntiCheat.RPCHandlers;
|
||||
@@ -21,4 +22,9 @@ internal sealed class ExitVentHandler : RPCHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Handle(PlayerControl? sender, MessageReader reader)
|
||||
{
|
||||
sender.ExtendedData().GameplayInfo.InVent = false;
|
||||
}
|
||||
}
|
||||
@@ -151,12 +151,18 @@ internal sealed class ExtendedPlayerInfo : MonoBehaviour, IMonoExtension<Network
|
||||
/// </summary>
|
||||
[HideFromIl2Cpp]
|
||||
internal ExtendedAntiCheatInfo? AntiCheatInfo { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets extended gameplay information.
|
||||
/// </summary>
|
||||
[HideFromIl2Cpp]
|
||||
internal ExtendedGameplayInfo? GameplayInfo { get; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains anti-cheat monitoring information for a player.
|
||||
/// </summary>
|
||||
internal class ExtendedAntiCheatInfo
|
||||
internal sealed class ExtendedAntiCheatInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum allowed RPCs per second.
|
||||
@@ -222,7 +228,7 @@ internal class ExtendedAntiCheatInfo
|
||||
/// <summary>
|
||||
/// Contains extended role information for a player.
|
||||
/// </summary>
|
||||
internal class ExtendedRoleInfo
|
||||
internal sealed class ExtendedRoleInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the number of kills.
|
||||
@@ -240,6 +246,17 @@ internal class ExtendedRoleInfo
|
||||
internal RoleTypes DeadDisplayRole { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the gameplay information for a player.
|
||||
/// </summary>
|
||||
internal sealed class ExtendedGameplayInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the player is currently in a vent.
|
||||
/// </summary>
|
||||
internal bool InVent { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for accessing extended player data.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using BepInEx.Unity.IL2CPP.Utils;
|
||||
using BetterAmongUs.Data.Config;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Managers;
|
||||
using BetterAmongUs.Modules;
|
||||
@@ -111,11 +110,8 @@ internal static class ClientPatch
|
||||
[HarmonyPostfix]
|
||||
private static void AmongUsClient_CoStartGame_Postfix(AmongUsClient __instance)
|
||||
{
|
||||
// Clear in-game chat if chat feature is enabled
|
||||
if (BAUConfigs.ChatInGameplay.Value)
|
||||
{
|
||||
ChatPatch.ClearChat();
|
||||
}
|
||||
// Censor in-game chat
|
||||
ChatPatch.CensorPlayerChats();
|
||||
|
||||
// Start custom loading sequence
|
||||
__instance.StartCoroutine(CoLoading());
|
||||
|
||||
@@ -5,6 +5,7 @@ using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Modules.OptionItems;
|
||||
using BetterAmongUs.Mono.Extended;
|
||||
using BetterAmongUs.Patches.Gameplay.UI.Chat;
|
||||
using HarmonyLib;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
@@ -56,6 +57,16 @@ internal static class PlayerControlPatch
|
||||
OptionPlayerItem.UpdateAllValues();
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.Die))]
|
||||
[HarmonyPostfix]
|
||||
private static void PlayerControl_Die_Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (__instance.IsLocalPlayer())
|
||||
{
|
||||
ChatPatch.UncensorPlayerChats();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.MurderPlayer))]
|
||||
[HarmonyPostfix]
|
||||
private static void PlayerControl_MurderPlayer_Postfix(PlayerControl __instance, PlayerControl target)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using BetterAmongUs.Data.Config;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Mono;
|
||||
@@ -17,7 +16,8 @@ internal static class MeetingHudPatch
|
||||
[HarmonyPostfix]
|
||||
private static void MeetingHud_Start_Postfix(MeetingHud __instance)
|
||||
{
|
||||
if (BAUConfigs.ChatInGameplay.Value && PlayerControl.LocalPlayer.IsAlive())
|
||||
// Uncensor chats when meeting starts
|
||||
if (PlayerControl.LocalPlayer.IsAlive())
|
||||
{
|
||||
ChatPatch.UncensorPlayerChats();
|
||||
}
|
||||
@@ -92,13 +92,13 @@ internal static class MeetingHudPatch
|
||||
[HarmonyPostfix]
|
||||
private static void MeetingHud_Close_Postfix()
|
||||
{
|
||||
timeOpen = 0f;
|
||||
Logger_.LogHeader("Meeting Has Ended");
|
||||
|
||||
// Clear chat when meeting ends if gameplay chat is enabled
|
||||
if (BAUConfigs.ChatInGameplay.Value && PlayerControl.LocalPlayer.IsAlive())
|
||||
// Censor chats when meeting ends
|
||||
if (PlayerControl.LocalPlayer.IsAlive())
|
||||
{
|
||||
ChatPatch.CensorPlayerChats();
|
||||
}
|
||||
|
||||
timeOpen = 0f;
|
||||
Logger_.LogHeader("Meeting Has Ended");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user