add: using coroutines for players
This commit is contained in:
@@ -45,6 +45,7 @@ namespace DevourClient.Helpers
|
|||||||
public class Entities
|
public class Entities
|
||||||
{
|
{
|
||||||
public static GameObject LocalPlayer_;
|
public static GameObject LocalPlayer_;
|
||||||
|
public static GameObject[] Players;
|
||||||
public static GoatBehaviour[] GoatsAndRats;
|
public static GoatBehaviour[] GoatsAndRats;
|
||||||
public static SurvivalInteractable[] SurvivalInteractables;
|
public static SurvivalInteractable[] SurvivalInteractables;
|
||||||
public static KeyBehaviour[] Keys;
|
public static KeyBehaviour[] Keys;
|
||||||
@@ -73,18 +74,15 @@ namespace DevourClient.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<GameObject> GetAllPlayers()
|
public static IEnumerator GetAllPlayers()
|
||||||
{
|
{
|
||||||
GameObject[] currentPlayers = GameObject.FindGameObjectsWithTag("Player");
|
for (;;)
|
||||||
List<GameObject> result = new List<GameObject>();
|
|
||||||
|
|
||||||
for (int i = 0; i < currentPlayers.Length; i++)
|
|
||||||
{
|
{
|
||||||
result.Add(currentPlayers[i]);
|
Players = GameObject.FindGameObjectsWithTag("Player");
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
// Wait 5 seconds before caching objects again.
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerator GetGoatsAndRats()
|
public static IEnumerator GetGoatsAndRats()
|
||||||
@@ -153,7 +151,7 @@ namespace DevourClient.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerator GeAzazels()
|
public static IEnumerator GetAzazels()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* ikr AzazelS, because in case we spawn multiple we want the esp to render all of them
|
* ikr AzazelS, because in case we spawn multiple we want the esp to render all of them
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ namespace DevourClient
|
|||||||
MelonCoroutines.Start(Helpers.Entities.GetDemons());
|
MelonCoroutines.Start(Helpers.Entities.GetDemons());
|
||||||
MelonCoroutines.Start(Helpers.Entities.GetSpiders());
|
MelonCoroutines.Start(Helpers.Entities.GetSpiders());
|
||||||
MelonCoroutines.Start(Helpers.Entities.GetGhosts());
|
MelonCoroutines.Start(Helpers.Entities.GetGhosts());
|
||||||
MelonCoroutines.Start(Helpers.Entities.GeAzazels());
|
MelonCoroutines.Start(Helpers.Entities.GetAzazels());
|
||||||
|
MelonCoroutines.Start(Helpers.Entities.GetAllPlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -150,7 +151,7 @@ namespace DevourClient
|
|||||||
{
|
{
|
||||||
if (this.player_esp || this.player_snapline)
|
if (this.player_esp || this.player_snapline)
|
||||||
{
|
{
|
||||||
foreach (NolanBehaviour player in UnityEngine.Object.FindObjectsOfType<NolanBehaviour>() as UnhollowerBaseLib.Il2CppReferenceArray<NolanBehaviour>)
|
foreach (GameObject player in Helpers.Entities.Players)
|
||||||
{
|
{
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
@@ -172,7 +173,7 @@ namespace DevourClient
|
|||||||
{
|
{
|
||||||
//string playername = player.field_Private_PhotonView_0.field_Private_ObjectPublicObInBoStBoHaStObInHaUnique_0.field_Private_String_0;//player.photonView._Controller_k__BackingField.NickName;
|
//string playername = player.field_Private_PhotonView_0.field_Private_ObjectPublicObInBoStBoHaStObInHaUnique_0.field_Private_String_0;//player.photonView._Controller_k__BackingField.NickName;
|
||||||
|
|
||||||
if (player.entity.IsOwner)
|
if (player.GetComponent<NolanBehaviour>().entity.IsOwner)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user