few fixes

This commit is contained in:
Gurge44 committed 2026-10-09 09:11:27 +02:00
1 parent ed6ebed013
commit bedb16d1a1
7 files changed
+49 -23

No files matched your search

+10 -1
View File
@@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using AmongUs.GameOptions; using AmongUs.GameOptions;
using EHR.Modules; using EHR.Modules;
@@ -510,6 +511,8 @@ public static class Deathrace
public static class FixedUpdatePatch public static class FixedUpdatePatch
{ {
private static Stopwatch NotifyTimer = new();
public static void Postfix() public static void Postfix()
{ {
if (!AmongUsClient.Instance.AmHost || !GameGoing || GameStates.IsEnded) return; if (!AmongUsClient.Instance.AmHost || !GameGoing || GameStates.IsEnded) return;
@@ -612,6 +615,12 @@ public static class Deathrace
} }
Data.Remove(removeId); Data.Remove(removeId);
if (NotifyTimer.Elapsed.TotalSeconds >= 1)
{
NotifyTimer.Reset();
Utils.NotifyRoles();
}
} }
private static void CheckAndNotify(PlayerData data) private static void CheckAndNotify(PlayerData data)
@@ -620,7 +629,7 @@ public static class Deathrace
if (data.LastSuffix != suffix) if (data.LastSuffix != suffix)
{ {
Utils.NotifyRoles(SpecifySeer: data.Player, SpecifyTarget: data.Player); NotifyTimer.Start();
data.LastSuffix = suffix; data.LastSuffix = suffix;
} }
} }
+2 -2
View File
@@ -53,8 +53,8 @@ public class Main : BaseUnityPlugin
private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d"; private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d";
private const string DebugKeySalt = "59687b"; private const string DebugKeySalt = "59687b";
public const string PluginGuid = "com.gurge44.endlesshostroles"; public const string PluginGuid = "com.gurge44.endlesshostroles";
public const string PluginVersion = "8.0.2"; public const string PluginVersion = "8.0.3";
public const string PluginDisplayVersion = "8.0.2"; public const string PluginDisplayVersion = "8.0.3";
public const int TestBuildNumber = 0; // 0 = Release public const int TestBuildNumber = 0; // 0 = Release
public const string NeutralColor = "#ffab1b"; public const string NeutralColor = "#ffab1b";
+8 -1
View File
@@ -1,5 +1,7 @@
using System; using System;
#if !IL2CPP
using System.Collections; using System.Collections;
#endif
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AmongUs.Data; using AmongUs.Data;
@@ -15,9 +17,11 @@ namespace EHR;
[HarmonyPatch(typeof(ChatController), nameof(ChatController.Awake))] [HarmonyPatch(typeof(ChatController), nameof(ChatController.Awake))]
static class ChatControllerAwakePatch static class ChatControllerAwakePatch
{ {
#if !IL2CPP
private static SpriteRenderer QuickChatIcon; private static SpriteRenderer QuickChatIcon;
private static SpriteRenderer OpenBanMenuIcon; private static SpriteRenderer OpenBanMenuIcon;
private static SpriteRenderer OpenKeyboardIcon; private static SpriteRenderer OpenKeyboardIcon;
#endif
public static readonly Color32 DarkBackgroundColor = new(40, 40, 40, byte.MaxValue); public static readonly Color32 DarkBackgroundColor = new(40, 40, 40, byte.MaxValue);
@@ -36,6 +40,7 @@ static class ChatControllerAwakePatch
chatBubble.TextArea.color = Color.white; chatBubble.TextArea.color = Color.white;
chatBubble.Background.color = new(0.1f, 0.1f, 0.1f, 1f); chatBubble.Background.color = new(0.1f, 0.1f, 0.1f, 1f);
#if !IL2CPP
__instance.freeChatField.background.color = DarkBackgroundColor; __instance.freeChatField.background.color = DarkBackgroundColor;
if (!TextBoxPatch.IsInvalidCommand) if (!TextBoxPatch.IsInvalidCommand)
@@ -48,10 +53,11 @@ static class ChatControllerAwakePatch
__instance.quickChatField.text.color = Color.white; __instance.quickChatField.text.color = Color.white;
Main.Instance.StartCoroutine(Coroutine()); Main.Instance.StartCoroutine(Coroutine());
#endif
} }
else else
__instance.freeChatField.textArea.outputText.color = Color.black; __instance.freeChatField.textArea.outputText.color = Color.black;
#if !IL2CPP
return; return;
IEnumerator Coroutine() IEnumerator Coroutine()
@@ -81,6 +87,7 @@ static class ChatControllerAwakePatch
yield return null; yield return null;
} }
} }
#endif
} }
} }
+6 -9
View File
@@ -959,7 +959,9 @@ internal static class MapRoomDoorsStartPatch
} }
} }
} }
#if !IL2CPP
[HarmonyPatch(typeof(MapRoom), nameof(MapRoom.DoorsUpdate))] [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.DoorsUpdate))]
#endif
internal static class MapRoomDoorsUpdatePatch internal static class MapRoomDoorsUpdatePatch
{ {
public static Dictionary<SystemTypes, TextMeshPro> DoorTimerTexts = []; public static Dictionary<SystemTypes, TextMeshPro> DoorTimerTexts = [];
@@ -1002,16 +1004,11 @@ internal static class MapRoomDoorsUpdatePatch
goto Skip; goto Skip;
} }
foreach (OpenableDoor door in shipStatusInstance.AllDoors) if (AutoOpenDoors.TryGetValue(room, out AutoOpenDoor autoOpenDoor) && autoOpenDoor)
{ {
if (door.Room != room) continue; total = 30f;
timer = autoOpenDoor.CooldownTimer;
if (AutoOpenDoors.TryGetValue(room, out AutoOpenDoor autoOpenDoor) && autoOpenDoor) goto Skip;
{
total = 30f;
timer = autoOpenDoor.CooldownTimer;
goto Skip;
}
} }
} }
+4 -3
View File
@@ -1384,9 +1384,10 @@ internal static class MeetingHudOnDestroyPatch
try try
{ {
foreach (PlayerControl pc in Main.CachedAlivePlayerControls()) if (CheckForEndVotingPatch.CommsWasCalled || Utils.IsAnySabotageActive())
if (pc.Is(CustomRoles.Evader)) foreach (PlayerControl pc in Main.CachedAlivePlayerControls())
pc.RpcMakeInvisible(); if (pc.Is(CustomRoles.Evader))
pc.RpcMakeInvisible();
} }
catch (Exception e) { Utils.ThrowException(e); } catch (Exception e) { Utils.ThrowException(e); }
+13 -6
View File
@@ -58,9 +58,7 @@ public static class TextBoxPatch
{ {
Destroy(); Destroy();
IsInvalidCommand = false; IsInvalidCommand = false;
Color textColor = Main.DarkTheme.Value ? Color.white : Color.black; ResetTextColor(__instance);
__instance.compoText.Color(textColor);
__instance.outputText.color = textColor;
return; return;
} }
@@ -126,9 +124,7 @@ public static class TextBoxPatch
if (IsInvalidCommand) if (IsInvalidCommand)
{ {
IsInvalidCommand = false; IsInvalidCommand = false;
Color textColor = Main.DarkTheme.Value ? Color.white : Color.black; ResetTextColor(__instance);
__instance.compoText.Color(textColor);
__instance.outputText.color = textColor;
} }
HudManager hud = HudManager.Instance; HudManager hud = HudManager.Instance;
@@ -300,6 +296,17 @@ public static class TextBoxPatch
} }
} }
private static void ResetTextColor(TextBoxTMP __instance)
{
#if IL2CPP
Color textColor = Color.black;
#else
Color textColor = Main.DarkTheme.Value ? Color.white : Color.black;
#endif
__instance.compoText.Color(textColor);
__instance.outputText.color = textColor;
}
public static void OnTabPress(ChatController __instance) public static void OnTabPress(ChatController __instance)
{ {
if (!PlaceHolderText || PlaceHolderText.text == "") return; if (!PlaceHolderText || PlaceHolderText.text == "") return;
+6 -1
View File
@@ -36,6 +36,11 @@ public class Hypocrite : RoleBase
HypocritePC = playerId.GetPlayer(); HypocritePC = playerId.GetPlayer();
} }
public override bool CanUseKillButton(PlayerControl pc)
{
return false;
}
public override void OnTaskComplete(PlayerControl pc, int completedTaskCount, int totalTaskCount) public override void OnTaskComplete(PlayerControl pc, int completedTaskCount, int totalTaskCount)
{ {
if (!pc.IsAlive()) return; if (!pc.IsAlive()) return;
@@ -63,7 +68,7 @@ public class Hypocrite : RoleBase
public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false) public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false)
{ {
if (seer.PlayerId != target.PlayerId || hud || seer.Is(Team.Impostor) || meeting || HypocritePC == null || !HypocritePC.IsAlive() || !seer.IsAlive()) return string.Empty; if (seer.PlayerId != target.PlayerId || hud || seer.Is(Team.Impostor) || meeting || !HypocritePC || !HypocritePC.IsAlive() || !seer.IsAlive()) return string.Empty;
TaskState ts = HypocritePC.GetTaskState(); TaskState ts = HypocritePC.GetTaskState();
if (!NonImpGetsNotifyWhenLowTasks.GetBool() || ts.RemainingTasksCount > NotifyAtXTasksLeft.GetInt()) return string.Empty; if (!NonImpGetsNotifyWhenLowTasks.GetBool() || ts.RemainingTasksCount > NotifyAtXTasksLeft.GetInt()) return string.Empty;