From 1f5dad0f933dcaa7c46c7afe89aae3e1256fbcdf Mon Sep 17 00:00:00 2001 From: TommyXL <104814436+Tommy-XL@users.noreply.github.com> Date: Fri, 20 Mar 2026 15:04:44 +0800 Subject: [PATCH] Fix Player Stuck In Some Gamemodes For Starlight (#513) * Try Fix Player Stuck In Some Gamemodes For Starlight * Remove RoomRush from conditions * Change --- Patches/TaskAssignPatch.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Patches/TaskAssignPatch.cs b/Patches/TaskAssignPatch.cs index 6fd35bfad..4ff1b54d7 100644 --- a/Patches/TaskAssignPatch.cs +++ b/Patches/TaskAssignPatch.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Linq; +using System; using AmongUs.GameOptions; using EHR.Modules; using EHR.Roles; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; -using Random = UnityEngine.Random; namespace EHR; @@ -133,6 +133,22 @@ internal static class RpcSetTasksPatch // Do not interfere with vanilla task allocation process itself public static void Prefix(NetworkedPlayerInfo __instance, [HarmonyArgument(0)] ref Il2CppStructArray taskTypeIds) { + // Skip some Gamemodes if host play in android (Vanilla assign task itself) + if (OperatingSystem.IsAndroid() && Options.CurrentGameMode is + CustomGameMode.SoloPVP or + CustomGameMode.FFA or + CustomGameMode.HotPotato or + CustomGameMode.NaturalDisasters or + CustomGameMode.RoomRush or + CustomGameMode.Quiz or + CustomGameMode.CaptureTheFlag or + CustomGameMode.KingOfTheZones or + CustomGameMode.TheMindGame or + CustomGameMode.BedWars or + CustomGameMode.Deathrace or + CustomGameMode.Mingle or + CustomGameMode.Snowdown) return; + // Null measures if (Main.RealOptionsData == null) { @@ -283,7 +299,7 @@ internal static class RpcSetTasksPatch for (var i = 0; i < list.Count - 1; i++) { T obj = list[i]; - int rand = Random.Range(i, list.Count); + int rand = IRandom.Instance.Next(i, list.Count); list[i] = list[rand]; list[rand] = obj; }