From cddcb3f8338485cdb1bdfec73b7125b1f572a0b0 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Sat, 10 Sep 2022 22:08:35 +0200 Subject: [PATCH] add: now using coroutines for azazel --- DevourClient/Helpers/StateHelper.cs | 15 +++++++++++++++ DevourClient/MelonMain.cs | 29 ++++++++++++++++------------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/DevourClient/Helpers/StateHelper.cs b/DevourClient/Helpers/StateHelper.cs index 01eb81c..d13a8e4 100644 --- a/DevourClient/Helpers/StateHelper.cs +++ b/DevourClient/Helpers/StateHelper.cs @@ -51,6 +51,7 @@ namespace DevourClient.Helpers public static SurvivalDemonBehaviour[] Demons; public static SpiderBehaviour[] Spiders; public static GhostBehaviour[] Ghosts; + public static SurvivalAzazelBehaviour[] Azazels; public static IEnumerator GetLocalPlayer() { @@ -151,5 +152,19 @@ namespace DevourClient.Helpers yield return new WaitForSeconds(5f); } } + + public static IEnumerator GeAzazels() + { + /* + * ikr AzazelS, because in case we spawn multiple we want the esp to render all of them + */ + for (;;) + { + Azazels = SurvivalAzazelBehaviour.FindObjectsOfType(); + + // Wait 5 seconds before caching objects again. + yield return new WaitForSeconds(5f); + } + } } } diff --git a/DevourClient/MelonMain.cs b/DevourClient/MelonMain.cs index 19aa348..20bb3b2 100644 --- a/DevourClient/MelonMain.cs +++ b/DevourClient/MelonMain.cs @@ -46,6 +46,7 @@ namespace DevourClient MelonCoroutines.Start(Helpers.Entities.GetDemons()); MelonCoroutines.Start(Helpers.Entities.GetSpiders()); MelonCoroutines.Start(Helpers.Entities.GetGhosts()); + MelonCoroutines.Start(Helpers.Entities.GeAzazels()); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -369,23 +370,25 @@ namespace DevourClient if (this.azazel_esp || this.azazel_snapline) { - SurvivalAzazelBehaviour survivalAzazel = UnityEngine.Object.FindObjectOfType(); - if (survivalAzazel != null) + foreach (SurvivalAzazelBehaviour survivalAzazel in Helpers.Entities.Azazels) { - - - Vector3 pivotPos = survivalAzazel.transform.position; //Pivot point NOT at the origin, at the center - Vector3 playerFootPos; playerFootPos.x = pivotPos.x; playerFootPos.z = pivotPos.z; playerFootPos.y = pivotPos.y - 2f; //At the feet - Vector3 playerHeadPos; playerHeadPos.x = pivotPos.x; playerHeadPos.z = pivotPos.z; playerHeadPos.y = pivotPos.y + 2f; //At the head - - if (Camera.main != null) + if (survivalAzazel != null) { - Vector3 w2s_footpos = Camera.main.WorldToScreenPoint(playerFootPos); - Vector3 w2s_headpos = Camera.main.WorldToScreenPoint(playerHeadPos); - if (w2s_footpos.z > 0f) + + Vector3 pivotPos = survivalAzazel.transform.position; //Pivot point NOT at the origin, at the center + Vector3 playerFootPos; playerFootPos.x = pivotPos.x; playerFootPos.z = pivotPos.z; playerFootPos.y = pivotPos.y - 2f; //At the feet + Vector3 playerHeadPos; playerHeadPos.x = pivotPos.x; playerHeadPos.z = pivotPos.z; playerHeadPos.y = pivotPos.y + 2f; //At the head + + if (Camera.main != null) { - Render.Render.DrawBoxESP(w2s_footpos, w2s_headpos, Settings.Settings.azazel_esp_color, "Azazel", this.azazel_snapline, this.azazel_esp); + Vector3 w2s_footpos = Camera.main.WorldToScreenPoint(playerFootPos); + Vector3 w2s_headpos = Camera.main.WorldToScreenPoint(playerHeadPos); + + if (w2s_footpos.z > 0f) + { + Render.Render.DrawBoxESP(w2s_footpos, w2s_headpos, Settings.Settings.azazel_esp_color, "Azazel", this.azazel_snapline, this.azazel_esp); + } } } }