add: now using coroutines for demons

This commit is contained in:
ALittlePatate
2022-09-10 22:02:23 +02:00
parent 73aa8806ad
commit 1a306e5ee1
2 changed files with 42 additions and 3 deletions

View File

@@ -48,6 +48,9 @@ namespace DevourClient.Helpers
public static GoatBehaviour[] GoatsAndRats; public static GoatBehaviour[] GoatsAndRats;
public static SurvivalInteractable[] SurvivalInteractables; public static SurvivalInteractable[] SurvivalInteractables;
public static KeyBehaviour[] Keys; public static KeyBehaviour[] Keys;
public static SurvivalDemonBehaviour[] Demons;
public static SpiderBehaviour[] Spiders;
public static GhostBehaviour[] Ghosts;
public static IEnumerator GetLocalPlayer() public static IEnumerator GetLocalPlayer()
{ {
@@ -115,5 +118,38 @@ namespace DevourClient.Helpers
yield return new WaitForSeconds(5f); yield return new WaitForSeconds(5f);
} }
} }
public static IEnumerator GetDemons()
{
for (;;)
{
Demons = SurvivalDemonBehaviour.FindObjectsOfType<SurvivalDemonBehaviour>();
// Wait 5 seconds before caching objects again.
yield return new WaitForSeconds(5f);
}
}
public static IEnumerator GetSpiders()
{
for (;;)
{
Spiders = SpiderBehaviour.FindObjectsOfType<SpiderBehaviour>();
// Wait 5 seconds before caching objects again.
yield return new WaitForSeconds(5f);
}
}
public static IEnumerator GetGhosts()
{
for (;;)
{
Ghosts = GhostBehaviour.FindObjectsOfType<GhostBehaviour>();
// Wait 5 seconds before caching objects again.
yield return new WaitForSeconds(5f);
}
}
} }
} }

View File

@@ -43,6 +43,9 @@ namespace DevourClient
MelonCoroutines.Start(Helpers.Entities.GetGoatsAndRats()); MelonCoroutines.Start(Helpers.Entities.GetGoatsAndRats());
MelonCoroutines.Start(Helpers.Entities.GetSurvivalInteractables()); MelonCoroutines.Start(Helpers.Entities.GetSurvivalInteractables());
MelonCoroutines.Start(Helpers.Entities.GetKeys()); MelonCoroutines.Start(Helpers.Entities.GetKeys());
MelonCoroutines.Start(Helpers.Entities.GetDemons());
MelonCoroutines.Start(Helpers.Entities.GetSpiders());
MelonCoroutines.Start(Helpers.Entities.GetGhosts());
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -276,7 +279,7 @@ namespace DevourClient
if (this.demon_esp) if (this.demon_esp)
{ {
foreach (SurvivalDemonBehaviour demon in UnityEngine.Object.FindObjectsOfType<SurvivalDemonBehaviour>() as UnhollowerBaseLib.Il2CppReferenceArray<SurvivalDemonBehaviour>) foreach (SurvivalDemonBehaviour demon in Helpers.Entities.Demons)
{ {
if (demon != null) if (demon != null)
{ {
@@ -305,7 +308,7 @@ namespace DevourClient
} }
} }
foreach (SpiderBehaviour spider in UnityEngine.Object.FindObjectsOfType<SpiderBehaviour>() as UnhollowerBaseLib.Il2CppReferenceArray<SpiderBehaviour>) foreach (SpiderBehaviour spider in Helpers.Entities.Spiders)
{ {
if (spider != null) if (spider != null)
{ {
@@ -334,7 +337,7 @@ namespace DevourClient
} }
} }
foreach (GhostBehaviour ghost in UnityEngine.Object.FindObjectsOfType<GhostBehaviour>() as UnhollowerBaseLib.Il2CppReferenceArray<GhostBehaviour>) foreach (GhostBehaviour ghost in Helpers.Entities.Ghosts)
{ {
if (ghost != null) if (ghost != null)
{ {