fix: features not working with >4 players

very unoptimal but that's in a corroutine ig that's fine
This commit is contained in:
2023-03-08 08:50:30 +01:00
parent 7080c72eec
commit 158afd9bd2
2 changed files with 3 additions and 5 deletions

View File

@@ -166,8 +166,6 @@ namespace DevourClient.Hacks
public static void CreateCustomizedLobby(int lobbySize = 4, bool isPrivate = false, Il2CppUdpKit.Platform.Photon.PhotonRegion.Regions __region = Il2CppUdpKit.Platform.Photon.PhotonRegion.Regions.BEST_REGION) public static void CreateCustomizedLobby(int lobbySize = 4, bool isPrivate = false, Il2CppUdpKit.Platform.Photon.PhotonRegion.Regions __region = Il2CppUdpKit.Platform.Photon.PhotonRegion.Regions.BEST_REGION)
{ {
Entities.MAX_PLAYERS = lobbySize; //max players in the lobby
Il2CppHorror.Menu _menu = UnityEngine.Object.FindObjectOfType<Il2CppHorror.Menu>(); Il2CppHorror.Menu _menu = UnityEngine.Object.FindObjectOfType<Il2CppHorror.Menu>();
CanvasGroup _loadingCanvasGroup = _menu.loadingCanvasGroup; CanvasGroup _loadingCanvasGroup = _menu.loadingCanvasGroup;

View File

@@ -147,8 +147,7 @@ namespace DevourClient.Helpers
public static int MAX_PLAYERS = 4; //will change by calling CreateCustomizedLobby public static int MAX_PLAYERS = 4; //will change by calling CreateCustomizedLobby
public static BasePlayer LocalPlayer_ = new BasePlayer(); public static BasePlayer LocalPlayer_ = new BasePlayer();
public static BasePlayer[] Players = new BasePlayer[MAX_PLAYERS]; //i hope this doesn't break public static BasePlayer[] Players = default!;
//public static GameObject[] Players = default!;
public static Il2Cpp.GoatBehaviour[] GoatsAndRats = default!; public static Il2Cpp.GoatBehaviour[] GoatsAndRats = default!;
public static Il2Cpp.SurvivalInteractable[] SurvivalInteractables = default!; public static Il2Cpp.SurvivalInteractable[] SurvivalInteractables = default!;
public static Il2Cpp.KeyBehaviour[] Keys = default!; public static Il2Cpp.KeyBehaviour[] Keys = default!;
@@ -184,6 +183,7 @@ namespace DevourClient.Helpers
for (;;) for (;;)
{ {
GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
Players = new BasePlayer[players.Length];
int i = 0; int i = 0;
foreach (GameObject p in players) foreach (GameObject p in players)