From 7036aac0b0af3963c03ade14fcc8c27ec3bd11ff Mon Sep 17 00:00:00 2001 From: Ape <155788660+ApeMV@users.noreply.github.com> Date: Thu, 4 Dec 2025 19:07:47 +0100 Subject: [PATCH] First patches --- LateTask.cs => Modules/LateTask.cs | 0 LogHandler.cs => Modules/LogHandler.cs | 0 Modules/Utils.cs | 8 +++++ Patches/GameStartManagerPatch.cs | 12 ++++++++ Patches/NumberOptionsPatch.cs | 42 ++++++++++++++++++++++++++ 5 files changed, 62 insertions(+) rename LateTask.cs => Modules/LateTask.cs (100%) rename LogHandler.cs => Modules/LogHandler.cs (100%) create mode 100644 Modules/Utils.cs create mode 100644 Patches/GameStartManagerPatch.cs create mode 100644 Patches/NumberOptionsPatch.cs diff --git a/LateTask.cs b/Modules/LateTask.cs similarity index 100% rename from LateTask.cs rename to Modules/LateTask.cs diff --git a/LogHandler.cs b/Modules/LogHandler.cs similarity index 100% rename from LogHandler.cs rename to Modules/LogHandler.cs diff --git a/Modules/Utils.cs b/Modules/Utils.cs new file mode 100644 index 0000000..ea29a3f --- /dev/null +++ b/Modules/Utils.cs @@ -0,0 +1,8 @@ +using AmongUs.GameOptions; + +namespace HNSRevamped; + +public static class Utils +{ + public static bool isHideNSeek => GameOptionsManager.Instance.CurrentGameOptions.GameMode == GameModes.HideNSeek; +} \ No newline at end of file diff --git a/Patches/GameStartManagerPatch.cs b/Patches/GameStartManagerPatch.cs new file mode 100644 index 0000000..9544c47 --- /dev/null +++ b/Patches/GameStartManagerPatch.cs @@ -0,0 +1,12 @@ +using HarmonyLib; + +namespace HNSRevamped; + +[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Update))] +public static class GameStartManagerUpdatePatch +{ + public static void Prefix(GameStartManager __instance) + { + __instance.MinPlayers = 1; + } +} \ No newline at end of file diff --git a/Patches/NumberOptionsPatch.cs b/Patches/NumberOptionsPatch.cs new file mode 100644 index 0000000..fc882f9 --- /dev/null +++ b/Patches/NumberOptionsPatch.cs @@ -0,0 +1,42 @@ +using HarmonyLib; +using AmongUs.GameOptions; + +namespace HNSRevamped; + +// https://github.com/astra1dev/AUnlocker/blob/main/src/OptionsPatches.cs + +[HarmonyPatch(typeof(NumberOption), nameof(NumberOption.Increase))] +public static class NumberOption_Increase +{ + public static bool Prefix(NumberOption __instance) + { + __instance.Value += __instance.Increment; + __instance.UpdateValue(); + __instance.OnValueChanged.Invoke(__instance); + __instance.AdjustButtonsActiveState(); + return false; + } +} + +[HarmonyPatch(typeof(NumberOption), nameof(NumberOption.Decrease))] +public static class NumberOption_Decrease +{ + public static bool Prefix(NumberOption __instance) + { + __instance.Value -= __instance.Increment; + __instance.UpdateValue(); + __instance.OnValueChanged.Invoke(__instance); + __instance.AdjustButtonsActiveState(); + return false; + + } +} + +[HarmonyPatch(typeof(NumberOption), nameof(NumberOption.Initialize))] +public static class NumberOption_Initialize +{ + public static void Postfix(NumberOption __instance) + { + __instance.ValidRange = new FloatRange(-999f, 999f); + } +} \ No newline at end of file