add: now using coroutines for azazel

This commit is contained in:
ALittlePatate
2022-09-10 22:08:35 +02:00
parent 1a306e5ee1
commit cddcb3f833
2 changed files with 31 additions and 13 deletions

View File

@@ -51,6 +51,7 @@ namespace DevourClient.Helpers
public static SurvivalDemonBehaviour[] Demons; public static SurvivalDemonBehaviour[] Demons;
public static SpiderBehaviour[] Spiders; public static SpiderBehaviour[] Spiders;
public static GhostBehaviour[] Ghosts; public static GhostBehaviour[] Ghosts;
public static SurvivalAzazelBehaviour[] Azazels;
public static IEnumerator GetLocalPlayer() public static IEnumerator GetLocalPlayer()
{ {
@@ -151,5 +152,19 @@ namespace DevourClient.Helpers
yield return new WaitForSeconds(5f); 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<SurvivalAzazelBehaviour>();
// Wait 5 seconds before caching objects again.
yield return new WaitForSeconds(5f);
}
}
} }
} }

View File

@@ -46,6 +46,7 @@ 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());
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -369,23 +370,25 @@ namespace DevourClient
if (this.azazel_esp || this.azazel_snapline) if (this.azazel_esp || this.azazel_snapline)
{ {
SurvivalAzazelBehaviour survivalAzazel = UnityEngine.Object.FindObjectOfType<SurvivalAzazelBehaviour>(); foreach (SurvivalAzazelBehaviour survivalAzazel in Helpers.Entities.Azazels)
if (survivalAzazel != null)
{ {
if (survivalAzazel != null)
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)
{ {
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);
}
} }
} }
} }