Fix Player Stuck In Some Gamemodes For Starlight (#513)

* Try Fix Player Stuck In Some Gamemodes For Starlight

* Remove RoomRush from conditions

* Change
This commit is contained in:
TommyXL authored and GitHub committed 2026-03-20 08:04:44 +01:00
1 parent de3d0c0c1b
commit 1f5dad0f93
1 file changed
+18 -2
+18 -2
View File
@@ -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<byte> 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;
}